Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Mechanism for populating new location vaccines_offered/accepts_appointments/accepts_walkins from VaccineFinder #504

Closed
simonw opened this issue May 5, 2021 · 9 comments
Labels
importers Tools that import data into VIAL

Comments

@simonw
Copy link
Collaborator

simonw commented May 5, 2021

Follow-on from #494. We now have these new fields on Location:

vaccines_offered = models.JSONField(
null=True,
blank=True,
help_text="JSON array of strings representing vaccines on offer here - enter 'null' if we do not know",
)
accepts_appointments = models.BooleanField(
null=True, blank=True, help_text="Does this location accept appointments"
)
accepts_walkins = models.BooleanField(
null=True, blank=True, help_text="Does this location accept walkins"
)
public_notes = models.TextField(blank=True, null=True)

We plan to initially populate these from VaccineFinder data, then later populate them from potentially other sources as well.

@simonw simonw added the importers Tools that import data into VIAL label May 5, 2021
@simonw
Copy link
Collaborator Author

simonw commented May 5, 2021

I think the way I'm going to do this is to allow special cases for imported source locations: essentially a way to say "if a source location is imported or updated, AND the source is vaccinefinder_gov, then run this custom code to extract information that can be used to update our locations data on any matched location."

@rhkeeler
Copy link

rhkeeler commented May 5, 2021

Why do we need to special-case this? I thought the goal for this design was to work no matter what the data source is -- will we need to build custom logic for each source?

@simonw
Copy link
Collaborator Author

simonw commented May 5, 2021

Yes, we'll need custom logic for each source because the way they present this data in their JSON is going to be different for each one.

@rhkeeler
Copy link

rhkeeler commented May 5, 2021

Hmm. That surprises me from what @rajbot / @bryanculbertson were saying on Monday; I had thought we had a standard way of storing the data that we could draw from, no matter the source. Or maybe it's one thing for VF data and another thing for everything else?

@simonw
Copy link
Collaborator Author

simonw commented May 5, 2021

Huh, my mistake! Looks like we do indeed have a standard mechanism defined in https://github.com/CAVaccineInventory/vaccine-feed-ingest-schema/blob/b342937b944ef477fee11512448be39181c1bfb5/vaccine_feed_ingest_schema/location.py#L402-L411

That's good, I shall implement code so that any source location that is imported which includes those fields is used to update the relevant fields on the Location.

@simonw
Copy link
Collaborator Author

simonw commented May 5, 2021

select count(*) from source_location where import_json::text like '%%supply_level%%' returns 1675 records.

Here's ten records: https://vial.calltheshots.us/dashboard/?sql=select+%2A+from+source_location+where+import_json%3A%3Atext+like+%27%25%25supply_level%25%25%27+limit+10%3A5d2gH4FcpjZMp2W8agDB6rqLOvJY3C-8SaSAZYcttH0

@simonw
Copy link
Collaborator Author

simonw commented May 5, 2021

  "inventory": [
    {
      "vaccine": "moderna",
      "supply_level": "in_stock"
    },
    {
      "vaccine": "pfizer_biontech",
      "supply_level": "out_of_stock"
    },
    {
      "vaccine": "johnson_johnson_janssen",
      "supply_level": "out_of_stock"
    }
  ],
  "availability": {
    "drop_in": false
  },

@simonw
Copy link
Collaborator Author

simonw commented May 5, 2021

Relevant schema snippets:

class Availability(BaseModel):
    """
    {
        "drop_in": bool,
        "appointments": bool,
    },
    """
    drop_in: Optional[bool]
    appointments: Optional[bool]

class Vaccine(BaseModel):
    """
    {
        "vaccine": str as vaccine type enum,
        "supply_level": str as supply level enum e.g. more_than_48hrs
    }
    """
    vaccine: VaccineType
    supply_level: Optional[VaccineSupply]

@simonw
Copy link
Collaborator Author

simonw commented Jun 9, 2021

This work will now happen in #650.

@simonw simonw closed this as completed Jun 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
importers Tools that import data into VIAL
Projects
None yet
Development

No branches or pull requests

2 participants