Skip to content

martin-he543/altruist

Repository files navigation

Altruist β€” Impact Intelligence Platform

Data-driven social capital allocation. From emotional giving to quantifiable ROI.

Features β€’ Quick Start β€’ Architecture β€’ Schema β€’ Algorithms β€’ Deployment


Overview

Altruist is an impact intelligence platform that standardises charitable impact with the rigor of a credit rating agency. Donors don't just "give" β€” they invest based on quantifiable social return on investment (SROI).

The platform scores charities across six dimensions, integrates ONS deprivation data to weight impact by need, and converts human outcomes into financial yield statements.

Features

πŸ“Š Impact Dashboard

  • Real-time overview of tracked charities with key metrics
  • SROI bar charts and Impact/Β£ vs Transparency scatter plots
  • Top-rated charities table with sortable columns

πŸ” Semantic Discovery

  • Natural language search: "I want to fund reforestation in poverty-stricken areas of the UK Midlands"
  • Sector-based filtering (Health, Education, Poverty Relief, Environment, Community)
  • Example query suggestions for quick exploration
  • Production architecture: Vector search via Vertex AI embeddings or Pinecone

πŸ“ˆ Multi-Dimensional Rating Engine

Six-axis Unified Impact Score (0-100):

Dimension Weight Description
SDG Alignment 15% Mapping to UN Sustainable Development Goals
Impact per Β£ 25% Efficiency of charitable spend
Social Impact 20% Qualitative-to-quantitative social good
ONS Poverty Linkage 15% Weighted by Index of Multiple Deprivation
Transparency 10% Data upload frequency and reporting quality
SROI 15% Social Return on Investment ratio

πŸ’° Financial Insights

  • Social Value Bank with 10 outcome categories and fiscal values (sourced from MoJ, NHS, DWP)
  • SROI calculator: input investment amount, see social value created
  • Fundable Insights: human outcomes expressed as taxpayer savings
    • "Prevention of one person entering prison saves Β£45,000/year"

πŸ“ Impact Narrative Engine (NLG)

  • Converts raw metrics into human-readable stories
  • "Your Β£50 didn't just fund GreenHeart Midlands β€” it directly enabled 10.4 trees in Birmingham."
  • Configurable donation amounts with real-time narrative generation
  • Production: Uses Firebase GenKit / Vertex AI for LLM-powered narratives

πŸ“‹ Survey Engine

  • Dynamic Firestore-backed survey builder
  • 5 question types: text, number, scale, multiple choice, boolean
  • Survey responses automatically feed into the Rating Engine
  • Real-time response counts and status tracking

πŸ”„ Charity Comparison

  • Side-by-side comparison with sortable multi-column table
  • Interactive scatter charts (Impact/Β£ vs Transparency)
  • Radar charts for multi-dimensional score visualisation
  • Filter charities in/out of comparison

πŸ“– Technical Documentation

  • Built-in docs page covering Firestore schema, security rules, algorithms
  • Vector search architecture strategy
  • ONS API integration guide
  • Deployment instructions

Quick Start

Prerequisites

  • Node.js 18+ β€” Download
  • npm 9+ β€” Comes with Node.js
  • Git β€” Download

Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/altruist.git
cd altruist

# Install dependencies
npm install

# Start the development server
npm run dev

The app will be available at http://localhost:5173/altruist/

Environment Variables (Optional)

For Firebase integration, create a .env.local file:

VITE_FIREBASE_API_KEY=your-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id

The app runs with demo mock data by default β€” Firebase is not required for local development.

Build for Production

npm run build

Output is generated in the dist/ directory.

Architecture

altruist/
β”œβ”€β”€ .github/workflows/     # GitHub Actions CI/CD
β”‚   └── deploy.yml         # Auto-deploy to GitHub Pages
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ charts/        # Recharts visualisations
β”‚   β”‚   β”‚   β”œβ”€β”€ ImpactRadar.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ImpactScatterChart.tsx
β”‚   β”‚   β”‚   └── SROIChart.tsx
β”‚   β”‚   β”œβ”€β”€ dashboard/     # Dashboard-specific components
β”‚   β”‚   β”‚   └── ImpactNarrative.tsx
β”‚   β”‚   β”œβ”€β”€ layout/        # App shell & navigation
β”‚   β”‚   β”‚   β”œβ”€β”€ AppLayout.tsx
β”‚   β”‚   β”‚   └── Sidebar.tsx
β”‚   β”‚   └── shared/        # Reusable components
β”‚   β”‚       β”œβ”€β”€ ScoreRing.tsx
β”‚   β”‚       └── SDGBadge.tsx
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   └── mock-data.ts   # Realistic UK charity mock data
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ firebase.ts    # Firebase configuration
β”‚   β”‚   └── rating-engine.ts  # SROI & scoring algorithms
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ DashboardPage.tsx
β”‚   β”‚   β”œβ”€β”€ DiscoverPage.tsx
β”‚   β”‚   β”œβ”€β”€ ComparePage.tsx
β”‚   β”‚   β”œβ”€β”€ SurveysPage.tsx
β”‚   β”‚   β”œβ”€β”€ InsightsPage.tsx
β”‚   β”‚   └── DocsPage.tsx
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── index.ts       # TypeScript domain types
β”‚   β”œβ”€β”€ App.tsx            # Router configuration
β”‚   β”œβ”€β”€ index.css          # Liquid Glass design system
β”‚   └── main.tsx           # Entry point
β”œβ”€β”€ firestore.rules        # Firebase security rules
β”œβ”€β”€ FIREBASE_SETUP.md      # Firebase configuration guide
└── README.md              # This file

Tech Stack

Layer Technology
Framework React 18 + TypeScript
Build Tool Vite 8
Styling Tailwind CSS v4 + Liquid Glass design tokens
Charts Recharts
Animation Framer Motion
Icons Lucide React
Backend Firebase (Auth, Firestore, Cloud Functions)
Search Vector Search (Vertex AI / Pinecone)
AI/NLG Firebase GenKit
Deployment GitHub Pages

Firestore Schema

Collections

Collection Purpose Access
charities Core charity profiles with impact metrics Public read, owner write
ons_regional_data ONS Index of Multiple Deprivation data Public read, admin write
impact_valuations SROI calculations and outcome valuations Auth read, owner write
surveys Dynamic survey definitions Public read, owner write
surveys/{id}/responses Beneficiary survey responses Owner read, public create
un_sdg_mappings SDG alignment evidence Public read, admin write
users Donor profiles and investment history Self-access only

See firestore.rules for the complete security rules implementation.

Algorithms

SROI Calculation

SROI = Total Social Value Created / Cost of Intervention

The Social Value Bank maps outcomes to fiscal values:

Outcome Annual Value Source
Prison prevention Β£45,000 Ministry of Justice
Homelessness prevention Β£26,000 Crisis/DCLG
Youth gang diversion Β£38,000 Home Office
Employment transition Β£12,500 DWP
Mental health intervention Β£5,400 NHS
A&E prevention Β£2,800 NHS England

Unified Impact Score

Weighted composite of six dimensions:

Overall = SDG(15%) + Impact/Β£(25%) + Social(20%) + ONS(15%) + Transparency(10%) + SROI(15%)

ONS Poverty Linkage

Charities working in IMD Decile 1 (most deprived) areas receive the highest scores (~95/100). Charities in Decile 10 (least deprived) receive lowest scores (~15/100).

Deployment

GitHub Pages (Recommended)

  1. Push your code to GitHub
  2. Go to Settings β†’ Pages β†’ Source β†’ GitHub Actions
  3. The included workflow (.github/workflows/deploy.yml) will auto-deploy on push to main

Manual Deployment

npm run build
# Upload the contents of dist/ to any static hosting provider

Firebase Hosting (Alternative)

firebase init hosting
# Set public directory to: dist
# Configure as single-page app: Yes

npm run build
firebase deploy --only hosting

Firebase Setup

See FIREBASE_SETUP.md for detailed instructions on:

  • Creating a Firebase project
  • Enabling Authentication and Firestore
  • Deploying security rules
  • Setting up Cloud Functions for ONS data sync
  • Configuring Vector Search
  • Setting up GenKit for AI narratives

Design System

The app uses a Liquid Glass design language:

  • Glass morphism panels with backdrop blur and translucent borders
  • Ambient background with animated gradient orbs
  • Dark mode first with the Inter typeface
  • Score rings with colour-coded thresholds (green β‰₯80, indigo β‰₯60, amber β‰₯40, rose <40)
  • Micro-animations via Framer Motion for all transitions
  • Responsive layout with collapsible sidebar for mobile

Key Concepts

The Social Value Ledger

Instead of tracking donations alone, the database tracks Units of Change β€” measurable outcomes tied to fiscal value.

ONS API Integration

The platform fetches Index of Multiple Deprivation (IMD) data from the Office for National Statistics. This enables impact weighting: "Charity A is more impactful because they work in a region the ONS identifies as Decile 1 (most deprived)."

Natural Language Processing

The Text-to-Filter system (powered by vector embeddings in production) removes traditional category friction, allowing donors to search for hyper-specific niches: "Mental health for elderly veterans in Wales".

License

MIT


Built with ❀️ for data-driven philanthropy

About

MVP for 'Altruist': the winner of Inside Out: The Innovation Advantage Hackathon, organised with Deloitte and Bayes Business School.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages