kenya_locations 0.4.0
kenya_locations: ^0.4.0 copied to clipboard
Kenyan administrative divisions — counties, sub-counties, constituencies, wards, localities, and areas — as a fast, typed Dart library.
0.1.1 #
0.4.0 #
Minor Changes #
-
Rebuild the sub-counties from the Humanitarian Data Exchange and link every ward to one.
- Data:
sub-counties.jsonis now the 302 DHIS2 sub-counties from the HDX "Kenya Sub Counties" layer (American Red Cross, CC BY, 2019 to 2020), replacing 307 records that were mostly constituency names. Two layer entries with no wards (Tiaty, Kalama) are left out. They are third-party, not an official KNBS or IEBC list, and are close to constituencies. - Ward link: every ward in
wards.jsonnow has asub_county_code, from the HDX "Administrative Wards in Kenya 1450" layer. 1,346 wards match by exact name; 104 are matched by similar name or inferred from their constituency, and are listed insources/hdx-kenya-wards/matches.json. - Codes changed: sub-county codes are now five digits, the county code plus two digits
(
04701), assigned by this project.data/history.jsonmaps each old code to its replacement (240) or marks it removed (67). - JS and PHP:
getWardsInSubCountyandgetSubCountyOfWardnow use the real link instead of matching sub-county and constituency names.Wardgainssub_county_code(JS) andsubCountyCode(PHP).getSubCountyByCodezero-pads to five digits. (#76)
- Data:
0.3.1 #
0.3.0 #
Minor Changes #
-
Models now expose the parent codes and ISO codes from the data:
County.isoCodeandCounty.aliases,countyCodeonSubCounty,Constituency,LocalityandArea, andconstituencyCodeandcountyCodeonWard. Every relationship lookup now joins by code instead of by name, and county name arguments also match aliases, sogetCountyByName('Nairobi City')finds Nairobi. The model constructors gain the new fields as required parameters. (#62) -
Every record now carries its parents' codes, so data can be joined by code instead of by name. Counties gain their ISO 3166-2 code (numbered alphabetically, so Nairobi is
KE-30while its IEBC code is047) andaliases(Nairobi: "Nairobi City"). The data now ships withmeta.json(sources, license, boundary set) andhistory.json(changes by code), and is licensed CC BY 4.0. Library code stays MIT.In the JS package, every lookup now joins by code internally, the types include the new fields, and county aliases work as names:
getCountyByName("Nairobi City")finds Nairobi.Data update:
- Counties (47)
- Added
iso_codeto all 47 counties - Added
aliasesto all 47 counties
- Added
- Constituencies (290)
- Added
county_codeto all 290 constituencies
- Added
- Sub-counties (307)
- Added
county_codeto all 307 sub-counties
- Added
- Wards (1,450)
- Added
constituency_codeto all 1,450 wards - Added
county_codeto all 1,450 wards
- Added
- Localities (917)
- Added
county_codeto all 917 localities
- Added
- Areas (1,827)
- Added
county_codeto all 1,827 areas (#58)
- Added
- Counties (47)
0.2.0 #
Minor Changes #
- Make lookups consistent: numeric codes are zero-padded (
getCountyByCode('47')finds Nairobi), names fall back to ignoring accents, spaces and punctuation (MurangafindsMurang'a), and every county or constituency argument accepts a name in any case or a code.getAreasInLocalitytakes an optionalcountyand only returns areas of that county's locality; an ambiguous locality name such asBurawithout a county now returns an empty list instead of mixing areas from several counties. (#52)
Patch Changes #
-
Data fixes:
- Add the two IEBC wards that were missing:
0737Cherang'any/Chebororwa (Marakwet West) and1344Kitutu Central (Kitutu Chache South). There are now 1,450 wards. - Add a Nairobi
Rosslynlocality. The Nairobi Rosslyn area pointed to a locality that only existed in Kiambu. - Remove duplicate areas
Shimo La Tewa(Kilifi South) andBoikanga(South Mugirango).Shimo la TewaandBoikang'aremain. - Rename ward
0319fromCentral ward(double space) toCentral ward. (#46)
- Add the two IEBC wards that were missing:
-
Initial release.
-
Typed access to Kenya's counties, sub-counties, constituencies, wards, localities, and areas.
-
Relational lookups: constituencies/localities in a county, wards in a constituency, areas in a locality, and the constituency of a given ward (by unique name or ward code; ambiguous names return
null). -
Case-insensitive, typo-tolerant search across all six location types, plus
searchByType. -
Data is compiled into the package as Dart constants — no asset loading or async setup required.