A comprehensive FastAPI application for tracking barangay program effectiveness with before/after metrics. Answer the question: "Did this barangay program actually work?"
Part of Barangay DEP - Building a Better Philippines, One Barangay at a Time.
- Program Management: Create and manage barangay programs (feeding, training, cleanup, etc.)
- Target Group Tracking: Track which groups benefit from each program
- Baseline Metrics: Record "before" measurements for each program
- Outcome Metrics: Record "after" measurements to measure impact
- Visual Comparison: See clear before/after comparisons with visual charts and percentage changes
- Impact Analysis: Calculate and display percentage changes and program effectiveness
Built using FastAPI MVC architecture with:
- Models: SQLModel database models (
app/models/) - Controllers: Business logic layer (
app/controllers/) - Routes: API and web routes (
app/routes/) - Templates: Jinja2 templates with TailwindCSS (
app/templates/) - Database: SQLite with async SQLAlchemy
- Python 3.9+
- pip
- Clone the repository:
git clone https://github.com/dataengineeringpilipinas/brgy-program-impact-tracker.git
cd brgy-program-impact-tracker- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the application:
uvicorn main:app --reload- Open your browser:
http://localhost:8000
- Navigate to "Create Program"
- Fill in:
- Program name (e.g., "Feeding Program", "Skills Training")
- Description (optional)
- Target group (e.g., "Children", "Seniors", "Community")
- Start date (required)
- End date (optional)
- Status (active, completed, cancelled)
- View a program's detail page
- Click "Add Metric"
- Fill in:
- Metric name (e.g., "Attendance", "Weight", "Satisfaction Score")
- Metric unit (e.g., "count", "kg", "percentage")
- Baseline value (before measurement)
- Outcome value (after measurement - can be added later)
- Measurement date (optional)
The program detail page shows:
- Before/After comparison cards
- Visual bar charts comparing metrics
- Percentage change calculations
- Impact indicators (positive/negative/neutral)
The application uses SQLite with async SQLAlchemy. The database file (program_impact.db) is created automatically on first run.
Programs Table:
id: Primary keyname: Program namedescription: Program descriptiontarget_group: Target groupstart_date: Program start dateend_date: Program end datestatus: Program statuscreated_at: Creation timestampupdated_at: Last update timestamp
Program Metrics Table:
id: Primary keyprogram_id: Foreign key to programsmetric_name: Name of the metricmetric_unit: Unit of measurementbaseline_value: Before measurementoutcome_value: After measurementmeasurement_date: Date of outcome measurementcreated_at: Creation timestampupdated_at: Last update timestamp
GET /api/v1/programs- List all programsPOST /api/v1/programs- Create a new programGET /api/v1/programs/{program_id}- Get program with metricsPUT /api/v1/programs/{program_id}- Update programDELETE /api/v1/programs/{program_id}- Delete program
POST /api/v1/programs/{program_id}/metrics- Create metricGET /api/v1/programs/{program_id}/metrics- List program metricsGET /api/v1/metrics/{metric_id}- Get specific metricPUT /api/v1/metrics/{metric_id}- Update metricDELETE /api/v1/metrics/{metric_id}- Delete metric
GET /- Home pageGET /programs- Programs listingGET /programs/create- Create program formGET /programs/{program_id}- Program detail pageGET /programs/{program_id}/create-metric- Create metric form
Built with the Vibecamp Design System:
- Colors: Pure black and white aesthetic
- Typography: Kalam (handwritten) for headings, Inter for body text
- Style: Clean, minimalist design with high contrast
- Mobile-First: Responsive design optimized for all screen sizes
- Install Fly CLI:
curl -L https://fly.io/install.sh | sh- Login to Fly:
fly auth login- Create a Fly app:
fly launch- Create a volume for persistent data:
fly volumes create program_impact_data --size 10 --region lax- Update
fly.tomlto mount the volume:
[[mounts]]
source = "program_impact_data"
destination = "/data"- Deploy:
fly deployImportant: The database path is automatically configured to use /data/ in production (Fly.io) and ./ in development.
brgy-program-impact-tracker/
├── app/
│ ├── __init__.py
│ ├── models/ # Database models
│ │ └── program.py
│ ├── controllers/ # Business logic
│ │ └── program_controller.py
│ ├── routes/ # API routes
│ │ └── programs.py
│ ├── templates/ # Jinja2 templates
│ │ ├── base.html
│ │ ├── index.html
│ │ ├── programs.html
│ │ ├── program_detail.html
│ │ ├── create_program.html
│ │ └── create_metric.html
│ ├── static/ # Static files
│ ├── utils/ # Utility functions
│ └── database.py # Database configuration
├── tests/ # Test files
├── migrations/ # Alembic migrations
├── main.py # FastAPI application entry point
├── requirements.txt # Dependencies
└── README.md # This file
pytestFollow PEP 8 and use type hints for all functions.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is part of Barangay DEP and follows the same license terms.
- Built for Barangay DEP
- Part of The Puso Project
- Design system by Vibecamp
For questions or suggestions, please open an issue on GitHub.
A Vibecamp Creation