-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
住所一覧を sqlite3 の db に出力するように変更 #121
Conversation
09673a4
to
2174042
Compare
1200eae
to
b7dc81c
Compare
latest.dbはバイナリで、これは変更入るともう一つ同じファイルが入りそうな気がするのでsqliteのデータベースをgitignoreして、リリースなどのfileとしてアップロードするだけでいいかなと思いますが、いかがでしょう。。? |
5f1185e で latest.db を削除しました。 @keichan34 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございました!
test/test-build.js
Outdated
@@ -14,34 +14,34 @@ describe('latest.csvのテスト', () => { | |||
|
|||
it('一行目のデータを確認する', () => { | |||
data = lines[1] | |||
expect(data).to.equal('"20","長野県","ナガノケン","NAGANO KEN","20201","長野市","ナガノシ","NAGANO SHI","青木島二丁目","アオキジマ 2","AOKIJIMA 2",,36.617509,138.18148') | |||
expect(data).to.equal('01,"北海道","ホッカイドウ",HOKKAIDO,01101,"札幌市中央区","サッポロシチュウオウク","SAPPORO SHI CHUO KU","旭ケ丘一丁目","アサヒガオカ 1","ASAHIGAOKA 1","",43.04223,141.319722') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@champierre ありがとうございます。都道府県コード・市区町村コードはできればクオーテーションで囲まれたままの方がいいと思うのですが、いかがでしょう?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@champierre 言及されてましたね、すみません。コメントを読み飛ばしてしまっていました。
CSV パースした時って、これらの都道府県コード・市区町村コードは数字型になってしまうでしょうか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
それとも型は、csv パーサーで指定されてないとあんまり関係ないですかね?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.npmjs.com/package/sqlite-to-csv を sqlite3 の代わりに使うのを試してみます。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ライブラリは使わず以下のリンク先の部分で、CSVの形式をいままでのものに維持するようにしました。 @kamataryo
lib/export-to-csv.js
https://github.com/geolonia/japanese-addresses/pull/121/files#diff-eb6b3f0173dc22ded1459e734e13dea4578bc3dd0d3e69ebfb507593bedbec64R9
61cc4c7
to
646a565
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!
latest.csv の住所の並び番が以下の通り変更となります。
例えば都道府県コードが同じ住所同士であれば、市区町村コード 昇順に、市区町村コードも同じであれば、大字町丁目名カナ 昇順に、大字町丁目名カナまでも同じであれば、小字・通称名 昇順に並びます。
また、sqlite3 コマンドの csv 出力機能を使うことにしたため、以下のとおり、各項目をダブルクオーテーションで囲むルールが一部変更になっています。
変更前
変更後
新しいルールは以下の通りです。