Spaces:
Sleeping
Sleeping
Create ingest/trends.py
Browse files- ingest/trends.py +18 -0
ingest/trends.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import plotly.graph_objects as go
|
| 2 |
+
|
| 3 |
+
def build_exemption_trend_chart(results):
|
| 4 |
+
counts = {}
|
| 5 |
+
|
| 6 |
+
for r in results:
|
| 7 |
+
for e in r.get("exemptions", []):
|
| 8 |
+
counts[e] = counts.get(e, 0) + 1
|
| 9 |
+
|
| 10 |
+
fig = go.Figure(
|
| 11 |
+
go.Bar(x=list(counts.keys()), y=list(counts.values()))
|
| 12 |
+
)
|
| 13 |
+
fig.update_layout(
|
| 14 |
+
title="FOIA Exemption Usage Trends",
|
| 15 |
+
xaxis_title="Exemption",
|
| 16 |
+
yaxis_title="Count",
|
| 17 |
+
)
|
| 18 |
+
return fig
|