Esempio n. 1
0
    def _get_normalized_site(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:
        name = site["attributes"]["SITE_NAME"].title()
        lat_lng = _get_lat_lng(site)
        addr = schema.Address(
            street1=site["attributes"]["Match_addr"],
            street2=None,
            city=site["attributes"]["CITY"].title(),
            state=STATE,
            zip=str(site["attributes"]["ID_ZIPCODE"]),
        )
        id = _id("51d4c310f1fe4d83a63e2b47acb77898", lat_lng, name, addr)

        return schema.NormalizedLocation(
            id=f"{SOURCE_NAME}:{id}",
            name=name,
            address=addr,
            location=lat_lng,
            source=schema.Source(
                source=SOURCE_NAME,
                id=id,
                fetched_from_uri=FETCHED_FROM_URI,
                fetched_at=timestamp,
                data=site,
            ),
        )
Esempio n. 2
0
def normalize_location(
        loc: GMVLocation,
        timestamp: datetime.datetime) -> location.NormalizedLocation:
    return location.NormalizedLocation(
        id=f"{SOURCE_NAME}:{loc.id}",
        name=loc.name,
        address=_get_address(loc),
        location=_get_lat_lng(loc),
        contact=_get_contacts(loc),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=_get_availability(loc),
        inventory=_get_inventory(loc),
        access=None,
        parent_organization=_get_parent_organization(loc),
        links=_get_links(loc),
        notes=None,
        active=None,
        source=location.Source(
            source=SOURCE_NAME,
            id=loc.id,
            fetched_from_uri=LOCATIONS_URL,
            fetched_at=timestamp,
            published_at=loc.updated_at,
            data=loc.dict(exclude_none=True),
        ),
    )
Esempio n. 3
0
    def _get_normalized_site(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:
        name = site["attributes"]["f2"]
        lat_lng = _get_lat_lng(site)
        addr = schema.Address(
            street1=site["attributes"]["f3"],
            street2=None,
            city=site["attributes"]["f4"].title(),
            state=STATE,
        )
        id = _id("8f23e1c3b5c54198ab60d2f729cb787d", lat_lng, name, addr)

        return schema.NormalizedLocation(
            id=f"{SOURCE_NAME}:{id}",
            name=name,
            address=addr,
            location=lat_lng,
            source=schema.Source(
                source=SOURCE_NAME,
                id=id,
                fetched_from_uri=FETCHED_FROM_URI,
                fetched_at=timestamp,
                data=site,
            ),
        )
def _get_normalized_location(site: dict, timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=site["attributes"]["USER_Name"],
        address=schema.Address(
            street1=site["attributes"]["USER_Address"],
            street2=None,
            city=site["attributes"]["USER_City_Town"],
            state="RI",
            zip=site["attributes"]["ZIPCODE"],
        ),
        location=schema.LatLng(
            latitude=site["geometry"]["y"],
            longitude=site["geometry"]["x"],
        ),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=None,
        inventory=_get_inventory(site),
        access=None,
        parent_organization=None,
        links=None,
        notes=_get_notes(site),
        active=None,
        source=schema.Source(
            source="ri_arcgis",
            id=site["attributes"]["OBJECTID"],
            fetched_from_uri="https://rihealth.maps.arcgis.com/apps/instant/nearby/index.html?appid=a25f35833533498bac3f724f92a84b4e",  # noqa: E501
            fetched_at=timestamp,
            published_at=None,
            data=site,
        ),
    )
Esempio n. 5
0
def _get_normalized_location(site: dict, timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=site["attributes"]["NAME"],
        address=schema.Address(
            street1=site["attributes"]["ADDRESS"],
            street2=None,
            city=site["attributes"]["CITY"],
            state=site["attributes"]["STATE"],
            zip=site["attributes"]["ZIP"],
        ),
        location=_get_location(site),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=None,
        inventory=None,
        access=None,
        parent_organization=None,
        links=None,
        notes=None,
        active=None,
        source=schema.Source(
            source="wi_arcgis_map",
            id=site["attributes"]["OBJECTID"],
            fetched_from_uri="https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_Vaccine_Provider_Sites/MapServer/0",  # noqa: E501
            fetched_at=timestamp,
            published_at=None,
            data=site,
        ),
    )
Esempio n. 6
0
def _get_normalized_location(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=site["attributes"]["Name"],
        address=_get_address(site),
        location=schema.LatLng(
            latitude=site["geometry"]["y"],
            longitude=site["geometry"]["x"],
        ),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=None,
        inventory=_get_inventory(site),
        access=None,
        parent_organization=None,
        links=None,
        notes=_get_notes(site),
        active=None,
        source=schema.Source(
            source="in_arcgis",
            id=site["attributes"]["GlobalID"],
            fetched_from_uri=
            "https://experience.arcgis.com/experience/24159814f1dd4f69b6c22e7e87bca65b",  # noqa: E501
            fetched_at=timestamp,
            published_at=None,
            data=site,
        ),
    )
def _get_normalized_location(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=site["attributes"]["loc_name"],
        address=_get_address(site),
        location=schema.LatLng(
            latitude=site["geometry"]["y"],
            longitude=site["geometry"]["x"],
        ),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        # There is an "Appointments" field in the data though it is unclear whether this should be interpreted as
        # "An appointment is required" or "An appointment is available". Leaving blank as this information
        # will likely need phone bankers and/or web team to find availability
        availability=None,
        inventory=_get_inventory(site),
        access=None,
        parent_organization=None,
        links=None,
        notes=None,
        active=_get_activated(site),
        source=schema.Source(
            source="sc_arcgis",
            id=site["attributes"]["GlobalID"],
            fetched_from_uri=
            "https://opendata.arcgis.com/datasets/bbd8924909264baaa1a5a1564b393063_0.geojson",  # noqa: E501
            fetched_at=timestamp,
            data=site,
        ),
    )
Esempio n. 8
0
def normalize(site: dict) -> schema.NormalizedLocation:
    """Converts the parsed `site` into a normalized site location."""
    name = site.get("name")
    address = schema.Address(
        street1=site.get("street1"),
        street2=site.get("street2"),
        city=site.get("city"),
        state=site.get("state"),
        zip=normalize_zip(site.get("zip")),
    )
    source = schema.Source(
        source=_SOURCE_NAME,
        id=_generate_id(name, address),
        fetched_from_uri=normalize_url(site.get("fetched_from_uri")),
        published_at=_normalize_date_string(site.get("published_at")),
        data=site,
    )
    county = site.get("county")
    opening_times = _normalize_opening_times(site.get("opening_times"))
    normalized_site = schema.NormalizedLocation(
        name=name,
        id=_make_site_id(source),
        source=source,
        address=address,
        active=True,  # this source updates weekly
        opening_dates=opening_times[0] if opening_times else None,
        opening_hours=opening_times[1] if opening_times else None,
        notes=[county] if county else None,
    )
    return normalized_site
Esempio n. 9
0
def normalize(site: dict, timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=_get_title(site["title"]),
        address=_get_address(site["address"]),
        location=schema.LatLng(
            latitude=site["lat"],
            longitude=site["lng"],
        ),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=None,
        inventory=None,
        access=None,
        parent_organization=None,
        links=_get_links(site),
        notes=None,
        active=None,
        source=schema.Source(
            source="immunizenevada_org",
            id=site["id"],
            fetched_at=timestamp,
            fetched_from_uri=
            "https://www.immunizenevada.org/covid-19-vaccine-locator",
            data=site,
        ),
    )
Esempio n. 10
0
    def _get_normalized_site(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:
        name = site["attributes"]["f3"]
        lat_lng = _get_lat_lng(site)
        id = _id("d1a799c7f98e41fb8c6b4386ca6fe014", lat_lng, name, None)

        return schema.NormalizedLocation(
            id=f"{SOURCE_NAME}:{id}",
            name=name,
            address=None,
            location=lat_lng,
            contact=_get_contact(site),
            availability=schema.Availability(
                drop_in=False,
                appointments=True,
            ),
            notes=[site["attributes"]["f5"]],
            source=schema.Source(
                source=SOURCE_NAME,
                id=id,
                fetched_from_uri=FETCHED_FROM_URI,
                fetched_at=timestamp,
                data=site,
            ),
        )
Esempio n. 11
0
def normalize(site: dict, timestamp: str) -> schema.NormalizedLocation:
    source_name = "fl_state"
    return schema.NormalizedLocation(
        id=f"{source_name}:{_get_id(site)}",
        name=site["title"],
        address=schema.Address(
            street1=site["address"],
            street2=None,
            city=site["location"]["city"],
            state="FL",
            zip=site["location"].get("postal_code", None),
        ),
        location=schema.LatLng(
            latitude=convert_lat_lng(site["location"]["lat"]),
            longitude=convert_lat_lng(site["location"]["lng"]),
        ),
        contact=_get_contacts(site),
        notes=_get_notes(site),
        source=schema.Source(
            source=source_name,
            id=site["id"],
            fetched_from_uri=
            "https://floridahealthcovid19.gov/vaccines/vaccine-locator/",
            fetched_at=timestamp,
            data=site,
        ),
    )
Esempio n. 12
0
def _get_normalized_location(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=site["attributes"]["loc_name"],
        address=schema.Address(
            street1=site["attributes"]["addr1"],
            street2=site["attributes"]["addr2"],
            city=site["attributes"]["city"],
            state="AZ",
            zip=site["attributes"]["zip"],
        ),
        location=_get_lat_lng(site),
        contact=_get_contacts(site),
        languages=_get_languages(site),
        opening_dates=_get_opening_dates(site),
        opening_hours=_get_opening_hours(site),
        availability=None,
        inventory=_get_inventory(site),
        access=None,
        parent_organization=None,
        links=None,
        notes=[site["attributes"]["prereg_comments"]]
        if site["attributes"]["prereg_comments"] else None,
        active=None,
        source=schema.Source(
            source="az_arcgis",
            id=site["attributes"]["globalid"],
            fetched_from_uri=
            "https://adhsgis.maps.arcgis.com/apps/opsdashboard/index.html#/5d636af4d5134a819833b1a3b906e1b6",  # noqa: E501
            fetched_at=timestamp,
            data=site,
        ),
    )
Esempio n. 13
0
def _get_normalized_location(site: dict, timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=site["attributes"]["Facility_Name"],
        address=schema.Address(
            street1=site["attributes"]["Address"],
            street2=site["attributes"]["Address_2"],
            city=site["attributes"]["City"],
            state="PA",
            zip=site["attributes"]["ZIP_Code"],
        ),
        location=schema.LatLng(
            latitude=site["geometry"]["y"],
            longitude=site["geometry"]["x"],
        ),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=None,
        inventory=None,
        access=None,
        parent_organization=None,
        links=None,
        notes=None,
        active=None,
        source=schema.Source(
            source="pa:arcgis",
            id=site["attributes"]["Clinic_ID"],
            fetched_from_uri="https://padoh.maps.arcgis.com/apps/webappviewer/index.html?id=e6f78224c6fe4313a1f70b56f553c357",  # noqa: E501
            fetched_at=timestamp,
            published_at=None,
            data=site,
        ),
    )
Esempio n. 14
0
def _get_normalized_location(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:

    return schema.NormalizedLocation(
        id=f"{SOURCE_NAME}:{_get_id(site)}",
        name=site["attributes"]["location"],
        address=_get_address(site),
        location=_get_location(site),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=_get_opening_dates(site),
        opening_hours=_get_opening_hours(site),
        availability=None,
        inventory=_get_inventory(site),
        access=None,
        parent_organization=_get_parent(site),
        links=None,
        notes=_get_notes(site),
        active=None,
        source=schema.Source(
            source=SOURCE_NAME,
            id=_get_id(site),
            fetched_from_uri=
            "https://publichealth.harriscountytx.gov/Resources/2019-Novel-Coronavirus/Register-for-COVID-19-Vaccine",  # noqa: E501
            fetched_at=timestamp,
            published_at=_get_published_at(site),
            data=site,
        ),
    )
Esempio n. 15
0
def _get_normalized_location(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:

    if site.get("offers_vaccine") == "No":
        return None

    return schema.NormalizedLocation(
        id=f"{SOURCE_NAME}:{_get_id(site)}",
        name=site["attributes"]["name"],
        address=_get_address(site),
        location=try_get_lat_long(site),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=_get_opening_dates(site),
        opening_hours=_get_opening_hours(site),
        availability=_get_availability(site),
        inventory=None,
        access=_get_access(site),
        parent_organization=None,
        links=None,  # TODO
        notes=_get_notes(site),
        active=_get_active(site),
        source=schema.Source(
            source=SOURCE_NAME,
            id=site["attributes"]["GlobalID"],
            fetched_from_uri=
            "https://services.arcgis.com/8ZpVMShClf8U8dae/arcgis/rest/services/Covid19_Vaccination_Locations/FeatureServer/0",  # noqa: E501
            fetched_at=timestamp,
            published_at=_get_published_at(site),
            data=site,
        ),
    )
Esempio n. 16
0
def _get_normalized_location(site: dict,
                             timestamp: str) -> schema.NormalizedLocation:
    id_ = _get_id(site)

    return schema.NormalizedLocation(
        id=id_,
        name=site["attributes"]["name"],
        address=_get_address(site),
        location=schema.LatLng(latitude=site["geometry"]["y"],
                               longitude=site["geometry"]["x"]),
        contact=_get_contacts(site),
        opening_hours=_get_opening_hours(site),
        availability=_get_availability(site),
        access=_get_access(site),
        notes=_get_notes(site),
        source=schema.Source(
            data=site,
            fetched_at=timestamp,
            fetched_from_uri=
            f"https://adhsgis.maps.arcgis.com/apps/opsdashboard/index.html#/{site['attributes']['service_item_id']}",  # noqa: E501
            id=id_.split(":")[-1],
            published_at=_get_published_at(site),
            source="md_arcgis",
        ),
    )
Esempio n. 17
0
def _get_normalized_location(site: dict, timestamp: str) -> schema.NormalizedLocation:
    return schema.NormalizedLocation(
        id=_get_id(site),
        name=site["attributes"]["USER_Provider_Name"],
        address=_get_address(site),
        location=schema.LatLng(
            latitude=site["geometry"]["y"],
            longitude=site["geometry"]["x"],
        ),
        contact=_get_contacts(site),
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=None,
        inventory=None,
        access=None,
        parent_organization=None,
        links=None,
        notes=None,
        active=None,
        source=schema.Source(
            source="mo_arcgis",
            id=site["attributes"]["GlobalID"],
            fetched_from_uri="https://www.arcgis.com/apps/webappviewer/index.html?id=ab04156a03584e31a14ae2eb36110c20",  # noqa: E501
            fetched_at=timestamp,
            published_at=None,
            data=site,
        ),
    )
Esempio n. 18
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        source="wa_prepmod",
        id=site["name"],
        fetched_from_uri="https://prepmod.doh.wa.gov/clinic/search",
        fetched_at=timestamp,
        data=site,
    )
Esempio n. 19
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        data=site,
        fetched_at=timestamp,
        fetched_from_uri="https://www.maine.gov/covid19/vaccines/vaccination-sites",
        id=_get_id(site),
        source="me_maine_gov",
    )
Esempio n. 20
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        data=site,
        fetched_at=timestamp,
        fetched_from_uri="https://myspot.nc.gov/api/get-vaccine-locations",
        id=site["Event Location Id"],
        source="nc_myspot_gov",
    )
Esempio n. 21
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        data=site,
        fetched_at=timestamp,
        fetched_from_uri="https://vaccinate.tn.gov/vaccine-centers/",
        id=_get_id(site),
        source=SOURCE_NAME,
    )
Esempio n. 22
0
def _get_source(config: dict, site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        source=config["site"],
        id=site["clinic_id"],
        fetched_from_uri=urllib.parse.urljoin(config["url"], "clinic/search"),
        fetched_at=timestamp,
        data=site,
    )
Esempio n. 23
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        data=site,
        fetched_at=timestamp,
        fetched_from_uri="https://www.pinalcountyaz.gov/publichealth/CoronaVirus/Pages/vaccinelocations.aspx",
        id=_get_id(site),
        source=RUNNER_ID,
    )
Esempio n. 24
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        data=site,
        fetched_at=timestamp,
        fetched_from_uri="https://govstatus.egov.com/kentucky-vaccine-map",
        id=_get_id(site),
        source=SOURCE_NAME,
    )
Esempio n. 25
0
def _get_source(site: dict, timestamp: str) -> location.Source:
    return location.Source(
        source="il_juvare",
        id=site["slug"],
        fetched_from_uri="https://covidvaccination.dph.illinois.gov/",
        fetched_at=timestamp,
        data=site,
    )
Esempio n. 26
0
def normalize(site: dict, timestamp: str) -> dict:
    links = [
        schema.Link(authority="ct_gov", id=site["_id"]),
        schema.Link(authority="ct_gov_network_id", id=site["networkId"]),
    ]

    parent_organization = schema.Organization(name=site["networks"][0]["name"])

    parsed_provider_link = provider_id_from_name(site["name"])
    if parsed_provider_link is not None:
        links.append(
            schema.Link(authority=parsed_provider_link[0], id=parsed_provider_link[1])
        )

        parent_organization.id = parsed_provider_link[0]

    return schema.NormalizedLocation(
        id=f"ct_gov:{site['_id']}",
        name=site["displayName"],
        address=schema.Address(
            street1=site["addressLine1"],
            street2=site["addressLine2"],
            city=site["city"],
            state="CT",
            zip=site["zip"],
        ),
        location=_get_lat_lng(site),
        contact=[
            schema.Contact(
                contact_type="booking", phone=site["phone"], website=site["link"]
            ),
        ],
        languages=None,
        opening_dates=None,
        opening_hours=None,
        availability=schema.Availability(
            appointments=site["availability"],
        ),
        inventory=[
            schema.Vaccine(vaccine=vaccine["name"])
            for vaccine in site["providerVaccines"]
        ],
        access=schema.Access(
            drive=site["isDriveThru"],
        ),
        parent_organization=parent_organization,
        links=links,
        notes=None,
        active=None,
        source=schema.Source(
            source="covidvaccinefinder_gov",
            id=site["_id"],
            fetched_from_uri="https://covidvaccinefinder.ct.gov/api/HttpTriggerGetProvider",  # noqa: E501
            fetched_at=timestamp,
            published_at=site["lastModified"],
            data=site,
        ),
    ).dict()
Esempio n. 27
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        source="ok_vaccinate_gov",
        id=site["Id"],
        fetched_from_uri=
        "https://vaccinate.oklahoma.gov/en-US/vaccine-centers/",
        fetched_at=timestamp,
        data=site,
    )
Esempio n. 28
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        data=site,
        fetched_at=timestamp,
        fetched_from_uri=
        "https://www.pinalcountyaz.gov/publichealth/Pages/OfficeLocations.aspx",
        id=_get_id(site),
        source=SOURCE_NAME,
    )
Esempio n. 29
0
def minimal_location():
    return location.NormalizedLocation(
        id="source:id",
        source=location.Source(
            source="source",
            id="id",
            data={"id": "id"},
        ),
    )
Esempio n. 30
0
def _get_source(site: dict, timestamp: str) -> schema.Source:
    return schema.Source(
        data=site,
        fetched_at=timestamp,
        fetched_from_uri=
        "https://memorialhermann.org/services/conditions/coronavirus/vaccine-walk-in-clinics",
        id=_get_id(site),
        source="tx_memorialhermann",
    )