|
1 | 1 | # RootStack |
2 | 2 |
|
3 | | -**Foundational data schemas for the OpenStacks ecosystem.** |
| 3 | +**Foundational data schemas, seed data, and queries for the OpenStacks ecosystem.** |
4 | 4 |
|
5 | 5 | [](https://openstacks.dev) |
6 | 6 | [](LICENSE) |
7 | | -[]() |
8 | 7 |
|
9 | | -> The database layer for OpenStacks — schemas, seed data, and queries. |
| 8 | +> The database layer for OpenStacks — structured development data for India and South Asia. |
10 | 9 |
|
11 | 10 | --- |
12 | 11 |
|
13 | | -## Status |
| 12 | +## What This Is |
14 | 13 |
|
15 | | -**This repository is in early development.** The architecture and goals are documented below, but the actual SQL schemas, seed data, and queries have not yet been implemented. Contributions are welcome to help build this out. |
| 14 | +RootStack provides a **SQLite database** with schemas, seed data, and ready-to-use queries covering three domains: |
16 | 15 |
|
17 | | -## Vision |
| 16 | +1. **Development Indicators** — Health, education, gender, and climate data at state and district level (NFHS-5, SRS, UDISE+, CPCB) |
| 17 | +2. **Government Schemes** — Central and state schemes with budget allocation, spending, and coverage data |
| 18 | +3. **Tools Catalog** — Registry of all scripts, notebooks, and templates across the OpenStacks ecosystem |
18 | 19 |
|
19 | | -RootStack will provide the foundational data layer for the OpenStacks ecosystem: |
| 20 | +## Quick Start |
20 | 21 |
|
21 | | -- **Structured schemas** (PostgreSQL/SQLite) for development sector data |
22 | | -- **Seed datasets** for testing and demonstration |
23 | | -- **Example queries** for common analysis patterns |
24 | | -- **Migration scripts** for schema evolution |
| 22 | +```bash |
| 23 | +git clone https://github.com/Varnasr/RootStack.git |
| 24 | +cd RootStack |
| 25 | +bash scripts/setup.sh |
| 26 | +``` |
25 | 27 |
|
26 | | -### Planned Architecture |
| 28 | +This creates `rootstack.db` with all tables seeded. Then run queries: |
27 | 29 |
|
| 30 | +```bash |
| 31 | +# Health indicators across states |
| 32 | +sqlite3 -header -column rootstack.db < queries/01_health_dashboard.sql |
| 33 | + |
| 34 | +# Government scheme budgets and spending |
| 35 | +sqlite3 -header -column rootstack.db < queries/02_policy_analysis.sql |
| 36 | + |
| 37 | +# Cross-cutting analysis (climate-health, tribal districts, tools search) |
| 38 | +sqlite3 -header -column rootstack.db < queries/03_cross_cutting.sql |
28 | 39 | ``` |
29 | | -RootStack (Database) → BridgeStack (API) → ViewStack (Frontend) |
30 | | -``` |
31 | 40 |
|
32 | | -RootStack feeds data to [BridgeStack](https://github.com/Varnasr/BridgeStack) via SQL, which exposes it through a REST API to [ViewStack](https://github.com/Varnasr/ViewStack). |
| 41 | +### Prerequisites |
| 42 | + |
| 43 | +- **SQLite 3** (pre-installed on most systems; `brew install sqlite3` on Mac, `apt install sqlite3` on Linux) |
33 | 44 |
|
34 | | -### Planned Structure |
| 45 | +## What's Inside |
35 | 46 |
|
36 | 47 | ``` |
37 | 48 | RootStack/ |
38 | | -├── schemas/ |
39 | | -│ ├── tables.sql # Core table definitions |
40 | | -│ └── migrations/ # Schema version changes |
41 | | -├── seed_data/ |
42 | | -│ └── seed_initial.sql # Test/demo data |
43 | | -├── queries/ |
44 | | -│ └── example_queries.sql # Common query patterns |
| 49 | +├── schemas/ # Table definitions (run in order) |
| 50 | +│ ├── 001_geography.sql # States and districts of India |
| 51 | +│ ├── 002_sectors.sql # Development sector taxonomy |
| 52 | +│ ├── 003_indicators.sql # Indicator definitions and values |
| 53 | +│ ├── 004_policies.sql # Government schemes and budgets |
| 54 | +│ └── 005_tools_catalog.sql # OpenStacks tools registry |
| 55 | +│ |
| 56 | +├── seed_data/ # Initial data (run in order) |
| 57 | +│ ├── 001_sectors.sql # 19 sectors and sub-sectors |
| 58 | +│ ├── 002_states.sql # 30 states and UTs |
| 59 | +│ ├── 003_districts_sample.sql# 26 sample districts across tiers |
| 60 | +│ ├── 004_indicators.sql # 20 indicators with 51 data points |
| 61 | +│ ├── 005_schemes.sql # 16 major schemes with budgets |
| 62 | +│ └── 006_tools_catalog.sql # 32 tools across 4 stacks |
| 63 | +│ |
| 64 | +├── queries/ # Ready-to-use analysis queries |
| 65 | +│ ├── 01_health_dashboard.sql # State scorecards, district rankings, gender gaps |
| 66 | +│ ├── 02_policy_analysis.sql # Budget overview, utilization, sector spending |
| 67 | +│ └── 03_cross_cutting.sql # Multi-sector profiles, climate-health nexus |
| 68 | +│ |
| 69 | +├── scripts/ |
| 70 | +│ └── setup.sh # One-command database creation |
| 71 | +│ |
45 | 72 | └── docs/ |
46 | | - └── data_dictionary.md # Field descriptions and relationships |
| 73 | + └── data_dictionary.md # Table descriptions, field conventions, sources |
47 | 74 | ``` |
48 | 75 |
|
49 | | -## How to Contribute |
| 76 | +## Database Schema |
| 77 | + |
| 78 | +``` |
| 79 | +states ──< districts |
| 80 | +sectors ──< indicators ──< indicator_values >── districts |
| 81 | +sectors ──< schemes ──< scheme_budgets |
| 82 | + ──< scheme_coverage >── states/districts |
| 83 | +stacks ──< tools >── sectors |
| 84 | +``` |
| 85 | + |
| 86 | +### Current Data |
| 87 | + |
| 88 | +| Table | Records | Source | |
| 89 | +|-------|---------|--------| |
| 90 | +| States | 30 | Census 2011 | |
| 91 | +| Districts | 26 (sample) | Census 2011 | |
| 92 | +| Sectors | 19 | OpenStacks taxonomy | |
| 93 | +| Indicators | 20 definitions | NFHS-5, SRS, PLFS, CPCB | |
| 94 | +| Indicator Values | 51 data points | Various (see data dictionary) | |
| 95 | +| Schemes | 16 major schemes | Union Budget, Ministry reports | |
| 96 | +| Budgets | 13 entries | Union Budget 2023-24 | |
| 97 | +| Stacks | 4 registered | OpenStacks ecosystem | |
| 98 | +| Tools | 32 cataloged | InsightStack, FieldStack, EquityStack | |
50 | 99 |
|
51 | | -This is a great repo to contribute to if you have experience with: |
52 | | -- PostgreSQL or SQLite schema design |
53 | | -- Development sector data structures (surveys, indicators, program data) |
54 | | -- Database migration workflows |
| 100 | +## Example Output |
55 | 101 |
|
56 | | -See the [OpenStacks hub](https://github.com/Varnasr/OpenStacks-for-Change) for ecosystem-wide contribution guidelines. |
| 102 | +**State health scorecard:** |
| 103 | +``` |
| 104 | +State IMR Stunting Anaemia |
| 105 | +Uttar Pradesh 40.0 39.7% |
| 106 | +Bihar 38.0 42.9% 63.5% |
| 107 | +Madhya Pradesh 36.0 35.7% |
| 108 | +Kerala 6.0 23.4% 36.3% |
| 109 | +``` |
| 110 | + |
| 111 | +**Scheme budget utilization:** |
| 112 | +``` |
| 113 | +Scheme Allocated (Cr) Spent (Cr) Utilization |
| 114 | +Jal Jeevan Mission 70,000 62,000 88.6% |
| 115 | +MGNREGA 60,000 82,000 136.7% |
| 116 | +National Health Mission 36,785 33,200 90.3% |
| 117 | +NCAP (Clean Air) 460 350 76.1% |
| 118 | +``` |
57 | 119 |
|
58 | 120 | ## How It Connects |
59 | 121 |
|
| 122 | +RootStack is the data foundation of the [OpenStacks](https://openstacks.dev) ecosystem: |
| 123 | + |
60 | 124 | | Stack | Role | Link | |
61 | 125 | |-------|------|------| |
62 | 126 | | **RootStack** (this repo) | Database schemas & seed data | You are here | |
63 | | -| [BridgeStack](https://github.com/Varnasr/BridgeStack) | API backend (FastAPI) | Consumes RootStack data | |
64 | | -| [ViewStack](https://github.com/Varnasr/ViewStack) | Frontend UI | Displays BridgeStack API data | |
| 127 | +| [BridgeStack](https://github.com/Varnasr/BridgeStack) | API backend (FastAPI) | Will consume RootStack data | |
| 128 | +| [ViewStack](https://github.com/Varnasr/ViewStack) | Frontend UI | Will display via BridgeStack | |
| 129 | +| [InsightStack](https://github.com/Varnasr/InsightStack) | MEL tools (Stata/Python/R) | Tools cataloged here | |
| 130 | +| [FieldStack](https://github.com/Varnasr/FieldStack) | R notebooks for fieldwork | Tools cataloged here | |
| 131 | +| [EquityStack](https://github.com/Varnasr/EquityStack) | Python data workflows | Tools cataloged here | |
| 132 | + |
| 133 | +## Contributing |
| 134 | + |
| 135 | +Contributions welcome — especially: |
| 136 | + |
| 137 | +- **More district data** — Expand from 26 to all 766 districts |
| 138 | +- **More indicators** — Add UDISE+ education data, PLFS employment data |
| 139 | +- **More schemes** — State-level schemes, historical budget data |
| 140 | +- **PostgreSQL port** — Adapt schemas for PostgreSQL deployment |
| 141 | +- **Migration scripts** — Schema versioning for production use |
| 142 | + |
| 143 | +See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. |
65 | 144 |
|
66 | 145 | ## License |
67 | 146 |
|
|
0 commit comments