Block 70: Mini-Project: Data API with Flask or FastAPI
Build a complete small API that exposes a dataset with filtering and stats.
Concepts
- Multi-endpoint API design
- Input validation, error handling
- Serving a real dataset
Code Examples
See exercise below.
Exercise
Build a /population API (use rest countries or similar): GET all countries, GET /country/<name> (details), GET /stats (global averages), GET /filter?region=Europe. Document all endpoints. Bonus: add a /predict endpoint if you already have a trained model.
Homework
Reflection: Sketch on paper the architecture of a real-world data application using Flask/FastAPI + pandas + a database. Label each component.