-
Notifications
You must be signed in to change notification settings - Fork 166
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
feat(fetcher): implement vaksinasi.id db fetcher #806
Conversation
Fetches vaksinasi.id's DB and store it in wbw-vaccination-database.json Refs: #803
✔️ Deploy Preview for wargabantuwarga ready! 🔨 Explore the source changes: d5de61b 🔍 Inspect the deploy log: https://app.netlify.com/sites/wargabantuwarga/deploys/616aa402ea93030007ec85f0 😎 Browse the preview: https://deploy-preview-806--wargabantuwarga.netlify.app |
Codecov Report
@@ Coverage Diff @@
## main #806 +/- ##
==========================================
+ Coverage 86.92% 87.06% +0.13%
==========================================
Files 133 134 +1
Lines 1423 1438 +15
Branches 454 455 +1
==========================================
+ Hits 1237 1252 +15
Misses 181 181
Partials 5 5
Continue to review full report at Codecov.
|
Mm, should I put mark this as "Ready for Review" or not? |
There is an ESLint warning in c84e78c, this commit addresses that warn
Since your
For a first-time contribution, your code seems sufficiently clean. You also write good tests as well. Thanks! |
Oh, well. Maybe I'm just too shy. Your welcome! |
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.
Overall, your implementation looks good and is going in the right direction.
However, we need you to perform further transformation into the data so that it's ready to be used downstream in the components.
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.
LGTM, wait for approval from others
You can contact me on Twitter @FortressValkyrie after this PR merged. |
fetchVaccinationDatabase() is so fast that a spinner stucks the program. So, move it to the top and remove line 37.
…tible Transforms the output of the vaccination db fetcher to VaccinationContact[]. This will make it ready to be used downstream in the components. The VaccinationContact interface has a 'map' property. This is unecessary as WBW's "Buka Peta" button uses the address instead. Though, I still add it in case we want to use that for the "Buka Peta" button.
…nce[] Make it easy for the DB to be merged with the other contact DBs. Using VaccinationContact[] might force us into unnecessarily iterating the array just to merge it.
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.
Wait, will d4d8379 really help reducing unnecessary iterations? Idk, I'm dumb. If you want to revert this, just tell me.
Is ccb05a7 good? |
I'll review it later tonight. |
Yes, I think so. But I think it would be better if you can structure it into this format instead, so when we're iterating the provinces, we can easily get the data by accessing the property using computed values from the province name. {
"Aceh": [
{
"alamat": "Jalan Inong Balee No.38 Darussalam Banda Aceh",
"lokasi": "Kota Banda Aceh",
"buka_waktu": "08:00:00",
"id": "0",
"informasi_2": "-Senin dan Sabtu (bisa berubah sewaktu-waktu)\n-Dibeikan bagi warga dengan kriteria:\n1.petugas pelayanan publik\n2. Pra lansia &lansia\n3. Masyarakat Banda Aceh di utamakan yang berdomisili di wilayah Puskesmas Kopelma Darussalam,Rukoh,ie masen kayee adang,Lamgugob & Deah raya\n-Membawa KTP\n-informasi tambahan bisa dilihat di akun Instagram https://instagram.com/puskesmaskopelmadarussalam?utm_medium=copy_link",
"keterangan": "Lokasi Vaksinasi COVID-19",
"link": "https://www.instagram.com/p/CQgFAepnZkQ/?utm_medium=copy_link",
"map": "https://goo.gl/maps/9hViESZJ9rYwGypb9",
"mulai_tanggal": "2021-06-24",
"penyedia": "UPTD PUSKESMAS KOPELMA DARUSSALAM",
"rentang_umur": ["Dewasa (18-59 Tahun)", "Lansia (60-)"],
"selesai_tanggal": "2022-03-31",
"slug": "uptd-puskesmas-kopelma-darussalam",
"terakhir_update": "2021-07-30",
"tutup_waktu": "12:00:00",
"verifikasi": 1
}
]
} |
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.
Nice, thanks for making the changes! ✅
But I still have another minor request here, could you please address it? Thanks! 🙏
f35f99b is done. Is this ready now? |
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.
The code seems good enough so far.
However, when I tried running it locally while logging each step of the API calls, it seems that it only managed to fetch the data for four provinces.
Could you please try doing the same thing here in your local machine and share your results in screenshots? Thanks! 🙏
Okay, then. Let's try seeing it in action at Netlify. We will be able to see how it works in Netlify. If it breaks nothing, we can proceed with merging this PR. Thanks! |
Wait, with the console.logs you put or not? |
Without the console logging, we couldn't see anything here. Let's try adding the console logging and see how it goes. |
Deployed it to a personal Netlify site. Yep, could reproduce your issue. Idk why though. |
LET'S GET THIS MERGED!!!
https://gist.github.com/FortressValkyrie/209da5c86d48e18f0bf825d01803a289 |
Is e94dbfb good yet? I didn't expect this PR to take so much time for this simple fetcher. |
@zainfathoni Hey, I have fixed the bug already. Can you review it? |
Sorry for the slow response. Okay, I'll try to make some time later today to review it. Thanks! 🙏 |
Okay. Waiting for it. |
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.
LGTM 💯
Thanks for tirelessly working on this issue. Sorry for my slow response, I was pretty occupied in the past few weeks. 😅 🙏
@all-contributors please add @FortressValkyrie for code, test. |
I've put up a pull request to add @FortressValkyrie! 🎉 |
Your welcome. Haha, that's fine. |
Can you contact me on the Twitter @FortressValkyrie ? |
Fetches vaksinasi.id's DB and store it in wbw-vaccination-database.json
Closes #803
Description
The issue didn't give a lot of information, but I assume the goal is to have all the data from the API, as the endgoal is to write it all to wbw-vaccination-database. So this will fetch for the
/regions
endpoint of the vaksinasi.id API first, then iterate over the provinces and fetch its vaccination locations from the/locations/:region
endpoint, dump all of the Promise'd JSON response into thepromisedLocations
array and then usePromise.all
to await all of the promises in thelocations
array. Lastly, stringifylocations
and write it intowbw-vaccination-database.json
Just a quick question. I wrote the mockups for the responses in the
vaksinid-${endpoint}
format, but as I think this project uses thewbw
prefix a lot, should I rename them to use thewbw
prefix or not?Also this is my first time contributing to big projects. Please forgive me for my mistakes.
Current Tasks