Unified DHIS2 management toolkit for CPMIS Malawi - data cleanup and sync rescue
# CPMIS Toolkit
**Unified DHIS2 Management for CPMIS Malawi**
A collection of tools for managing the CPMIS DHIS2 instance in Malawi — covering data cleanup, ID standardisation, organisation unit transfers, and recovery of unsynced Android app data.
---
## Table of Contents
- Overview
- Quick Start
- Configuration
- Cleanup App
- Phase 1 — Organisation Unit Codes
- Phase 2 — TEI ID Standardisation
- OU Transfer App
- Background
- How It Works
- Typical Workflow
- Sync Rescue App
- Background
- How It Works
- Batch Processing
- Single File Processing
- Project Structure
- All Commands
- Technical Stack
- Author
- License
---
## Overview
The **Malawi Child Protection Management Information System (CPMIS)** runs on DHIS2 and manages data for approximately **53,000 households** and **78,000 children (OVCs)** across **709 organisation units**. Community Para Social Workers (CPWs) use the DHIS2 Android Capture app to collect data in the field.
This toolkit provides three apps to support CPMIS operations:
| App | What It Does | Location |
|-----|-------------|----------|
| **Cleanup** | Standardises org unit codes, names, and TEI IDs across the entire DHIS2 hierarchy | `src/cleanup/` |
| **OU Transfer** | Transfers TEIs between organisation units with automatic ID regeneration | `src/transfer/` |
| **Sync Rescue** | Recovers and imports unsynced data from DHIS2 Android Capture app databases | `src/sync/` |
All apps share a single `.env` for credentials, a single virtual environment, and a unified `justfile` command runner.
> **For a deeper understanding of each app**, see the detailed overviews:
> - Cleanup App Overview — code architecture, ID formats, update methods, safety features
> - OU Transfer App Overview — background, transfer workflow, relationship preservation, ID regeneration
> - Sync Rescue App Overview — background, data flow, processing pipeline, extracted entities
---
## Quick Start
### 1. Clone and setup
```bash
git clone
github …