| 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 |