gazetteerhk / census_explorer

Explore Hong Kong's neighborhoods through visualizations of census data
http://gazetteer.hk
MIT License
42 stars 12 forks source link

Create common mappings for front end use #5

Closed hxu closed 10 years ago

hxu commented 10 years ago

The front end will frequently need to make use of metadata, but it appears to be costly to query the database for this information all the time. We should extract this information and store as JSON static files that the front end can request.

We will probably need these mappings:

And probably also some of the reverse mappings as well.

hupili commented 10 years ago

This partly overlaps with #2 #3 #11.

Current geo naming scheme is quite ad hoc because they come from different sources. As is planned in our new data schema, district and region are included. However, district and region do not have codes like areas. I'm working on geo-naming issues:

hxu commented 10 years ago

For District Councils, why not use the letter from the Constituency Areas? I.E. all CAs in Central and Western begin with "A", so Central and Western would be coded "A"

hupili commented 10 years ago

Originally thought so, and found 'Hong Kong Island' includes more than one letters. Just checked again and found that not only districts but also regions were included in constituency_areas.py.

>>> al = AREA_CODE_ENGLISH[u'All Districts']
>>> r1 = AREA_CODE_ENGLISH[u'Hong Kong Island']
>>> r2 = AREA_CODE_ENGLISH[u'Kowloon']
>>> r3 = AREA_CODE_ENGLISH[u'New Territories']
>>> len(al)
412
>>> len(r1) + len(r2) + len(r3)
412
>>> set(r1) | set(r2) | set(r3) == set(al)
True

@2blam , district_to_regions.py is not needed... We all overlooked this on hackathon.. HK has 18 districts but there are 22 keys in constituency_areas.py..

hupili commented 10 years ago

So the geo-naming part is simple now. Use the letter as district label. For regions, since there are only three, just give them 0, 1, 2. All information can be found in constituency_areas.py.

--update

maybe hk, kl, nt for region identifiers

hxu commented 10 years ago

OK, agreed with this schema.

On Wed, Jan 29, 2014 at 2:58 PM, HU, Pili notifications@github.com wrote:

So the geo-naming part is simple now. Use the letter as district label. For regions, since there are only three, just give them 0, 1, 2. All information can be found in constituency_areas.py.

— Reply to this email directly or view it on GitHubhttps://github.com/hxu/hk_census_explorer/issues/5#issuecomment-33560965 .

clacanzo commented 10 years ago

downloading the files from the census website today I have noticed that actually the districts too have a code: usually they are coded with the same letter which appears in their CAs plus the number 00. For example Central is A00 and Wanchai is B00 and so on. At least this is what shows in the name of the excel datasheet downloaded, so I assume it is the same in the census database. The areas seem to have a different code altogether: for example Hong Kong Island is HI. Not sure if this can help at all....

hupili commented 10 years ago

Some lists can be obtained as by-proudct of of several translation dicts, http://hupili.net/projects/hk_census/data/clean/

GeoTree provides the data structure for frontend to zoom in and out.

Included in #14