CAVaccineInventory / vial

The Django application powering calltheshots.us
https://vial.calltheshots.us
MIT License
13 stars 1 forks source link

Fix some data missing from migration #259

Closed eliblock closed 3 years ago

eliblock commented 3 years ago

CC: @alexmv for more

skalnik commented 3 years ago
  • [ ] recF8KOyCoWS8WTN7 is missing from VIAL, due to missing lat/long

FWIW on this one, we don't display it on the website due to the missing lat/lng right now.

alexmv commented 3 years ago
 {
   "Availability Info": [
-    "No: no vaccine inventory",
-    "Yes: appointment calendar currently full"
+    "No: no vaccine inventory"
   ],
   "County": "Santa Cruz County",
   "Has Report": 1,
   "Latest report": "2021-04-10T18:43:25.000Z",
-  "Latest report yes?": 1,
+  "Latest report notes": "",
+  "Latest report yes?": 0,
   "Latitude": 36.95100110700608,
   "Location Type": "Super Site",
   "Longitude": -121.73504607310224,
   "Name": "Santa Cruz Fairgrounds",
   "google_places_id": "ChIJy91d95objoARWvMBGcnnQh8",
   "id": "recBtAuXk2yXPJgr3"
 }
simonw commented 3 years ago

If it's just these three we can fix these manually rather than writing any new code.

simonw commented 3 years ago

I'm going to fix these by hand-editing the JSON and running them through the import script again.

simonw commented 3 years ago
* [ ]  recOPjfftbB5VwZdP is missing from VIAL because of no address

"Santa Clara County Mobile In-home Vaccination Program" - hah, yeah that's a good edge-case! I'm going to give it an address of "Santa Clara" and move on.

simonw commented 3 years ago
select 'vaccinespotter_location_id is not null', count(*) from location where vaccinespotter_location_id is not null
union
select 'vaccinespotter_location_id is null', count(*) from location where vaccinespotter_location_id is null
column count
vaccinespotter_location_id is not null 1797
vaccinespotter_location_id is null 7939
simonw commented 3 years ago
* [ ]  rechXXFLPmWMUFLLT has no vaccinefinder_location_id or vaccinespotter_location_id in VIAL?

Looks like those are:

        "vaccinefinder_location_id": "7253e6e1-b0eb-48ac-9007-f3dabb669fce",
        "vaccinespotter_location_id": "1047871"

I'll add them to VIAL manually - only it looks like those aren't editable on the location form right now.

simonw commented 3 years ago

I hand-crafted the updated Airtable JSON for the two missing locations and ran it through this script to convert it to our import JSON format:

python -m importers.airtable_locations --dry-run ~/Desktop/vial-launch/Tuesday/missing-locations.json | pbcopy

Here's the output: https://gist.github.com/simonw/cbda3002f329a363a6c938ce5d955000

Now I'm going to paste that JSON into the debug tool at https://vial-staging.calltheshots.us/api/importLocations/debug to test that it works.

Note that https://vial-staging.calltheshots.us/admin/core/location/?q=recF8KOyCoWS8WTN7 and https://vial-staging.calltheshots.us/admin/core/location/?q=recOPjfftbB5VwZdP don't return results before the import.

simonw commented 3 years ago

After the input both those locations exist on staging, but they don't yet have any reports. Time to add the reports.

I ran this to confirm that they have reports in Reports.json:

json-post Reports.json "https://example.com" \
  --filter 'item.get("Location") and item["Location"][0] in ("recF8KOyCoWS8WTN7", "recOPjfftbB5VwZdP")' \
  --count
3

Then I imported against staging like this:

json-post Reports.json "https://vial-staging.calltheshots.us/api/importReports" \
  -h Authorization 'Bearer 3:...' \
  --log - \
  --http-read-timeout 20 \
  --filter 'item.get("Location") and item["Location"][0] in ("recF8KOyCoWS8WTN7", "recOPjfftbB5VwZdP")'
simonw commented 3 years ago

https://vial-staging.calltheshots.us/admin/core/location/9779/change/ has two reports now and https://vial-staging.calltheshots.us/admin/core/location/9780/change/ has 1

simonw commented 3 years ago

I ran these steps against production. Here are the two created locations, with their imported reports:

simonw commented 3 years ago

I fixed the vaccinefinder/spotter IDs on https://vial.calltheshots.us/admin/core/location/4987/change/