Skip to content

Latest commit

Β 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🟣 PÚRPURA Climate OS

Climate risk assessment and IFRS S2 compliance platform for Brazilian organizations, utilities and municipalities

Powered by OS-Climate open-source tools + custom AI extraction pipeline.


βœ… MVP Status: Ready for Testing!

Week 5-6 Complete β€” Physical Risk Dashboard is live!

🎯 What's Working:

  • βœ… Backend API: Physical risk assessment for 10 Brazilian municipalities
  • βœ… Frontend Dashboard: React + TypeScript with advanced visualizations
  • βœ… Data Integration: INPE + Cemaden + INMET + Geographic Heuristics
  • βœ… 5 Hazard Types: Flood, Drought, Heat Stress, Landslide, Coastal Inundation
  • βœ… 3 Climate Scenarios: RCP 2.6, 4.5, 8.5
  • βœ… Temporal Projections: Current β†’ 2030 β†’ 2050

πŸ“Š Dashboard Features:

  • StatsOverview (6 key risk metrics)
  • RiskChart (temporal evolution line chart)
  • ScenarioComparison (RCP scenario bar chart)
  • RiskCard grid (individual hazard cards)

πŸš€ Quick Demo: See Quick Start below to run locally in 5 minutes!


🎯 Mission

Enable Brazilian organizations to:

  • Assess physical climate risks (floods, droughts, heat stress)
  • Extract climate data from sustainability reports (AI-powered)
  • Comply with Lei 14.904/2024, IFRS S2, and TSB taxonomy
  • Report actionable insights for climate adaptation

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Frontend (React + TypeScript)               β”‚
β”‚     πŸ“Š Municipal Dashboard βœ… β”‚ πŸ“„ Reports (Planned)         β”‚
β”‚   β€’ Risk visualizations β€’ Scenario comparison β€’ Charts       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ REST API (FastAPI)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Backend (FastAPI + Python)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚ Extraction  β”‚  β”‚ Risk Engine  β”‚  β”‚  Compliance  β”‚       β”‚
β”‚  β”‚ (Hybrid) βœ… β”‚  β”‚ (physrisk) βœ…β”‚  β”‚  (Planned)   β”‚       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚  INPE β€’ Cemaden β€’ INMET β€’ IBGE                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚             Data Layer (Trino + Iceberg + MinIO)             β”‚
β”‚  πŸ“¦ Documents βœ… β”‚ πŸ“Š Extractions βœ… β”‚ πŸ—ΊοΈ Geospatial βœ…     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

Backend:

  • FastAPI (async API framework)
  • OS-Climate tools:
    • osc-transformer-based-extractor (BERT-based KPI extraction)
    • physrisk-lib (physical climate risk modeling)
  • OpenAI GPT (hybrid extraction)
  • ChromaDB (RAG vector store)
  • H3 geospatial indexing

Data Platform:

  • Trino (distributed SQL)
  • Apache Iceberg (table format)
  • MinIO (S3-compatible storage)
  • PostgreSQL (metadata)

Frontend:

  • React 18 + TypeScript
  • Vite (build tool with HMR)
  • Axios (HTTP client)
  • Recharts (data visualizations)
  • Tailwind CSS (utility-first styling)
  • Lucide React (icons)

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Docker + Docker Compose
  • 8GB RAM minimum

1. Clone & Setup

git clone https://github.com/brunoccteixeira/PURPURA.git
cd PURPURA

# Create Python environment
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows

# Install dependencies
pip install -r requirements.txt

2. Configure Environment

cp .env.example .env
# Edit .env with your settings:
# - OPENAI_API_KEY (for LLM extraction)
# - Database credentials
# - Trino connection

3. Start Infrastructure

# Start MinIO, Hive, Trino
docker-compose up -d

# Wait for services to be healthy (~30 seconds)
docker-compose ps

# Create Iceberg tables
python scripts/create_iceberg_tables.py

4. Start API Server

cd backend
uvicorn api.main:app --reload --port 8000

# API docs available at http://localhost:8000/docs

5. Start Frontend

cd frontend
npm install
npm run dev

# Dashboard at http://localhost:3000
# Features:
# - 10 Brazilian municipalities (SΓ£o Paulo, Rio, Fortaleza, etc.)
# - 5 hazard types (flood, drought, heat stress, landslide, coastal inundation)
# - 3 RCP scenarios (2.6, 4.5, 8.5)
# - Temporal projections (Current β†’ 2030 β†’ 2050)
# - Advanced visualizations (charts, stats, scenario comparison)

πŸ“– Documentation


πŸ§ͺ Testing

# Run all tests
pytest

# With coverage
pytest --cov=backend --cov-report=html

# Specific test suite
pytest backend/tests/test_extraction.py

πŸ“Š Data Pipeline

Ingest PDF β†’ Extract β†’ Store

# 1. Ingest PDF to chunks
python scripts/ingest_pdf.py data/sample.pdf \
  --out data/chunks.jsonl \
  --doc-id sample_001

# 2. Extract KPIs (hybrid: transformer + LLM)
python scripts/extract_from_chunks.py data/chunks.jsonl \
  --out data/extracted.jsonl \
  --method hybrid

# 3. Publish to Trino
python scripts/publish_jsonl_to_trino.py data/chunks.jsonl
python scripts/publish_jsonl_to_trino.py data/extracted.jsonl

Query with Trino

-- View extracted KPIs
SELECT * FROM lake.ifrs.extract_results LIMIT 10;

-- Search by municipality
SELECT * FROM lake.ifrs.municipal_risks
WHERE ibge_code = '3550308';  -- SΓ£o Paulo

🌍 OS-Climate Integration

PÚRPURA leverages these open-source components:

Component Purpose Status
osc-transformer-presteps PDF β†’ JSON conversion βœ… Integrated
osc-transformer-based-extractor BERT KPI extraction βœ… Integrated
physrisk-lib Climate risk calculations βœ… Integrated
physrisk-ui Dashboard patterns βœ… Integrated
H3 geospatial indexing Municipal risk mapping βœ… Integrated

Brazilian Data Sources

Source Purpose Status
INPE (PCBr API) Climate projections (temperature, precipitation) βœ… Integrated
Cemaden Historical hazard frequency (floods, landslides) βœ… Mock data ready
INMET (BDMEP) Climate normals (1961-2023), station catalog βœ… Mock data ready
IBGE Municipality codes, population, coordinates βœ… Integrated

License Compliance: All OS-Climate code is Apache 2.0 licensed. PÚRPURA maintains attribution and contributes improvements upstream.


🎨 Branding

  • Name: PÚRPURA (purple in Portuguese, symbolizing innovation + sustainability)
  • Target: Brazilian mid-market (municipalities 50-500k, regional utilities, SMEs)
  • Language: 100% Portuguese (pt-BR)
  • Differentiator: Partnership-first approach (Colab, Cemaden, TNC) + tropicalized models

πŸ›£οΈ Roadmap

Phase 1: Municipal MVP (Weeks 1-12) β€” Current

  • Data lakehouse infrastructure
  • LLM extraction pipeline (OpenAI)
  • FastAPI backend scaffold
  • Transformer-based extraction integration
  • Physical risk engine (physrisk + Brazilian data sources)
  • Municipal dashboard UI (React + TypeScript)
  • 2 pilot deployments

Phase 2: Enterprise TSB (Months 4-6)

  • TSB taxonomy classifier
  • IFRS S2 reporting module
  • Enterprise dashboard
  • 10-15 customer deployments

Phase 3: Scale (Months 7-12)

  • Agro module (AQUASENSE)
  • Smart city monitoring (MONITOR)
  • PIM-PAM tools (RMPT, CCS, PIA)
  • 100+ municipalities, 20+ enterprises

πŸ“ˆ Success Metrics (Week 12 Target)

  • βœ… 2 pilot customers deployed
  • βœ… 10+ documents processed end-to-end
  • βœ… <5min extraction time per document
  • βœ… >85% pilot user satisfaction
  • βœ… 1 Colab partnership MoU signed

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md.

Key areas:

  • Brazilian climate data sources integration (Cemaden, INPE, ANA)
  • IFRS S2 / TSB schema validation
  • Portuguese NLP improvements
  • Municipal dashboard UX

πŸ“„ License

PÚRPURA Climate OS is licensed under the Apache License 2.0.

This project incorporates components from OS-Climate, also Apache 2.0 licensed.


πŸ™ Acknowledgments

  • OS-Climate β€” Open-source climate tools foundation
  • Cemaden β€” Brazilian climate monitoring data
  • Linux Foundation / FINOS β€” Governance and community support

πŸ“ž Contact


Made with 🟣 in Brazil

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages