wachunei / chile-division

Geographic and Administrative division of Chile, as JSON.
MIT License
4 stars 0 forks source link
chile elections node politics

Chile Division

Geographic and Administrative division of Chile, as JSON.

Data

All data is available in dist directory.

Version

Models

Models are referenced by their identifier and not nested. Check Transforms for nested versions.

Relationships

Geographic models follow a nested relationship:

Administrative models are related to Geographic models:

Properties

All properties are strings, check Transforms for versions with numbers.

Geographic

Region

Property Type Description
code (identifier) String(Number) Código Único Territorial of Region
name Object Object with two properties: full and short
name.full String Full name of Region
name.short String Short name of Region
geoOrder String(Number) Geographic order starting from 1 (northern region)

Province

Property Type Description
code (identifier) String(Number) Código Único Territorial of Province
name String Name of Province
region String(Number) Region which the Province belongs

Commune

Property Type Description
code (identifier) String(Number) Código Único Territorial of Commune
name String Name of Commune
province String(Number) Province which the Commune belongs

Administrative

Senatorial Circumscription

Property Type Description
code (identifier) String(Number) Ordinal number of Circumscription
name Object Name of Circumscription
apportionment String(Number) Quantity of seats apportioned for Senators (Senadores)
region String(Number) Region related to Circumscription

District

Property Type Description
code (identifier) String(Number) Ordinal number of District
communes Array(String(Number)) Array of Communes that belong to District
apportionment String(Number) Quantity of seats apportioned for Deputies (Diputados)
region String(Number) Region which District's communes belong to

Provincial Circumscription

Property Type Description
name (identifier) String Name of Provincial Circumscription
communes Array(String(Number)) Array of Communes that belong to Provincial Circumscription
apportionment String(Number) Quantity of seats apportioned for Regional Counselors (Consejeros Regionales)
province String(Number) Province which Provincial Circumscription belongs to

Transforms

Transforms are JavaScript modules that manipulate original JSON files and generate a different representation of them. e.g: Merge geographic models into a single object or use numbers instead of strings as values type.

Reading source files

Transforms will be given the export of src module as source (transform(source)), which is an object with this shape (default):

{
  communes: [/* … */],
  districts: [/* … */],
  provinces: [/* … */],
  provincialCircumscription: [/* … */],
  regions: [/* … */],
  senatorialCircumscription: [/* … */]
}

API

transform(source)

Applies transformation from source. Returns an object with at least one of these keys: communes, districts, provinces, provincialCircumscriptions, regions, senatorialCircumscriptions. Values of these keys must be arrays.

Identity transform

Identity transform returns the same files as source.

const transform = source => source;

export default {
  transform,
};

Available Transforms

Transform Description Exports Author
Identity Does nothing to source files Object with default shape
ValuesAsNumbers Changes all String(Number) types to Number Object with default shape @wachunei