P-codes


Overview


P-codes (Place codes) are unique geographic identification codes, usually represented by combinations of letters and numbers to identify a specific place, point, positional location or feature on a map or within a database. There is only be only one P-code per administrative unit.

P-codes are used consistently within COD-AB, COD-EM, COD-PS, and some COD-CS datasets. Gazetteers, or tables of P-codes and associated feature names are therefore provided as spreadsheet resources in these COD datasets. (The spreadsheet file name may be similar to “ken_adminboundaries_tabulardata.xlsx” or “ken_admgz.xlsx”.)

Typical applications of P-codes:

  • Linkages between a COD-AB (or COD-EM) and its associated COD-PS

  • Linkages between a COD-AB (or COD-EM), or COD-PS and another, non-COD dataset

  • Linkages between two or more non-COD datasets

  • As a taxonomic framework for a new non-COD dataset - for example, a new assessment.

P-codeP-codes are required and used at the very start of an emergency and throughout the response. P-codes help with data coordination and provide the framework for most data collection, processing, analysis, and visualization. For instance, P-codes/names are used to create the 3W and monitoring data collection frameworks. They are used to help process data such as when processing country-specific CODs (COD-CS) datasets (e.g., assigning P-codes to school locations). P-codes are used for analysis such as a prioritization matrix or a vulnerability matrix. P-codes are also used to visualize humanitarian data in maps and charts as seen in HDX, Snapshots, Bulletins, HNOs, etc.). 

How P-codes are used in humanitarian preparedness and response 

  • The unique ID can be used to different places with the same name 

  • P-code and names are used in data collection tools (e.g., 3W, RPM) 

  • Used to amalgamate data from different sources 

  • Used as a dimension for analysis (e.g., geographic severity, priority etc.) 

  • Can be applied to other datasets so that their geographic location is known if it is a spatial file 

P-coding principles and standards


  • P-codes are established by Country or Regional Offices, with the support of FIS, in consultation with the relevant Information Management Working Group.

  • Any existing P-coding system is used or incorporated. (If there is an existing numeric system, for instance, it contribute to the numeric component of a new alphanumeric P-coding system.)

  • P-codes begin with an alphabetic country code, generally derived from the ISO 3166 country codes - usually the two-character code but occasionally the three-character code. Thus the administrative level 0 (country or territory) code is the alphabetical country code alone. This forces any P-code to be recognized as text rather than a number, which has the advantage of being sure that leading zeroes are not dropped and reduces the risk of database key incompatibility, and prevents mathematical modification. The country code is also useful if CODs are ever merged into one database as it will ensure P-code uniqueness.

  • P-codes are unique within their country and world-wide.

  • Additional administrative levels usually add numerical components. The number of digits assigned to each administrative level may vary by country but is consistent within each country. Examples of real administrative level 0 to 2 P-codes from different countries:

Country or territory

Administrative level 0 (ADM0) P-code example

Administrative level 1 (ADM1) P-code example

Administrative level 2 (ADM2) P-code example

Administrative level 3 (ADM3) P-code example

Remarks

Country or territory

Administrative level 0 (ADM0) P-code example

Administrative level 1 (ADM1) P-code example

Administrative level 2 (ADM2) P-code example

Administrative level 3 (ADM3) P-code example

Remarks

Indonesia

ID

ID94

ID9433

ID9433050

 

Haiti

HT

HT08

HT0811

HT 0811-07

dash is unusual but permitted

Burundi

BDI

BDI014

BDI014006

ADM3 unavailable

three-character ADM0 code is unusual but permitted

Lebanon

LB

LB6

LB63

62179

ADM3 P-code contravenes established principles on Country Office insistence

Azerbaijan

AZ

AZ91100002

ADM2 unavailable

ADM3 unavailable

ADM2 P-code echoes pre-existing ex-Soviet formulation

Ukraine

UA

UA46

UA46115

UA4611500000

Three digits are assigned to ADM2 even though the greatest number of ADM2 features in any ADM1 feature is only 50.

 

  • P-code systems echo the administrative hierarchy such that codes at each administrative level incorporate the all higher administrative level codes, with the lower level codes appended to higher codes. The number of

  •  

  • Administrative level 1 to Administrative level x - Each administrative level receives a numeric code with enough leading zeros to ensure that the occasional addition of new administrative units will not exceed the number of codes available.  In the example below, two digits are adequate for administrative levels 1 - 3 (meaning that there are not expected to be more than 99 administration units in any one of these levels).  Level 4 can have as many as 999 administrative units.

  • Incremental Settlement Numbers (if required) - For simplicity of maintenance, it is best to use a single set of incremental numbers across the whole country (rather than within each administrative unit).  This has the additional advantage of allowing places to be referred to using only the settlement number without the admin unit codes, making them shorter. Enough digits should be used here to allow for the possibility of new datasets to be added.

P-code extension

Existing P-codes systems can be extended to code non-administrative features as they lie within a P-coded administrative feature. For example, spontaneous settlements established after the 2010 Port-au-Prince earthquake were P-coded within existing section communale (administrative level 3) P-coded features. The following fictional example establishes “ADM_SS_PCODE” P-codes for spontaneous settlements (named in field “SS_FR”) established in the real section communale features.

ADM3_FR

ADM3_PCODE

fictional SS_FR

fictional ADM_SS_PCODE

ADM3_FR

ADM3_PCODE

fictional SS_FR

fictional ADM_SS_PCODE

1re Section Montagne Noire

HT0114-01

Aurélie

HT0114-0101

1re Section Montagne Noire

HT0114-01

Gabrielle

HT0114-0102

1re Section Montagne Noire

HT0114-01

Manon

HT0114-0103

2e Section Aux Cadets

HT0114-02

Renée

HT0114-0201

2e Section Aux Cadets

HT0114-02

Sophie

HT0114-0202

5e Section Bellevue Chardonnière

HT0114-05

Valérie

HT0114-0501

5e Section Bellevue Chardonnière

HT0114-05

Véronique

HT0114-0502

5e Section Bellevue Chardonnière

HT0114-05

Zoé

HT0114-0503


How much structure is too much? 

There is a temptation to "over-structure" the P-code system, for example, having a contiguous range of Admin level 2 codes falling within a given Admin Level 1 boundary.  However, these sort of restriction, especially at the lower levels, are difficult to maintain over time and add little value to the P-code system. 

Updating the datasets

Because these datasets are a key piece of information infrastructure, it is important that changes are managed carefully to avoid breaking information systems that rely on the datasets.  Some basic rules about changes are:

  • A given P-code can be removed (if a settlement or admin unit is removed), but never re-used to represent a different place. 

  • Additions to the settlements layer can be made at any time.  However, partners should be notified when this is done.

  • Deletions in the settlements layer or any change to the administrative units must be coordinated across the humanitarian community so that all actors switch to new versions of the admin units at the same time. 

CASE STUDY:  Malawi COD-AB and COD-PS alternative P-code structures

CASE STUDY:  Malawi COD-AB and COD-PS alternative P-code structures

In 2018 it was understood that some Malawian information sources described a 32 unit administrative level 2 (district) structure while others described 28 units, the differences being four cities which might or might not be administratively distinct from their surrounding administrative districts.  (Administrative level 3 units respected each version of the administrative level 2 boundaries.)  The humanitarian community had not achieved consensus on which system to use and the government inquiries could not confirm which system that would be used in the 2018 census.

OCHA decided to base the COD-AB and COD-PS on the 32 unit system until or unless the 2018 census reports, expected in one or two years, prompted a change.  However, a table in the gazetteer mapped the '28 district' alternative names for each administrative level 3 unit so that users could derive the 28 district structure if required.

Standards 


  • P-codes must be unique within a country (no duplication of P-codes).

  • There can only be only one P-code per administrative unit.

  • P-codes in the COD-AB and COD-PS should match - and then be used by the COD-HP.

  • At a minimum, the taxonomy (names and P-codes) should be made available as a gazetteer even if the administrative boundary geometry is unavailable.

  • Ideally, a P-code is a combination of letters and / or numbers (see image above) but national systems should be adopted. If no alpha code (usually it is ISO 2 letter code) is used nationally, it may need to be added to ensure its uniqueness globally. 

  • P-codes should form the framework for or be referenced by Country Specific COD-CS datasets.  The 

  • P-code systems can be extended or enhanced by similar CODs such as health districts CODs.

Resources


  • P-code Guidance Process to develop P-codes produced by OCHA, UNHCR, and the International Center for Remote Sensing Education.

  • P-code flyer (for advocacy purposes).

P-coder tools: these tools will analyze an excel spreadsheet and verify names/p-codes. Used when processing partner 3W or monitoring data. These can be modified to fit other country needs.

Tutorial

P-code styling

The recommended way to write P-codes is in square brackets. The recommended way to write feature names is in quotation marks. Thus: “Hon'daidhoo” [MV002002].

 

 

 

Related pages