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

Commit

Permalink
Add derived_availability_and_inventory() debug info to /location/X pa…
Browse files Browse the repository at this point in the history
…ge, refs #650
  • Loading branch information
simonw committed Jun 16, 2021
1 parent c356992 commit 487bb74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vaccinate/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ def location(request, public_id):
"location.html",
{
"location": location,
"derived_availability_and_inventory": json.dumps(
location.derive_availability_and_inventory()._asdict(),
indent=4,
default=lambda v: v.isoformat() if hasattr(v, "isoformat") else repr(v),
),
"source_locations": location.matched_source_locations.order_by(
"-created_at"
).prefetch_related("concordances"),
Expand Down
6 changes: 6 additions & 0 deletions vaccinate/templates/location.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ <h1>{{ location }}</h1>
<h2><samp style="font-size: 1.25em">{{ location.public_id }}</samp> - {{ location.full_address }}</h2>
<p><a href="/location">Find another location</a></p>

<h2>Derived availability and inventory</h2>

<p>We have logic that derives vaccine inventory and availability based on a combination of recently filed reports and recently scraped source locations. The <code>location.derived_availability_and_inventory()</code> method for this location currently returns:</p>

<pre>{{ derived_availability_and_inventory }}</pre>

{% for title, content in api_previews %}
<h2>{{ title }}</h2>
<pre>{{ content }}</pre>
Expand Down

0 comments on commit 487bb74

Please sign in to comment.