# mal-cs
## Overview
The mal-cs DHIS2 web app is the read-only front-door for Kenya's Malaria
Case-Based Surveillance (CBS) package. It surfaces MAL-CS case tracking,
MAL-FOCI foci investigation, and the consolidated dashboard at
`/api/apps/mal-cs/` on a DHIS2 instance. The app is deployed as a
standard DHIS2 application and reads metadata produced by the
MAL-CS / MAL-FOCI tracker bundles shipped from this repository's
root-level JSON files.
## Quick start
Prerequisites: Node 22 LTS and pnpm 10.13.1 (pinned via `package.json`'s
`packageManager` field). From the `mal-cs/` directory:
```bash
pnpm install --frozen-lockfile # restore the locked dependency tree
pnpm start # dev server (d2-app-scripts start) — prompts for a DHIS2 baseUrl + credentials
pnpm test --watchAll=false # run the Jest suite once (23 suites / 105 tests)
pnpm lint # eslint + prettier check
pnpm build # production build → build/bundle/mal-cs-1.0.0.zip
```
The dev server runs at . The `start` script proxies API
calls to the DHIS2 instance you point it at; CORS allow-listing must be
configured on the target instance for `
localhost`.
## Deploy
1. Run `pnpm build` from `mal-cs/`. The d2-app-scripts build produces
`build/bundle/mal-cs-1.0.0.zip` (currently ~3.0 MB).
2. Log in to the target DHIS2 instance as a user with the `M_dhis-web-app-management`
authority.
3. Open `App Management`, click `Upload app`, and select the ZIP.
4. The app appears in the app menu as **MAL-CS** and is reachable at
`${baseUrl}/api/apps/mal-cs/index.html`.
## Architecture
React 18 + TypeScript (strict mode + `noUncheckedIndexedAccess`) +
`@dhis2/app-runtime` + `@dhis2/ui` + `react-router` (HashRouter, never
BrowserRouter — required for coexistence with DHIS2's server-side routing).
Cache management uses TanStack Query v5 (`useDhis2Query` wrapper for line
lists; `useDataQuery` direct for single-resource pages). Maps use
`r …