Add missing place kana fields to office data #14
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that the office data does not include
prefecture_kana
,city_kana
,neighborhood_kana
fields that are present in the normal zipcode data.To fix this, I modified the
postal_data
table in the sqlite db to add additional columns forprefecture
,city
,neighborhood
. When processing the office data, I added a step that queries thepostal_data
table for an entry that has the sameprefecture
,city
, andneighborhood
, and if it exists copies the kana fields to be stored with the office data. See the generatedofficedata.json
for example output.A side effect of this change is that it is now possible to easily query the sqlite db by prefecture, city, and/or neighborhood, which could be useful if a user wanted a list of postcodes in each region or subregion.
Since the sqlite database is being queried once for each postcode in office data, the run time for
prep.py
is somewhat longer compared to the original implementation. There is probably an opportunity for optimization, but I'm by no means a python or db expert so I'll punt on this for now.