Closed bodhish closed 3 years ago
Wooo I can look at Python code
@bodhish Do we have S3 bucket that I can use or shall I create one for now to get going
You may not need the bucket. The data will be written to the bucket(https://life_data.coronasafe.network/oxygen.json) via our app.
We want the data from the bucket to be saved to this folder. https://github.com/coronasafe/life/tree/main/data (we will also know the urls for each file)
Example of GitHub action https://github.com/coronasafe/life/blob/main/.github/workflows/update_json.yml
The Python script should do 2 things.
@vandanabhandari would be happy to answer if you have more questions 😄
@bodhish I'm not clear on the "bucket", do you mean AWS S3 bucket? The link you gave doesn't look like one https://life_data.coronasafe.network/oxygen.json
I'm using S3 BOTO3 lib of python and using list=s3.list_objects(Bucket='BUCKET_NAME')['Contents']
1) If it is multiple links, can I assume all the urls are https://life_data.coronasafe.network/*.json
2) If all the data is in https://life_data.coronasafe.network/oxygen.json and this files need to be generated from https://life_data.coronasafe.network/oxygen.json then I will parse the data in oxygen.json
Listing the bucket is disabled with policy. I was thinking we could do a fetch request. We can update the list of links at a later stage. You can assume it as an array of links.
You are right that the bucket is currently digital Ocean, will be switching to s3 with a cloudfront layer on front of it at a later state. (that's the reason I was thinking we should use http fetch so that we don't have to update code if we change source at any point )
got it, so I will use request lib to from a list of links , the list hardcoded in the python file like
list list_of_file = [https://life_data.coronasafe.network/oxygen.json, https://life_data.coronasafe.network/xyz.json, https://life_data.coronasafe.network/abc.json]
data/oxygen_v2.json
When we add vaccine link to the array (assume the file name will be vaccine.json) it should create vaccine_v2.json
district_x
we want to know what all resources are available. Example: In oxygen.json kottayam
, and vaccine_v2.json we have kottayam
Example output weill be
[
{
"ambulance": false,
"contact": false,
"doctor": false,
"helpline": false,
"hospitals": false,
"medicine": false,
"oxygen": true,
"vaccine": true
"district": "kottayam",
"state": "kerala"
}
]
oh, looks like https://life_data.coronasafe.network/oxygen.json is now AccessDenied
`AccessDenied
`
@vandanabhandari we just deleted the data. It should be live in 10 minutes (infrastructure switch). I have shared a copy of the file over slack.
@vandanabhandari It's back. The link should be working now
Create a new Github action that could fetch the JSON from our public bucket and store it in the data folder.
_v2
suffix so that we don't need to break the current workflow with aritable. Exampleoxygen_v2.json
active_districts_v2.json
so that we don't need to majorly rewire the data flow in FE. (check the example). A small catch here is that there are more than 4 districts with the same name in different states so always check for state and district combination)Sample data: https://life_data.coronasafe.network/oxygen.json