Skip to content

Comments

アドレス・ベース・レジストリのカタログサイト変更対応#20

Draft
sanak wants to merge 15 commits intonextfrom
17-switch-abr-download-site
Draft

アドレス・ベース・レジストリのカタログサイト変更対応#20
sanak wants to merge 15 commits intonextfrom
17-switch-abr-download-site

Conversation

@sanak
Copy link
Member

@sanak sanak commented Sep 16, 2025

概要

ABRデータのダウンロード先をCKAN API (https://catalog.registries.digital.go.jp/) から ArcGIS Hub (https://dataset.address-br.digital.go.jp/) のOGC APIに変更

対応内容

  • src/lib/ckan.ts を削除し、 src/lib/hub.ts を追加
    • getHubItemsByQuery メソッドは、 query だけでなく、 categoryLevel, categoryPref, sortBy オプション引数を追加
  • CKANと異なり、ArcGIS Hubでは日本全国レベルのデータ(町字マスター位置参照拡張/住居表示-住居マスター(位置参照拡張))が存在しなかったため、該当箇所は都道府県毎にループして処理するよう修正
  • 利用データのドキュメント(DATA.md)を更新

確認事項

  • テストの追加・更新
  • ドキュメントの更新
  • time npm run run:all 実行による、全国データの変換
    • 所要時間は main ブランチと同様、M1 MacBook Pro環境で約2時間程度

Closes #17

@sanak sanak self-assigned this Sep 16, 2025
@sanak sanak added the enhancement New feature or request label Sep 16, 2025
@sanak sanak requested a review from Copilot September 16, 2025 07:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the Address Base Registry (ABR) data source from the CKAN API (catalog.registries.digital.go.jp) to the ArcGIS Hub OGC API (dataset.address-br.digital.go.jp).

Key changes:

  • Replaced CKAN API client with Hub API client implementation
  • Updated import paths from ckan_data to abr_data directories
  • Added prefecture name-to-code mapping utilities

Reviewed Changes

Copilot reviewed 11 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/lib/hub.ts New Hub API client with search and data retrieval functions
src/lib/hub.test.ts Unit tests for the new Hub API functionality
src/lib/prefecture_name_codes.ts Prefecture name to code mapping constants
src/lib/abr_data/index.test.ts Updated test description from ckan_data to abr_data
src/processes/*.ts Updated imports and API calls to use Hub instead of CKAN
package.json Added @types/geojson dependency for TypeScript support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanak 成功・失敗のテストをお願いします。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bougan1160 コメントありがとうございます。
以下のコミットで hub.test.ts として追加しましたので、確認をお願いします。
(なお、undiciのfetchのモックが、 fetch_with_retry.test.ts の方は動作したものの、こちらの方では動作しなかったため、一旦コメントアウト+TODOで残したままとしています。)
cfda442

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undiciのfetchのモックですが、 mockAgent.disableNetConnect() だと、ネットワーク切断状態として動作するようでしたので、もう少し確認してみます。また、jestのsetup/teardown相当のnodeのbeforeEach/afterEachでキャッシュを削除する処理も追加する方向で少し検討してみます。
https://betterstack.com/community/guides/testing/nodejs-test-runner/#step-7-using-test-hooks-for-setup-and-teardown-tasks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bougan1160 追加の以下のコミットで、TODOとしていたundiciのfetchモック箇所も修正し、 mockAgent.disableNetConnect() でのネットワーク切断状態のテストも追加しましたので、お手数ですが再度確認をお願いします。
d4c279b

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanak こちらのテストの追加をお願いします。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bougan1160 コメントありがとうございます。
以下のコミットで fetch_with_retry.test.ts として追加しましたので、確認をお願いします。
cfda442

@sanak
Copy link
Member Author

sanak commented Nov 5, 2025

こちら合間が空いてしまいましたが、政令指定都市の地番が変換できていない問題を確認し、以下のコミットで対応しましたので、念のため報告します。
コミット差分: c49a023

@sanak
Copy link
Member Author

sanak commented Nov 25, 2025

こちらですが、カタログサイト変更(2025/09/16)前後で住居表示のデータが欠けていることを確認したため、一旦デジタル庁様に問い合わせ中となります。(以下の引用は問い合わせ内容(一部抜粋))
一旦Draftモードに変更します。

2025/09/12時点の変換結果と比較したところ、以下の市区町村で住居表示-住居マスターのデータが出力されなくなっておりました。

  • 北海道/千歳市
  • 北海道/富良野市
  • 北海道/川上郡弟子屈町
  • 北海道/雨竜郡沼田町
  • 千葉県/白井市
  • 和歌山県/西牟婁郡上富田町
  • 大阪府/泉南郡岬町
  • 奈良県/北葛城郡広陵町
  • 奈良県/生駒郡平群町
  • 富山県/小矢部市
  • 愛知県/蒲郡市
  • 新潟県/燕市
  • 東京都/八王子市
  • 栃木県/大田原市
  • 石川県/野々市市
  • 福井県/福井市
  • 福岡県/朝倉市
  • 群馬県/高崎市
  • 茨城県/ひたちなか市
  • 茨城県/石岡市
  • 長野県/中野市
  • 青森県/青森市
  • 高知県/四万十市
  • 鹿児島県/姶良市

なお、補足情報として、データカタログ(ダウンロード)サイト移行前は、全国の住居表示-住居マスターデータをダウンロードして利用しておりましたので、サイト移行に伴って、都道府県毎の住居表示-住居マスターデータに変わったことに伴う影響かもしれません。

他に、地番マスターデータについては、静岡県/静岡市駿河区で、地番マスター位置参照拡張の方は存在するものの、地番マスターの方が存在しないようでした。
https://dataset.address-br.digital.go.jp/search?q=%E9%9D%99%E5%B2%A1%E5%B8%82%E9%A7%BF%E6%B2%B3%E5%8C%BA

@sanak sanak marked this pull request as draft November 25, 2025 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants