FOIA_Doc_Search / core /analysis.py
GodsDevProject's picture
Rename analysis.py to core/analysis.py
f1b3a17 verified
raw
history blame
301 Bytes
from typing import Dict, List
def build_timeline(docs: List[dict]) -> Dict[str, int]:
timeline: Dict[str, int] = {}
for d in docs:
year = d.get("date", "")[:4]
if not year.isdigit():
continue
timeline[year] = timeline.get(year, 0) + 1
return timeline