Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Barangay Program Impact Tracker

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.

🎯 Features

  • 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

🏗️ Architecture

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

🚀 Quick Start

Prerequisites

  • Python 3.9+
  • pip

Installation

  1. Clone the repository:
git clone https://github.com/dataengineeringpilipinas/brgy-program-impact-tracker.git
cd brgy-program-impact-tracker
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
uvicorn main:app --reload
  1. Open your browser:
http://localhost:8000

📊 Usage

Creating a Program

  1. Navigate to "Create Program"
  2. 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)

Adding Metrics

  1. View a program's detail page
  2. Click "Add Metric"
  3. 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)

Viewing Impact

The program detail page shows:

  • Before/After comparison cards
  • Visual bar charts comparing metrics
  • Percentage change calculations
  • Impact indicators (positive/negative/neutral)

🗄️ Database

The application uses SQLite with async SQLAlchemy. The database file (program_impact.db) is created automatically on first run.

Database Schema

Programs Table:

  • id: Primary key
  • name: Program name
  • description: Program description
  • target_group: Target group
  • start_date: Program start date
  • end_date: Program end date
  • status: Program status
  • created_at: Creation timestamp
  • updated_at: Last update timestamp

Program Metrics Table:

  • id: Primary key
  • program_id: Foreign key to programs
  • metric_name: Name of the metric
  • metric_unit: Unit of measurement
  • baseline_value: Before measurement
  • outcome_value: After measurement
  • measurement_date: Date of outcome measurement
  • created_at: Creation timestamp
  • updated_at: Last update timestamp

🔌 API Endpoints

Programs

  • GET /api/v1/programs - List all programs
  • POST /api/v1/programs - Create a new program
  • GET /api/v1/programs/{program_id} - Get program with metrics
  • PUT /api/v1/programs/{program_id} - Update program
  • DELETE /api/v1/programs/{program_id} - Delete program

Metrics

  • POST /api/v1/programs/{program_id}/metrics - Create metric
  • GET /api/v1/programs/{program_id}/metrics - List program metrics
  • GET /api/v1/metrics/{metric_id} - Get specific metric
  • PUT /api/v1/metrics/{metric_id} - Update metric
  • DELETE /api/v1/metrics/{metric_id} - Delete metric

Web Pages

  • GET / - Home page
  • GET /programs - Programs listing
  • GET /programs/create - Create program form
  • GET /programs/{program_id} - Program detail page
  • GET /programs/{program_id}/create-metric - Create metric form

🎨 Design System

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

🚀 Deployment

Fly.io Deployment

  1. Install Fly CLI:
curl -L https://fly.io/install.sh | sh
  1. Login to Fly:
fly auth login
  1. Create a Fly app:
fly launch
  1. Create a volume for persistent data:
fly volumes create program_impact_data --size 10 --region lax
  1. Update fly.toml to mount the volume:
[[mounts]]
source = "program_impact_data"
destination = "/data"
  1. Deploy:
fly deploy

Important: The database path is automatically configured to use /data/ in production (Fly.io) and ./ in development.

📝 Development

Project Structure

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

Running Tests

pytest

Code Style

Follow PEP 8 and use type hints for all functions.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is part of Barangay DEP and follows the same license terms.

🙏 Acknowledgments

📧 Contact

For questions or suggestions, please open an issue on GitHub.


A Vibecamp Creation

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages