Closed jlundan closed 1 year ago
This pull request is being automatically deployed with ZEIT Now (learn more). To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://zeit.co/valstu/korona/cziyx4hob ✅ Preview: https://korona-git-fork-jlundan-fix-deaths-by-district.valstu.now.sh
I was thinking of dropping out those "placeholder" mappings for a bit, since technically I guess we never know if those will be filled, but then decided that I would leave them in for easy handling in the future. I can clean those out if you want to.
I did some additional detective work, and I think if I would have to take a best guess on what the API could be returning for other hospitals, it could be something like this:
export const healthCareAreaToDistrictMap : { [key:string]:string; } = {
'HYKS': 'HUS',
'EKKS': 'Etelä-Karjala',
'KOKS': 'Kymenlaakso',
'PHKS': 'Päijät-Häme',
'KYS': 'Pohjois-Savo',
'MKS': 'Etelä-Savo',
'SKS': 'Itä-Savo',
'K-SKS': 'Keski-Suomi',
'P-KKS': 'Pohjois-Karjala',
'OYS': 'Pohjois-Pohjanmaa',
'KAKS': 'Kainuu',
'K-PKS': 'Keski-Pohjanmaa',
'LKS': 'Lappi',
'L-PKS': 'Länsi-Pohja',
'TAYS': 'Pirkanmaa',
'SEKS': 'Etelä-Pohjanmaa',
'K-HKS': 'Kanta-Häme',
'TYKS': 'Varsinais-Suomi',
'SATKS': 'Satakunta',
'VKS': 'Vaasa'
};
But of course I do not know that, since I do not know how or by who the API is populated. Could push these in too. =)
Hey, and thanks for making the app!
This PR is related to issue #62
I implemented a simple lookup table for providing hospital -> health care district info and wired it to the initialProps parsing. My idea was to use the mapping table to fill in the missing health care district in the source data if the district was missing. I tried to follow you code conventions as much as possible, hopefully close enough. =)
The mapping table (and a simple function to fetch data from it) is implemented in the chartDataHelper.ts and it is used in index.ts while parsing initial props. I filled in all the hospitals the API had reported data on, and left the other ones with placeholder mappings, so we could complete the mapping table as we see new hospitals popping up in the API. Not sure if they would have a complete list of hospitals somewhere, but at least I could not find those on quick glance.
Anyways, sorry for not notifying about the PR first, just had some extra time on my hands (quarantine FTW) and decided to drop you this. Feel free to use it if you like, or drop me a note if you would like to change something.
Cheers, Juha