fityannugroho / idn-area

API that provides information about Indonesia administrative area, based on the latest official data 🇮🇩
https://idn-area.up.railway.app
MIT License
97 stars 15 forks source link

[SUGGEST] Create island endpoints 🏝️ #28

Closed fityannugroho closed 1 year ago

fityannugroho commented 1 year ago

Is your feature request related to a problem? Please describe.

This API is currently not providing the islands data contained in Keputusan Menteri Dalam Negeri Nomor 050-145 Tahun 2022 Tentang Pemberian dan Pemutakhiran Kode, Data Wilayah Administrasi Pemerintahan, dan Pulau Tahun 2021 (starts from page 3548 to 4038).

That island data consists of:

Describe the solution you'd like

  1. Create islands.csv file that contains this column:

    • code for the island code without dot separation. For example: 110640007.
    • regency_code for relation to the regency data. For example: 1106.
    • coordinate for the island coordinate with English term. For example: 05°47'34.72" N 094°58'26.09" E.
    • is_populated with value 1 if the island is populated (BT), or 0 if (TBP) and no available data.
    • is_outermost_small with value 1 if the island is The Outermost Small Islands (PPKT), or 0 if not.
    • name for the island name. For example: Pulau Bateeleblah.
  2. Create a helper to convert the coordinate into latitude and longitude (see the coordinates converter tools example), because the latitude-longitude format is more widely supported in tech world.

  3. Create some new endpoints to get the island data:

    • /regencies/{regencyCode}/islands: to get all island in a regency.
    • /islands?name={islandName}: to get island(s) by the name.

    The return scheme of all endpoints above is same: an array of islands that contains code, regencyCode, name, coordinate, isPopulated, isOutermostSmall, plus latitude and longitude (return [] if there are no any island).

Describe alternatives you've considered

The latitude-longitude feature can be ruled out first. The main goal is that the two endpoints above can return the data as-is in the csv file.

Additional context

Especially for the development of this feature, please PR to feat/island branch.

fityannugroho commented 1 year ago

The island endpoints feature has been finished. Now, the task to solve this issue is completing the island data.

You can ask ChatGPT help to formatting the data with this prompt:

I need you to sanitize and format this raw data.
First you must learn and analyze the pattern of this raw data and the result.

// raw data
11.09.40017 Pulau Babi 02°10'08.00" U 096°38'10.00" T
11.09.40018 Pulau Balok 02°28'58.49" U 096°23'11.95" T TBP
11.09.40019 Pulau Balubuk 02°53'52.51" U 095°50'14.15" BP
11.09.40020 Pulau Balung 02°40'13.00" U 096°07'58.00" T PPTK
11.09.40023 Pulau Batuberlayar Kecil 02°25'29.46" U 096°31'18.48" T BP (PPTK)
11.09.40024 Pulau Batuhek 02°21'37.72" U 096°12'13.66" T BP
11.09.40025 Pulau Benar 02°32'17.33" U 096°21'27.12" T TBP (PPTK)
// result
code,regency_code,coordinate,is_populated,is_outermost_small,name
110940017,1109,02°10'08.00" N 096°38'10.00" E,0,0,Pulau Babi
110940018,1109,02°28'58.49" N 096°23'11.95" E,0,0,Pulau Balok
110940019,1109,02°53'52.51" N 095°50'14.15" E,1,0,Pulau Balubuk
110940020,1109,02°40'13.00" N 096°07'58.00" E,0,1,Pulau Balung
110940023,1109,02°25'29.46" N 096°31'18.48" E,1,1,Pulau Batuberlayar Kecil
110940024,1109,02°21'37.72" N 096°12'13.66" E,1,0,Pulau Batuhek
110940025,1109,02°32'17.33" N 096°21'27.12" E,0,1,Pulau Benar

Hint for you:
- Value for is_populated: `1` if `BP` present, and `0` if not.
- Value for is_outermost_small, `1` if `PPKT` present, and `0` if not .
- `BP` not same with `TBP`.
- Just ignore the `TBP`.

DON'T RETURN ANY RESPONSE NOW! Just analyze the data.

Then you can start asking ChatGPT to formatting the real data in the next prompt.

Make sure you check the ChatGPT answer from wrong data, typo, etc. Don't trust ChatGPT completely.