How covid19india/data works
Purpose and Published Surface
This repository is a batch data-publishing pipeline for COVID-19 India statistics, not an application server. It transforms Google Sheet-derived/raw inputs into static CSV datasets and V4 JSON feeds served at data.covid19india.org. The active consumer surface is V4 (v4/min/data.min.json, v4/min/timeseries.min.json) plus aggregated CSV; legacy JSON endpoints are deprecated.
Pipeline Orchestration
main.sh is the top-level batch entry point, sequencing generators and validation. The implementation spans Node.js and Python, with dependencies declared in package.json, package-lock.json, and requirements.txt. There is no persistent database or API runtime represented in the tree; generated static files are the delivery boundary.
Paths: main.sh, package.json, requirements.txt
Raw-Data Acquisition and Normalization
The pipeline consumes latest Google Sheet data and historical raw sheets, then converts sheet-shaped data to JSON/CSV representations. Generic sheet conversion and raw-data assembly form the input boundary; raw datasets preserve granular records and sources but are explicitly not the preferred downstream interface.
Paths: src/sheet-to-json_generic.js, src/sheets-to-csv.js, src/build_raw_data.py
State and District Aggregation
Dedicated transforms derive state daily series and district-level outputs from normalized/raw inputs. These stages establish the main geographic aggregation boundary used by CSV consumers and downstream V4 assembly.
Paths: src/states_daily_to_csv.js, src/district_data_generator.js, src/sanity_check.js
V4 API Data Construction
The V4 parser produces the structured JSON model used by the frontend: current state/district statistics and historical state time series. This is the primary product path; minified V4 files are the recommended externally consumed JSON artifacts.
Paths: src/parser_v4.py, lib/constants.js, documentation/v4_data.md
Supplemental Derived Datasets
Separate generators handle locale metadata and activity/change logs. These are adjacent published artifacts rather than core case aggregation, and likely consume the same generated/normalized data domain.
Paths: src/generate_locale.js, src/generate_activity_log.js, src/generate_activity_log.py
Validation and Operational Notification
Sanity checking is an explicit pre-publication quality gate for generated data. Telegram notification support indicates batch-job operational reporting; its invocation is likely coordinated through the shell workflow or Node entry module.
Paths: src/sanity_check.js, lib/notify_tg.js, lib/index.js
Infrastructure and External Boundaries
External dependencies are Google Sheets as the near-real-time source (noted as 10–20 minutes delayed), public static hosting at data.covid19india.org, and Telegram for notifications. GitHub Actions provides CI for JavaScript via .github/workflows/javascript.yml; no deployment workflow is visible. Documentation defines the public CSV, raw-data, and V4 contracts.
Paths: .github/workflows/javascript.yml, documentation/csv/index.md, documentation/rawdata.md
Main entry points: build_raw_data.py Raw-data assembly · parser_v4.py V4 parser · main.sh Batch orchestrator · v4_data.md Data contracts
Components 21
Sources & normalization
- Google Sheets · Near-real-time and historical source data.
- Generic sheet conversion
src/sheet-to-json_generic.js - Sheet CSV conversion
src/sheets-to-csv.js - Raw-data assembly · Preserves granular source records.
src/build_raw_data.py
Aggregation & checks
- State daily aggregation
src/states_daily_to_csv.js - District aggregation
src/district_data_generator.js - Sanity check · Pre-publication generated-data validation.
src/sanity_check.js
V4 product build
- V4 parser · Builds current statistics and historical state series.
src/parser_v4.py - V4 constants
lib/constants.js - Locale generator
src/generate_locale.js - Activity log generators
src/generate_activity_log.js
Published artifacts
- Raw datasets · Published but not the preferred downstream interface.
- Aggregated CSV · Geographic datasets for CSV consumers.
- V4 minified feeds · Primary JSON consumer surface.
- V4 time series feed · Historical state time series.
- data.covid19india.org
Operations & contracts
- Batch orchestrator · Sequences generators and validation.
main.sh - Telegram notifications · Batch-job operational reporting.
- Telegram notifier
lib/notify_tg.js - JavaScript CI
.github/workflows/javascript.yml - Data contracts · Defines CSV, raw-data, and V4 public contracts.
documentation/v4_data.md
Connections 31
- Google Sheets → Generic sheet conversion: ingests
- Google Sheets → Sheet CSV conversion: exports
- Generic sheet conversion → Raw-data assembly: normalizes
- Sheet CSV conversion → Raw-data assembly: supplies
- Raw-data assembly → Raw datasets: publishes
- Raw-data assembly → State daily aggregation: feeds
- Raw-data assembly → District aggregation: feeds
- State daily aggregation → Aggregated CSV: writes
- District aggregation → Aggregated CSV: writes
- State daily aggregation → V4 parser: supplies series
- District aggregation → V4 parser: supplies districts
- V4 constants → V4 parser: defines model
- V4 parser → V4 minified feeds: writes
- V4 parser → V4 time series feed: writes
- Sanity check → V4 minified feeds: approves
- Sanity check → Aggregated CSV: approves
- Locale generator → V4 minified feeds: supplements
- Activity log generators → V4 minified feeds: supplements
- V4 minified feeds → data.covid19india.org: served by
- V4 time series feed → data.covid19india.org: served by
- Aggregated CSV → data.covid19india.org: served by
- Raw datasets → data.covid19india.org: served by
- Batch orchestrator → Raw-data assembly: runs
- Batch orchestrator → Sanity check: runs
- Batch orchestrator → V4 parser: runs
- Batch orchestrator → Telegram notifier: reports through
- Telegram notifier → Telegram notifications: sends
- JavaScript CI → Batch orchestrator: checks JavaScript pipeline
- Data contracts → V4 minified feeds: documents
- Data contracts → Aggregated CSV: documents
- Data contracts → Raw datasets: documents