GodsDevProject commited on
Commit
b3cf2ce
·
verified ·
1 Parent(s): 7d1ea55

Create ingest/coverage.py

Browse files
Files changed (1) hide show
  1. ingest/coverage.py +29 -9
ingest/coverage.py CHANGED
@@ -1,9 +1,29 @@
1
- def build_coverage_heatmap(per_agency_counts):
2
- # Simple numeric heatmap data
3
- return {
4
- agency: {
5
- "count": count,
6
- "intensity": min(count / 10.0, 1.0)
7
- }
8
- for agency, count in per_agency_counts.items()
9
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import plotly.graph_objects as go
2
+
3
+ AGENCY_STATE_MAP = {
4
+ "CIA FOIA Reading Room": "VA",
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