Skip to content

Repository files navigation

ML-Based Multi-Source Health Record Conflict Detection and Resolution System

Karnataka Rural Community Health Worker (CHW) Ecosystem

Python License Status


Overview

This project addresses a critical challenge in Karnataka's rural healthcare delivery: conflicting health records generated by multiple Community Health Workers (ASHAs, ANMs, AWWs) and facility-level systems (PHCs, CHCs, Sub-Centers) recording data about the same patient across disconnected platforms.

Using NFHS-5 Karnataka distributions as the statistical ground truth, we synthesize realistic patient records, inject domain-specific conflicts, and train ML models to detect and resolve them automatically.


Problem Statement

In Karnataka's rural CHW ecosystem, a single patient may be recorded by:

  • ASHA worker via mHealth app (e.g., ANMOL/RCH portal)
  • ANM at sub-center during home visit
  • AWW at Anganwadi for nutrition tracking
  • PHC doctor during outpatient visit
  • District hospital HMIS entry

This creates conflicts in: BMI vs weight/height, immunization dates, pregnancy status, hemoglobin levels, blood pressure readings, and demographic fields — causing care gaps, duplicate interventions, and incorrect risk stratification.


Dataset

Synthetic dataset generated using NFHS-5 Karnataka distributions:

  • 50,000 patient records (women 15–49, children 0–5)
  • 6 source system types simulated
  • Conflict injection rate: ~23% of records (matching real-world CHW discordance estimates)
  • Conflict types: numeric outliers, categorical mismatch, temporal inconsistency, demographic drift

See data/nfhs5_reference/ for distribution parameters and scripts/generate_dataset.py to regenerate.


Project Structure

health-conflict-detection/
├── data/
│   ├── raw/                    # Unprocessed source feeds
│   ├── processed/              # Cleaned, merged records
│   ├── synthetic/              # NFHS-5 generated dataset
│   └── nfhs5_reference/        # Distribution params from NFHS-5 Karnataka
├── src/
│   ├── ingestion/              # Multi-source data loaders
│   ├── preprocessing/          # Normalization, deduplication, entity resolution
│   ├── conflict_detection/     # ML conflict detection models
│   ├── resolution/             # Conflict resolution strategies
│   ├── evaluation/             # Metrics, benchmarking
│   └── utils/                  # Shared helpers
├── models/
│   ├── trained/                # Serialized model artifacts
│   ├── checkpoints/            # Training checkpoints
│   └── configs/                # Model hyperparameter configs
├── notebooks/                  # EDA and experiment notebooks
├── api/                        # FastAPI service layer
├── dashboard/                  # Streamlit monitoring dashboard
├── tests/                      # Unit and integration tests
├── docs/                       # Architecture and API documentation
├── scripts/                    # CLI scripts (generate, train, evaluate)
└── configs/                    # YAML configs for pipeline stages

Quickstart

# 1. Clone repo
git clone https://github.com/YOUR_USERNAME/health-conflict-detection.git
cd health-conflict-detection

# 2. Install dependencies
pip install -r requirements.txt

# 3. Generate synthetic dataset
python scripts/generate_dataset.py --n_patients 50000 --output data/synthetic/

# 4. Run preprocessing pipeline
python scripts/run_pipeline.py --config configs/pipeline.yaml

# 5. Train conflict detection model
python scripts/train_model.py --config configs/model_config.yaml

# 6. Launch API
uvicorn api.main:app --reload

# 7. Launch dashboard
streamlit run dashboard/app.py

Conflict Types Detected

Conflict Type Example Detection Method
Numeric outlier BMI=42 from ASHA vs BMI=18 from ANM IQR + source trust scoring
Categorical mismatch Immunization: "complete" vs "partial" Majority vote + recency weighting
Temporal inconsistency ANC visit date before registration Constraint-based rules
Demographic drift Age 24 in one record, 31 in another Entity resolution + fuzzy matching
Physiological impossibility Hemoglobin 3.2 g/dL without hospitalization flag Medical knowledge constraints
Cross-field contradiction Pregnancy=No but LMP recorded this month Logical constraint checker

Model Architecture

  • Stage 1 – Entity Resolution: MinHash LSH for patient deduplication across sources
  • Stage 2 – Conflict Detection: Gradient Boosted Trees (XGBoost) + Rule-based hybrid
  • Stage 3 – Resolution: Confidence-weighted ensemble with source reliability priors
  • Stage 4 – Audit Trail: Every resolution logged with rationale for CHW review

NFHS-5 Karnataka Reference Values

Indicator NFHS-5 Karnataka Value
Anaemia prevalence (women 15–49) 47.8%
Stunting (children < 5) 35.4%
Full immunization coverage 65.2%
ANC 4+ visits 72.8%
Institutional delivery 94.7%
Hypertension prevalence (women) 10.5%

Tech Stack

  • ML: scikit-learn, XGBoost, LightGBM, FAISS (vector similarity)
  • Data: pandas, numpy, faker, scipy
  • API: FastAPI, Pydantic
  • Dashboard: Streamlit, Plotly
  • Testing: pytest
  • Config: Hydra / YAML

Contributors

  • [Tanvi Pushparaj]
  • [Harshithaa R]
  • [Gajula Rushika]
  • [Sonika Sugarkar]

License

MIT License. See LICENSE for details.

Acknowledgements

Data distributions sourced from National Family Health Survey 5 (NFHS-5), 2019–21, Karnataka State Fact Sheet, Ministry of Health & Family Welfare, Government of India.

About

ML-Based Health Record Conflict Detection for Karnataka CHW Ecosystem

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages