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

Commit

Permalink
fidelity property for mapbox export, refs #547
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed May 11, 2021
1 parent 47a9e44 commit 80ceac9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vaccinate/api/export_mapbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,17 @@ def _mapbox_geojson(location, loaded_vaccinefinder_data=None):
elif report:
vaccines_offered = report.vaccines_offered

fidelity = 0
for property, vaccine_name in (
("vaccine_moderna", "Moderna"),
("vaccine_pfizer", "Pfizer"),
("vaccine_jj", "Johnson & Johnson"),
):
if vaccines_offered and vaccine_name in vaccines_offered:
properties[property] = True
fidelity = 1

properties["fidelity"] = fidelity

return {
"type": "Feature",
Expand Down
4 changes: 4 additions & 0 deletions vaccinate/api/test_export_mapbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_export_mapbox_location_with_no_report(client, ten_locations):
"vaccinefinder_location_id": None,
"vaccinespotter_location_id": None,
"hours": None,
"fidelity": 0,
},
"geometry": {"type": "Point", "coordinates": [40.0, 30.0]},
}
Expand Down Expand Up @@ -177,6 +178,9 @@ def test_export_mapbox_location_with_report(
"latest_contact": report.created_at.isoformat(),
"planned_closure": "2029-05-01",
"restriction_notes": "No notes",
"fidelity": 1
if any(v for v in expected_booleans if v.startswith("vaccine_"))
else 0,
}
for property in expected_booleans:
expected_properties[property] = True
Expand Down

0 comments on commit 80ceac9

Please sign in to comment.