Spaces:
Sleeping
Sleeping
Create ingest/coverage.py
Browse files- ingest/coverage.py +4 -28
ingest/coverage.py
CHANGED
|
@@ -1,29 +1,5 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def build_coverage_heatmap(counts):
|
| 8 |
-
return counts
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
def build_agency_map(counts):
|
| 12 |
-
states = []
|
| 13 |
-
values = []
|
| 14 |
-
|
| 15 |
-
for agency, count in counts.items():
|
| 16 |
-
if agency in AGENCY_STATE_MAP:
|
| 17 |
-
states.append(AGENCY_STATE_MAP[agency])
|
| 18 |
-
values.append(count)
|
| 19 |
-
|
| 20 |
-
fig = go.Figure(
|
| 21 |
-
go.Choropleth(
|
| 22 |
-
locations=states,
|
| 23 |
-
locationmode="USA-states",
|
| 24 |
-
z=values,
|
| 25 |
-
colorscale="Blues",
|
| 26 |
-
)
|
| 27 |
-
)
|
| 28 |
-
fig.update_layout(title="Agency FOIA Coverage (US)")
|
| 29 |
-
return fig
|
|
|
|
| 1 |
+
from collections import Counter
|
| 2 |
|
| 3 |
+
def agency_coverage(results):
|
| 4 |
+
counts = Counter(r.get("agency", "Unknown") for r in results)
|
| 5 |
+
return dict(counts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|