Skip to content

Commit bcba9be

Browse files
committed
import areas
1 parent 6a6d0c9 commit bcba9be

File tree

10 files changed

+177
-0
lines changed

10 files changed

+177
-0
lines changed

docs/tutorial/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ This Tutorials serve as a detailed manual for the utilization and navigation of
3232
- [Create a social protection program](user_guides/create_social_protection_program)
3333
- [Create a program cycle & prepare entitlements](user_guides/create_program_cycle_prepare_entitlements)
3434
- [Configure cash entitlements](user_guides/configure_cash_entitlements)
35+
- [Import area](user_guides/import_areas)
3536

3637
<!-- - [User Management]
3738
- [Registrant Management]
@@ -77,6 +78,7 @@ user_guides/allocate_funds
7778
user_guides/create_social_protection_program
7879
user_guides/create_program_cycle_prepare_entitlements
7980
user_guides/configure_cash_entitlements
81+
user_guides/import_areas
8082
8183
8284
```
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Introduction
2+
3+
In this tutorial, you will learn how to prepare and import area data into OpenSPP using an Excel workbook.
4+
5+
# Prerequisites
6+
7+
To be able to successfully import area data into OpenSPP, the following is required:
8+
9+
- Authorized administrative access to the OpenSPP platform.
10+
- As OpenSPP supports multiple languages for an area name, language support for the languages you want to use must be configured.
11+
- A spreadsheet software that can export data as an Excel workbook.
12+
13+
# Objective
14+
15+
By the end of this tutorial, you should understand the purpose and process of preparing the data required to import area data into OpenSPP. You will learn how OpenSPP’s area structure can be used to represent the hierarchical relationship between the areas of your operations.
16+
17+
# Process
18+
19+
To access the area import feature, you must log in to OpenSPP with a user account with the **System Admin** role since the functionality is not included for other roles. Learn how to set up roles and accounts in [Administrating role-based access](https://docs.openspp.org/tutorial/user_guides/administrating_role_based_access.html).
20+
21+
## Understand the Data Structure
22+
23+
The area data is structured hierarchically, with each sheet representing an **administrative level**:
24+
25+
- **Level 0:** Top-level areas (e.g., Countries).
26+
- **Level 1 and below:** Subdivisions (e.g., Provinces, States).
27+
28+
Each sheet must follow specific rules regarding column headers and data.
29+
30+
## Create the Excel File/Workbook
31+
32+
1. Open Excel or any spreadsheet software.
33+
2. Create a new workbook.
34+
3. Rename each sheet to represent an administrative level, starting with the top-most level (e.g., "ADM0", "ADM1").
35+
36+
## Add Column Headers
37+
38+
Use the following column headers:
39+
40+
#### **Level 0 Sheet (Top-Level Areas) – sheet name “ADM0”**
41+
42+
| Column | Description | Example |
43+
| ------------------ | -------------------------------------------------------------------------------------------------------- | ------- |
44+
| ADM0_PCODE | Unique code for the top-level area. | CN01 |
45+
| ADM0\_\<ISO_CODE\> | Name of the area in each language. Replace `<ISO_CODE>` with the language's ISO code (e.g., `EN`, `FR`). | China |
46+
| AREA_SQKM | Area size in square kilometers (optional). | 9596961 |
47+
48+
#### **Level 1 Sheet (Subdivisions) – sheet name “ADM1”**
49+
50+
| Column | Description | Example |
51+
| ------------------ | -------------------------------------------------------------------------------------------- | --------- |
52+
| ADM1_PCODE | Unique code for the subdivision. | CN01_PR01 |
53+
| ADM1\_\<ISO_CODE\> | Name of the subdivision in each language. Replace \<ISO_CODE\> with the language's ISO code. | Beijing |
54+
| ADM0_PCODE | Code of the parent area (from Level 0). | CN01 |
55+
| ADM0\_\<ISO_CODE\> | Name of the parent area in each language. | China |
56+
| AREA_SQKM | Area size in square kilometers (optional). | 16411 |
57+
58+
Repeat the same structure for additional levels, adjusting the column headers to match the level (e.g., `ADM2_PCODE` for Level 2).
59+
60+
## Fill in the Data
61+
62+
**Start with Level 0:**
63+
64+
- Fill in the **ADM0_PCODE** column with unique codes for each top-level area.
65+
- Add the name of each area in at least one language (e.g., ADM0_EN for English).
66+
- (Optional) Provide area sizes in the **AREA_SQKM** column.
67+
68+
**Example (Level 0 Sheet):**
69+
70+
![](import_areas/1.png)
71+
72+
**Move to Level 1:**
73+
74+
- Use the **ADM1_PCODE** column to add unique codes for subdivisions.
75+
- Reference the parent area by filling in **ADM0_PCODE** and its corresponding names.
76+
- Add names for subdivisions in each active language.
77+
- (Optional) Add area sizes.
78+
79+
**Example (Level 1 Sheet):**
80+
81+
![](import_areas/2.png)
82+
83+
Repeat the process for additional levels.
84+
85+
## Verify the Data
86+
87+
- **Unique Codes:** Ensure that all **ADMx_PCODE** values are unique.
88+
- **Language Headers:** Check that all language ISO codes in the headers match the active languages in OpenSPP.
89+
- **Hierarchy:** For levels \> 0, ensure that each row references a valid parent area in the **ADMx_PCODE** column.
90+
- Make sure there are no trailing spaces on the column headers.
91+
92+
## Save the File
93+
94+
Save the workbook in .xlsx format. Then name the file descriptively, e.g., Area_Import.xlsx.
95+
96+
## Import the File
97+
98+
Navigate to the **Areas Import** module in OpenSPP by clicking on **Area →Areas**
99+
100+
![](import_areas/3.png)
101+
102+
Click on **New**
103+
![](import_areas/4.png)
104+
105+
Click on **Upload your file.** Once uploaded, click on **import button to complete**
106+
![](import_areas/5.png)
107+
108+
Once uploaded, click on the **import** button to complete.
109+
![](import_areas/6.png)
110+
111+
## Tips for Success
112+
113+
- **Batch Updates:** If importing large datasets, break them into smaller files for easier management.
114+
- **Error Handling:** If the system reports errors during validation, review the "Remarks/Errors" column in the raw data to fix issues.
115+
116+
## Additional information
117+
118+
Each sheet must contain the following headers in the first row:
119+
120+
#### **General Columns**
121+
122+
1. **ADM{level}\_PCODE**
123+
- **Description:** Unique code for the administrative area at the current level.
124+
- **Example:** CN01 for a province code.
125+
- **Required:** Yes.
126+
2. **ADM{level}\_\<ISO_CODE\>**
127+
- **Description:** Name of the administrative area in various languages. Replace \<ISO_CODE\> with the language's ISO code (e.g., EN, FR).
128+
- **Example:** ADM1_EN for the English name of a first-level administrative area.
129+
- **Required:** At least one language column must be provided. Multiple language columns are supported.
130+
3. **AREA_SQKM**
131+
- **Description:** Size of the administrative area in square kilometers.
132+
- **Required:** No. If provided, must be numerical.
133+
134+
#### **Parent Area Columns (For levels \> 0\)**
135+
136+
4. **ADM{parent_level}\_PCODE**
137+
- **Description:** Code of the parent administrative area (one level above).
138+
- **Example:** ADM0_PCODE in ADM1 sheet.
139+
- **Required:** Yes for levels \> 0\.
140+
5. **ADM{parent_level}\_\<ISO_CODE\>**
141+
- **Description:** Name of the parent administrative area in various languages.
142+
- **Required:** Yes for levels \> 0\.
143+
144+
## Data Rules
145+
146+
- **Languages:** All ISO codes in the headers must match active languages in the system. Inactive languages will cause the import to fail.
147+
- **Level 0 Areas:** Should not have parent codes or parent names.
148+
- **Level \> 0 Areas:** Must include parent codes and parent names.
149+
- **Area Codes:** Must be unique across all sheets.
150+
- **Square Kilometers (AREA_SQKM):** Should be a valid numerical value if provided.
151+
152+
## Validation
153+
154+
1. **Automatic Checks:**
155+
- The system validates for missing or invalid values.
156+
- Rows with errors are marked with details in the "Remarks/Errors" column.
157+
2. **Error Scenarios:**
158+
- Missing or non-numerical values in required columns.
159+
- Inconsistent hierarchy (e.g., missing parent codes for levels \> 0).
160+
161+
## How data is processed
162+
163+
- Sheets are processed sequentially by level.
164+
- Data is imported in batches for efficiency. Errors are logged for each batch.
165+
- After import, data can be validated and saved into the main area database.
166+
167+
## ISO codes
168+
169+
To get the ISO codes of the language you wish to use in the workbook. Go to OpenSPP and login as Administrator, Click on **Settings** and click on **Manage Languages** from the Languages section.
170+
171+
![](import areas_7.png)
172+
173+
You can find the ISO code under the **ISO code** column of the language you want to add in your workbook.
174+
175+
![](import_areas/8.png)
7.82 KB
Loading
18.8 KB
Loading
16.9 KB
Loading
12.3 KB
Loading
88.8 KB
Loading
29.2 KB
Loading
52.4 KB
Loading
147 KB
Loading

0 commit comments

Comments
 (0)