CLI reference¶
d2w — command-line interface for DHIS2 (discovers plugins from dhis2w-core).
Usage:
Options:
-p, --profile <str>: DHIS2 profile name (overrides DHIS2_PROFILE env + TOML default).-d, --debug: Verbose output on stderr — HTTP method/URL/status/elapsed for every request.-j, --json: Emit raw JSON to stdout instead of Rich tables (uniform across all commands).-V, --version: Print the CLI version + active plugin tree and exit.--help: Show this message and exit.
Commands:
schema: Describe a generated type's fields...analytics: DHIS2 analytics queries.apps: DHIS2 apps — /api/apps + /api/appHub.browser: Playwright-driven DHIS2 UI automation.customize: Brand + theme a DHIS2 instance (logos,...data: DHIS2 data values (aggregate + tracker).datastore: DHIS2 key-value data store.dev: Developer/operator tools.doctor: Probe a DHIS2 instance for known gotchas +...files: Manage DHIS2 documents + file resources.maintenance: DHIS2 maintenance (tasks, cache,...messaging: DHIS2 internal messaging.metadata: DHIS2 metadata inspection.profile: Manage DHIS2 profiles.query: d2ql query + transform language.route: DHIS2 integration routes.security: DHIS2 security posture (read-only).system: DHIS2 system info.user: DHIS2 user administration.fhir: FHIR Implementation Guide generation from...
d2w schema¶
Describe a generated type's fields (metadata or instance-side; prefers the OpenAPI tree).
Usage:
Arguments:
type_name: Type name, e.g. dataElement or TrackedEntity (case-insensitive; plural wire names ok). [required]
Options:
--source <str>: Which generated tree to read: auto (prefer oas), oas, or schemas. [default: auto]--help: Show this message and exit.
d2w analytics¶
DHIS2 analytics queries.
Usage:
Options:
--help: Show this message and exit.
Commands:
query: Run an aggregate analytics query (requires...outlier-detection: Run/api/analytics/outlierDetection—...events: Event analytics — line-lists events or...enrollments: Enrollment analytics — line-lists...tracked-entities: Tracked-entity analytics — line-list TEs...
d2w analytics query¶
Run an aggregate analytics query (requires at least dx + pe dimensions).
Example: analytics query --dim dx:Uvn6LCg7dVU --dim pe:LAST_12_MONTHS --dim ou:ImspTQPwCqd
Use --shape to pick table, raw, or dvs.
Usage:
Options:
--dimension, --dim <str>: Repeatable 'axis:value': dx:<UID>, pe:<period> (both required), ou:<UID>. [required]--shape <str>: Response shape:table(default, aggregated),raw(/api/analytics/rawData),dvs(/api/analytics/dataValueSet — DataValueSet shape). [default: table]--filter <str>: Filter string (repeatable), same syntax as --dimension.--agg <str>: SUM | AVERAGE | COUNT | MIN | MAX | AVERAGE_SUM_ORG_UNIT ...--output-id-scheme <str>: UID | NAME | CODE | ID — how UIDs appear in the response--num-den / --no-num-den: Include indicator numerator/denominator columns. [default: no-num-den]--display-property <str>: NAME | SHORTNAME — which label to render metadata with.--start-date <str>: Fixed window start, ISO date YYYY-MM-DD (alternative to a pe: dimension).--end-date <str>: Fixed window end, ISO date YYYY-MM-DD.--skip-meta--help: Show this message and exit.
d2w analytics outlier-detection¶
Run /api/analytics/outlierDetection — flag statistical anomalies in data values.
Usage:
Options:
--data-element, --de <str>: Data-element UID (repeatable).--data-set, --ds <str>: Data-set UID (repeatable) — expanded to its dataElements.--org-unit, --ou <str>: Org-unit UID (repeatable).--period, --pe <str>: Period identifier (e.g. LAST_12_MONTHS, 202401).--start-date <str>: ISO date YYYY-MM-DD.--end-date <str>: ISO date YYYY-MM-DD.--algorithm <str>: Z_SCORE (default) | MODIFIED_Z_SCORE | MIN_MAX. (Upstream OAS still shows MOD_Z_SCORE but the server rejects that value — see BUGS.md.)--threshold <float>: Standard-deviation cutoff (default 3.0).--max-results <int>: Cap the number of outliers returned (default 500).--order-by <str>: ABS_DEV | STANDARD_DEVIATION | Z_SCORE | ...--sort-order <str>: ASC | DESC.--help: Show this message and exit.
d2w analytics events¶
Event analytics — line-lists events or aggregates them.
Usage:
Options:
--help: Show this message and exit.
Commands:
query: Run an event analytics query.
d2w analytics events query¶
Run an event analytics query.
Example: analytics events query <PROGRAM_UID> --mode query --dim pe:LAST_12_MONTHS --dim ou:<ouUID>
PROGRAM is a program UID; --mode is query (line list) or aggregate.
Usage:
Arguments:
program: Program UID. [required]
Options:
--mode <str>:query(line-listed events) oraggregate(grouped counts). [default: query]--dimension, --dim <str>: Repeatable 'axis:value': pe:<period>, ou:<UID>. Aggregate value dim = <stage>.<de> (no dx:).--filter <str>: Filter string (repeatable), same syntax as --dimension.--stage <str>: Program stage UID to narrow events.--output-type <str>: EVENT | ENROLLMENT | TRACKED_ENTITY_INSTANCE (row shape).--start-date <str>: Fixed window start, ISO date YYYY-MM-DD (alternative to a pe: dimension).--end-date <str>: Fixed window end, ISO date YYYY-MM-DD.--skip-meta--page <int>--page-size <int>--help: Show this message and exit.
d2w analytics enrollments¶
Enrollment analytics — line-lists enrollments.
Usage:
Options:
--help: Show this message and exit.
Commands:
query: Run an enrollment analytics query...
d2w analytics enrollments query¶
Run an enrollment analytics query (/api/analytics/enrollments/query/{program}).
Usage:
Arguments:
program: Program UID. [required]
Options:
--dimension, --dim <str>: Dimension string (repeatable).--filter <str>: Filter string (repeatable).--start-date <str>: Fixed window start, ISO date YYYY-MM-DD (alternative to a pe: dimension).--end-date <str>: Fixed window end, ISO date YYYY-MM-DD.--skip-meta--page <int>--page-size <int>--help: Show this message and exit.
d2w analytics tracked-entities¶
Tracked-entity analytics — line-list TEs for a given type.
Usage:
Options:
--help: Show this message and exit.
Commands:
query: Line-list tracked entities via...
d2w analytics tracked-entities query¶
Line-list tracked entities via /api/analytics/trackedEntities/query/{TET_UID}.
Usage:
Arguments:
tracked_entity_type: TrackedEntityType UID. [required]
Options:
--dimension, --dim <str>: Dimension string (repeatable).--filter <str>: Filter string (repeatable).--program <str>: Program UID (repeatable) to narrow results.--start-date <str>: Fixed window start, ISO date YYYY-MM-DD (alternative to a pe: dimension).--end-date <str>: Fixed window end, ISO date YYYY-MM-DD.--ou-mode <str>: SELECTED|CHILDREN|DESCENDANTS|ACCESSIBLE|ALL (default SELECTED; DESCENDANTS reaches facilities).--display-property <str>: NAME | SHORTNAME.--skip-meta--skip-data--include-metadata-details: Include nested objects in the metaData map.--page <int>--page-size <int>--asc <str>: Field to sort ascending (repeatable).--desc <str>: Field to sort descending (repeatable).--help: Show this message and exit.
d2w apps¶
DHIS2 apps — /api/apps + /api/appHub.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List every installed app (GET /api/apps).list: List every installed app (GET /api/apps).add: Install an app from a local zip, an App...rm: Uninstall an app by key (`DELETE...remove: Uninstall an app by key (`DELETE...update: Update one app or every installed app to...reload: Ask DHIS2 to re-read every app from disk...restore: Reinstall every hub-backed entry from a...snapshot: Capture every installed app into a...hub-list: List apps available in the configured App...hub-versions: List every published version of one App...hub-url: Read or write DHIS2's configured App Hub...
d2w apps ls¶
List every installed app (GET /api/apps).
Usage:
Options:
--help: Show this message and exit.
d2w apps list¶
List every installed app (GET /api/apps).
Usage:
Options:
--help: Show this message and exit.
d2w apps add¶
Install an app from a local zip, an App Hub version id, or an App Hub app id.
Auto-dispatches on source: an existing file on disk → multipart upload to
/api/apps; otherwise the id is resolved against the configured App Hub
catalog and installed via POST /api/appHub/{versionId}. A version id
installs directly; an app id resolves to that app's latest version (App Hub
app ids and version ids are both bare UUIDs and easy to confuse — see
BUGS.md #46). DHIS2 overwrites an existing install of the same app.
Usage:
Arguments:
source: A path to a local.zip(installs via /api/apps), an App Hub version id, or an App Hub app id (the latest version is resolved). [required]
Options:
--help: Show this message and exit.
d2w apps rm¶
Uninstall an app by key (DELETE /api/apps/{key}).
Usage:
Arguments:
key: App key (folder name) fromapps list. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w apps remove¶
Uninstall an app by key (DELETE /api/apps/{key}).
Usage:
Arguments:
key: App key (folder name) fromapps list. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w apps update¶
Update one app or every installed app to its latest App Hub version.
Apps without an app_hub_id (typically side-loaded zips) are reported
as SKIPPED — they're not installable via the hub. Bundled core apps
(bundled=True) still carry an app_hub_id and can be updated in
place, so they're treated like any other hub-updatable app. With
--dry-run, every available update prints as
AVAILABLE and no install call is made, so you can preview the delta
first.
Usage:
Arguments:
key: App key; omit with --all to update every app.
Options:
--all: Update every installed app.--dry-run: Show what would change without installing — report the newer hub version for every app with an update available, tagged AVAILABLE.--help: Show this message and exit.
d2w apps reload¶
Ask DHIS2 to re-read every app from disk (PUT /api/apps).
Usage:
Options:
--help: Show this message and exit.
d2w apps restore¶
Reinstall every hub-backed entry from a snapshot JSON.
The flip side of d2w apps snapshot. Reads the JSON produced by
snapshot, walks each entry, and calls /api/appHub/{versionId}
for every app whose hub_version_id is set and whose currently
installed version differs from the snapshot's. Side-loaded entries
(no hub_version_id) report as SKIPPED — the snapshot doesn't
carry their zips.
Usage:
Arguments:
manifest: Path to a snapshot JSON file produced byd2w apps snapshot. [required]
Options:
--dry-run: Show what would install without running the /api/appHub POSTs — entries that would install are tagged AVAILABLE.--help: Show this message and exit.
d2w apps snapshot¶
Capture every installed app into a portable JSON snapshot.
One entry per installed app — key, name, version, app_hub_id, and
(when the app came from the App Hub) the hub versionId +
downloadUrl needed to re-install it on another instance. Apps
without an app_hub_id are captured as source=side-loaded; they
appear in the snapshot but can't be rehydrated without their zip.
Useful as a "pin my apps catalog at this point in time" operation — diff two snapshots to see drift, or re-apply on staging after a bulk-install on production.
Usage:
Options:
-o, --output <path>: Write the snapshot JSON to this file. Omit to print to stdout.--help: Show this message and exit.
d2w apps hub-list¶
List apps available in the configured App Hub (GET /api/appHub).
Pass --search <query> to filter the catalog by app name or
description substring. The filter runs client-side — DHIS2's
/api/appHub proxy doesn't expose a server-side query parameter
on v42, so the full catalog is fetched and filtered after.
Usage:
Options:
-s, --search <str>: Case-insensitive substring filter on name + description (client-side).--limit <int>: Cap the number of rows shown. [default: 50]--help: Show this message and exit.
d2w apps hub-versions¶
List every published version of one App Hub app (GET /api/appHub).
Prints version / id / channel / DHIS2 min->max for each version, newest
first. The id values are the version ids d2w apps add <id> installs
directly (pinning that exact version) — use this to pick a version instead
of letting apps add <app-id> resolve to the latest.
Usage:
Arguments:
app_id: App Hub app id (theidcolumn fromapps hub-list). [required]
Options:
--help: Show this message and exit.
d2w apps hub-url¶
Read or write DHIS2's configured App Hub URL (keyAppHubUrl system setting).
The App Hub is open source (https://github.com/dhis2/app-hub); teams
running a self-hosted hub can point DHIS2 at it by setting this.
Pass --set <url> to update, --clear to revert to DHIS2's
hard-coded default (typically https://apps.dhis2.org/api).
Usage:
Options:
--set <str>: Point this DHIS2 instance at a different App Hub (writes thekeyAppHubUrlsystem setting).--clear: Clear thekeyAppHubUrlsetting so DHIS2 reverts to its default hub.--help: Show this message and exit.
d2w browser¶
Playwright-driven DHIS2 UI automation.
Usage:
Options:
--help: Show this message and exit.
Commands:
pat: Mint a Personal Access Token V2 via...dashboard: Dashboard capture workflows.viz: Visualization capture workflows.map: Map capture workflows.
d2w browser pat¶
Mint a Personal Access Token V2 via Playwright and print the token value to stdout.
DHIS2 only returns the token value once, at creation — store it somewhere
persistent immediately. Subsequent GET /api/apiToken/{id} calls return
metadata but not the secret.
Usage:
Options:
--url <str>: Base URL of the DHIS2 instance. [required]--username <str>: Login username. [required]--password <str>: Login password. [required]--name <str>: Friendly display name for the token.--expires-in-days <int>: Token lifetime in days; omit for no expiry.--allowed-ip <str>: CIDR/IP allowlist entry; repeat for multiple.--allowed-method <str>: HTTP method allowlist; repeat for each method.--allowed-referrer <str>: Referer URL allowlist; repeat for each.--headless / --headful: Run browser headlessly (default: visible, so you can watch the flow). [default: headful]--help: Show this message and exit.
d2w browser dashboard¶
Dashboard capture workflows.
Usage:
Options:
--help: Show this message and exit.
Commands:
screenshot: Capture full-page PNGs of every DHIS2...
d2w browser dashboard screenshot¶
Capture full-page PNGs of every DHIS2 dashboard (or just the ones named via --only).
Shares a single Playwright context across dashboards — one login, one dashboard-app load, then hash-only navigation between dashboards. The capture loop waits for each item's plugin iframe to render substantial content (canvas / svg / leaflet / highcharts / img / long text) with a plateau detector so one stuck item doesn't stall the batch.
Usage:
Options:
-o, --output-dir <path>: Directory for the PNG output. Defaults to./screenshots. Each run auto-creates an{instance-slug}/subdirectory keyed on the profile's base URL so multi-stack captures don't overwrite.--only <str>: Capture only these dashboard UIDs; repeat for multiple.--headless / --headful: Run browser headlessly (default: yes — automation-friendly). [default: headless]--banner / --no-banner: Prepend an info banner (instance / user / timestamp) to each PNG. [default: banner]--trim / --no-trim: Crop uniform-colour edges off the bottom + right of each PNG. [default: trim]--help: Show this message and exit.
d2w browser viz¶
Visualization capture workflows.
Usage:
Options:
--help: Show this message and exit.
Commands:
screenshot: Capture a PNG of each Visualization (or...
d2w browser viz screenshot¶
Capture a PNG of each Visualization (or just the UIDs named via --only).
Each capture navigates the DHIS2 Data Visualizer app
(/dhis-web-data-visualizer/#/<uid>) inside a shared Playwright
context — one login, one app-shell load, hash-only navigation
between vizes. Renders wait for the chart to materialise (SVG /
canvas / pivot table / long text) with a plateau detector so one
stuck viz doesn't stall the batch.
DHIS2 has no native /api/visualizations/{uid}.png endpoint, so
every PNG goes through Chromium. Install the extra via
uv add 'dhis2w-cli' + playwright install
chromium first.
Usage:
Options:
-o, --output-dir <path>: Directory for the PNG output. Defaults to./screenshots. Each run auto-creates an{instance-slug}/subdirectory keyed on the profile's base URL so multi-stack captures don't overwrite.--only <str>: Capture only these Visualization UIDs; repeat for multiple.--headless / --headful: Run browser headlessly (default: yes — automation-friendly). [default: headless]--banner / --no-banner: Prepend an info banner (name / type / instance / user / timestamp) to each PNG. [default: banner]--trim / --no-trim: Crop uniform-colour edges off the bottom + right of each PNG. [default: trim]--help: Show this message and exit.
d2w browser map¶
Map capture workflows.
Usage:
Options:
--help: Show this message and exit.
Commands:
screenshot: Capture a PNG of each Map (or the UIDs...
d2w browser map screenshot¶
Capture a PNG of each Map (or the UIDs named via --only).
Navigates the DHIS2 Maps app (/dhis-web-maps/#/<uid>) in a shared
Playwright context — one login, one app-shell load, hash-nav between
maps. Waits for MapLibre canvas + vector overlays to render before
snapping. Requires the ` extra (install withuv add 'dhis2w-cli'+playwright install chromium`).
Usage:
Options:
-o, --output-dir <path>: Directory for the PNG output. Defaults to./screenshots. Each run auto-creates an{instance-slug}/subdirectory keyed on the profile's base URL so multi-stack captures don't overwrite.--only <str>: Capture only these Map UIDs; repeat for multiple.--headless / --headful: Run browser headlessly (default: yes — automation-friendly). [default: headless]--banner / --no-banner: Prepend an info banner (name / layer count / instance / user / timestamp) to each PNG. [default: banner]--trim / --no-trim: Crop uniform-colour edges off the bottom + right of each PNG. [default: trim]--help: Show this message and exit.
d2w customize¶
Brand + theme a DHIS2 instance (logos, copy, CSS).
Usage:
Options:
--help: Show this message and exit.
Commands:
logo-front: Upload the login-page splash / upper-right...logo-banner: Upload the top-menu banner logo (appears...style: Upload a CSS stylesheet that DHIS2 serves...apply: Apply a committed preset directory in one...show: Show DHIS2's current/api/loginConfig...
d2w customize logo-front¶
Upload the login-page splash / upper-right logo.
Usage:
Arguments:
file: PNG/JPG/SVG to upload as the login splash logo. [required]
Options:
--help: Show this message and exit.
d2w customize logo-banner¶
Upload the top-menu banner logo (appears on every authenticated page).
Usage:
Arguments:
file: PNG/JPG/SVG to upload as the top-menu banner. [required]
Options:
--help: Show this message and exit.
d2w customize style¶
Upload a CSS stylesheet that DHIS2 serves on every authenticated page.
NOTE: DHIS2's standalone login app (/dhis-web-login/) does NOT include this
stylesheet. Post-auth pages do.
Usage:
Arguments:
file: CSS file to upload as/api/files/style. [required]
Options:
--help: Show this message and exit.
d2w customize apply¶
Apply a committed preset directory in one call (skips files that don't exist).
Usage:
Arguments:
directory: Directory containing optional logo_front.png, logo_banner.png, style.css, preset.json. [required]
Options:
--help: Show this message and exit.
d2w customize show¶
Show DHIS2's current /api/loginConfig snapshot (what the login app sees).
Usage:
Options:
--help: Show this message and exit.
d2w data¶
DHIS2 data values (aggregate + tracker).
Usage:
Options:
--help: Show this message and exit.
Commands:
aggregate: Aggregate data values (dataValueSets).tracker: Tracker (entities, enrollments, events,...
d2w data aggregate¶
Aggregate data values (dataValueSets).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Fetch a data value set.push: Bulk push data values from a JSON file.set: Set a single data value.delete: Delete a single data value.followup: Set or clear the follow-up flag on a...
d2w data aggregate get¶
Fetch a data value set. Needs --ds plus a period (--pe or --start-date/--end-date) and --ou.
Example: data aggregate get --ds <dataSetUID> --pe 202401 --ou <ouUID> --children
Usage:
Options:
--data-set, --ds <str>: DataSet UID.--period, --pe <str>: Period; match the dataSet's periodType (Monthly=202401, Yearly=2024, Weekly=2024W12).--start-date <str>: ISO date (YYYY-MM-DD).--end-date <str>: ISO date (YYYY-MM-DD).--org-unit, --ou <str>: OrganisationUnit UID.--org-unit-group, --oug <str>: OrganisationUnitGroup UID (alternative to --ou).--children: Include descendant org units (values usually live at facility level).--data-element-group, --deg <str>: DataElementGroup UID (narrows to its member DEs).--include-deleted: Also return soft-deleted values.--last-updated <str>: Only values modified since a date (YYYY-MM-DD) or duration (e.g. 7d).--limit <int>: Max rows to include in output.--help: Show this message and exit.
d2w data aggregate push¶
Bulk push data values from a JSON file.
Usage:
Arguments:
file: Path to a JSON file containing a dataValues array or envelope. [required]
Options:
--data-set, --ds <str>--period, --pe <str>--org-unit, --ou <str>--dry-run--strategy <str>: CREATE | UPDATE | CREATE_AND_UPDATE | DELETE--help: Show this message and exit.
d2w data aggregate set¶
Set a single data value.
An attribute option combo is addressed by its CategoryCombo UID (--cc) plus the category-option UIDs (--cp, repeatable) — DHIS2 has no attributeOptionCombo query param, so pass the two together.
Usage:
Options:
--data-element, --de <str>: DataElement UID. [required]--period, --pe <str>: Period (e.g. 202401). [required]--org-unit, --ou <str>: OrganisationUnit UID. [required]--value <str>: The value to set (as a string). [required]--coc <str>: CategoryOptionCombo UID.--attribute-combo, --cc <str>: Attribute CategoryCombo UID (pair with --attribute-option).--attribute-option, --cp <str>: Attribute category-option UID; repeat for each. Pair with --attribute-combo.--comment <str>--help: Show this message and exit.
d2w data aggregate delete¶
Delete a single data value.
Address an attribute option combo via --cc (its CategoryCombo UID) plus --cp (its category-option UIDs, repeatable) — DHIS2 has no attributeOptionCombo param.
Usage:
Options:
--data-element, --de <str>: [required]--period, --pe <str>: [required]--org-unit, --ou <str>: [required]--coc <str>--attribute-combo, --cc <str>: Attribute CategoryCombo UID.--attribute-option, --cp <str>: Attribute category-option UID; repeat for each.--help: Show this message and exit.
d2w data aggregate followup¶
Set or clear the follow-up flag on a single data value.
Usage:
Options:
--data-element, --de <str>: [required]--period, --pe <str>: [required]--org-unit, --ou <str>: [required]--on / --off: Set (--on) or clear (--off) the follow-up flag. [default: on]--coc <str>--aoc <str>--help: Show this message and exit.
d2w data tracker¶
Tracker (entities, enrollments, events, relationships).
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List tracked entities by TrackedEntityType...list: List tracked entities by TrackedEntityType...get: Fetch one tracked entity by UID...type: List every configured TrackedEntityType on...push: Bulk import via POST /api/tracker.delete: Delete tracked entities by UID (cascades...register: Register a tracked entity + enroll in one...outstanding: List ACTIVE enrollments missing events on...enrollment: Enrollments.event: Events.relationship: Relationships.
d2w data tracker ls¶
List tracked entities by TrackedEntityType (TYPE) or by --program — give exactly one.
Example: d2w data tracker list Person --ou ImspTQPwCqd
Usage:
Arguments:
type: TrackedEntityType name (case-insensitive) or UID — e.g. 'Person' or 'tet01234567'. Give this OR --program (not both).
Options:
--program <str>: Program UID — list the program's tracked entities. Alternative to TYPE; DHIS2 rejects a program and a TrackedEntityType together.--te-uids <str>: Comma-separated tracked-entity UIDs to fetch directly.--org-unit, --ou <str>: OrganisationUnit UID to scope the listing.--ou-mode <str>: Org-unit scope: SELECTED | CHILDREN | DESCENDANTS | ACCESSIBLE | ALL (default DESCENDANTS). [default: DESCENDANTS]--fields <str>: DHIS2 field selector (comma-separated; nest with []).--filter <str>: Attribute filter 'ATTR_UID:op:value' (repeatable).--page-size <int>: [default: 50]--page <int>: 1-based page number.--updated-after <str>: ISO-8601 cutoff — only entities updated after this.--help: Show this message and exit.
d2w data tracker list¶
List tracked entities by TrackedEntityType (TYPE) or by --program — give exactly one.
Example: d2w data tracker list Person --ou ImspTQPwCqd
Usage:
Arguments:
type: TrackedEntityType name (case-insensitive) or UID — e.g. 'Person' or 'tet01234567'. Give this OR --program (not both).
Options:
--program <str>: Program UID — list the program's tracked entities. Alternative to TYPE; DHIS2 rejects a program and a TrackedEntityType together.--te-uids <str>: Comma-separated tracked-entity UIDs to fetch directly.--org-unit, --ou <str>: OrganisationUnit UID to scope the listing.--ou-mode <str>: Org-unit scope: SELECTED | CHILDREN | DESCENDANTS | ACCESSIBLE | ALL (default DESCENDANTS). [default: DESCENDANTS]--fields <str>: DHIS2 field selector (comma-separated; nest with []).--filter <str>: Attribute filter 'ATTR_UID:op:value' (repeatable).--page-size <int>: [default: 50]--page <int>: 1-based page number.--updated-after <str>: ISO-8601 cutoff — only entities updated after this.--help: Show this message and exit.
d2w data tracker get¶
Fetch one tracked entity by UID (TrackedEntityType inferred from the entity).
Usage:
Arguments:
uid: Tracked entity UID. [required]
Options:
--program <str>: Program UID.--fields <str>: DHIS2 field selector (comma-separated; nest with []).--help: Show this message and exit.
d2w data tracker type¶
List every configured TrackedEntityType on the connected instance (name + UID).
The list and get commands accept either a name or a UID in their <type>
positional — run this first to see what's configured.
Usage:
Options:
--help: Show this message and exit.
d2w data tracker push¶
Bulk import via POST /api/tracker.
Usage:
Arguments:
file: JSON file containing the tracker bundle. [required]
Options:
--strategy <str>: CREATE | UPDATE | CREATE_AND_UPDATE | DELETE--atomic <str>: ALL | OBJECT--dry-run--async--help: Show this message and exit.
d2w data tracker delete¶
Delete tracked entities by UID (cascades to their enrollments + events).
Usage:
Arguments:
uids...: Tracked entity UID(s) to delete. [required]
Options:
--async: Return a job reference immediately instead of waiting.-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w data tracker register¶
Register a tracked entity + enroll in one program in one call.
The typical clinic-intake flow: fills the TrackedEntityAttribute form, stamps an enrollment into the program, all atomic via POST /api/tracker. Prints the new tracked-entity + enrollment UIDs so the caller can reference them downstream.
Usage:
Arguments:
program: Program UID to enroll into. [required]
Options:
--org-unit, --ou <str>: OrgUnit UID where the TE lives + is enrolled. [required]--tet <str>: TrackedEntityType UID. Defaults to the program's trackedEntityType if unset.--attr <str>: TrackedEntityAttribute UID=value. Repeatable. Example: --attr w75KJ2mc4zz=Jane--enrolled-at <str>: Enrollment date (ISO, e.g. 2024-06-01). Defaults to today server-side.--help: Show this message and exit.
d2w data tracker outstanding¶
List ACTIVE enrollments missing events on any non-repeatable program stage.
Renders each hit with its tracked-entity UID, OU, and the program-stage UIDs that still need an event. A "what's due" report for tracker follow-ups.
"Required" here means repeatable=false on the program stage —
repeatable stages (weekly checkups, periodic screenings) don't have
a single outstanding semantic and are skipped.
Usage:
Arguments:
program: Program UID — the scope for the 'what's due' report. [required]
Options:
--org-unit, --ou <str>: Narrow to one OU subtree. Default: every active enrollment on the program.--ou-mode <str>: SELECTED | CHILDREN | DESCENDANTS | ALL [default: DESCENDANTS]--page-size <int>: Max enrollments scanned (default 200). [default: 200]--help: Show this message and exit.
d2w data tracker enrollment¶
Enrollments.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List enrollments (tracker programs only).list: List enrollments (tracker programs only).delete: Delete enrollments by UID (cascades to...create: Enroll an existing tracked entity in a...
d2w data tracker enrollment ls¶
List enrollments (tracker programs only).
Usage:
Options:
--program <str>: Program UID.--org-unit, --ou <str>: OrganisationUnit UID to scope the listing.--ou-mode <str>: Org-unit scope: SELECTED | CHILDREN | DESCENDANTS | ACCESSIBLE | ALL (default DESCENDANTS). [default: DESCENDANTS]--te <str>: TrackedEntity UID.--status <str>: ACTIVE | COMPLETED | CANCELLED--fields <str>: DHIS2 field selector (comma-separated; nest with []).--page-size <int>: [default: 50]--page <int>--updated-after <str>--help: Show this message and exit.
d2w data tracker enrollment list¶
List enrollments (tracker programs only).
Usage:
Options:
--program <str>: Program UID.--org-unit, --ou <str>: OrganisationUnit UID to scope the listing.--ou-mode <str>: Org-unit scope: SELECTED | CHILDREN | DESCENDANTS | ACCESSIBLE | ALL (default DESCENDANTS). [default: DESCENDANTS]--te <str>: TrackedEntity UID.--status <str>: ACTIVE | COMPLETED | CANCELLED--fields <str>: DHIS2 field selector (comma-separated; nest with []).--page-size <int>: [default: 50]--page <int>--updated-after <str>--help: Show this message and exit.
d2w data tracker enrollment delete¶
Delete enrollments by UID (cascades to their events).
Usage:
Arguments:
uids...: Enrollment UID(s) to delete. [required]
Options:
--async: Return a job reference immediately instead of waiting.-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w data tracker enrollment create¶
Enroll an existing tracked entity in a program.
Usage:
Arguments:
tracked_entity: Existing TrackedEntity UID to enroll. [required]program: Program UID to enroll into. [required]
Options:
--at <str>: OrgUnit UID where the enrollment lives. [required]--enrolled-at <str>: ISO date; defaults to today server-side.--help: Show this message and exit.
d2w data tracker event¶
Events.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List events (event and tracker programs).list: List events (event and tracker programs).delete: Delete events by UID.create: Add one event — tracker (with enrollment)...
d2w data tracker event ls¶
List events (event and tracker programs). Scope with --program and/or --org-unit.
Example: data tracker event list --program <programUID> --ou <ouUID>
Usage:
Options:
--program <str>: Program UID.--program-stage <str>: ProgramStage UID to narrow to one stage.--org-unit, --ou <str>: OrganisationUnit UID to scope the listing.--ou-mode <str>: Org-unit scope: SELECTED | CHILDREN | DESCENDANTS | ACCESSIBLE | ALL (default DESCENDANTS). [default: DESCENDANTS]--te <str>: TrackedEntity UID.--enrollment <str>: Enrollment UID to list its events.--status <str>: Event status: ACTIVE | COMPLETED | VISITED | SCHEDULE | OVERDUE | SKIPPED.--after <str>: Only events on/after this ISO date (YYYY-MM-DD).--before <str>: Only events on/before this ISO date (YYYY-MM-DD).--fields <str>: DHIS2 field selector (comma-separated; nest with []).--page-size <int>: [default: 50]--page <int>--help: Show this message and exit.
d2w data tracker event list¶
List events (event and tracker programs). Scope with --program and/or --org-unit.
Example: data tracker event list --program <programUID> --ou <ouUID>
Usage:
Options:
--program <str>: Program UID.--program-stage <str>: ProgramStage UID to narrow to one stage.--org-unit, --ou <str>: OrganisationUnit UID to scope the listing.--ou-mode <str>: Org-unit scope: SELECTED | CHILDREN | DESCENDANTS | ACCESSIBLE | ALL (default DESCENDANTS). [default: DESCENDANTS]--te <str>: TrackedEntity UID.--enrollment <str>: Enrollment UID to list its events.--status <str>: Event status: ACTIVE | COMPLETED | VISITED | SCHEDULE | OVERDUE | SKIPPED.--after <str>: Only events on/after this ISO date (YYYY-MM-DD).--before <str>: Only events on/before this ISO date (YYYY-MM-DD).--fields <str>: DHIS2 field selector (comma-separated; nest with []).--page-size <int>: [default: 50]--page <int>--help: Show this message and exit.
d2w data tracker event delete¶
Delete events by UID.
Usage:
Arguments:
uids...: Event UID(s) to delete. [required]
Options:
--async: Return a job reference immediately instead of waiting.-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w data tracker event create¶
Add one event — tracker (with enrollment) or event-only (standalone).
For tracker programs, pass --enrollment (the event binds to the enrollment's timeline). For event programs (WITHOUT_REGISTRATION — community surveys, case-investigation forms), omit --enrollment; the event stands alone, scoped by program + stage + org unit.
Usage:
Options:
--program <str>: Program UID. [required]--stage <str>: ProgramStage UID. [required]--at <str>: OrgUnit UID where the event happened. [required]--enrollment <str>: Enrollment UID for tracker (WITH_REGISTRATION) programs. Omit for event (WITHOUT_REGISTRATION) programs.--te <str>: TrackedEntity UID (tracker programs only). Optional — DHIS2 derives from the enrollment.--dv <str>: DataElement UID=value. Repeatable. Example: --dv fClA2Erf6IO=5--occurred-at <str>: ISO event date; defaults to today server-side.--help: Show this message and exit.
d2w data tracker relationship¶
Relationships.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List relationships (one of...list: List relationships (one of...
d2w data tracker relationship ls¶
List relationships (one of --te/--enrollment/--event required).
Usage:
Options:
--te <str>: TrackedEntity UID.--enrollment <str>: Enrollment UID to list its events.--event <str>--fields <str>: DHIS2 field selector (comma-separated; nest with []).--page-size <int>: [default: 50]--help: Show this message and exit.
d2w data tracker relationship list¶
List relationships (one of --te/--enrollment/--event required).
Usage:
Options:
--te <str>: TrackedEntity UID.--enrollment <str>: Enrollment UID to list its events.--event <str>--fields <str>: DHIS2 field selector (comma-separated; nest with []).--page-size <int>: [default: 50]--help: Show this message and exit.
d2w datastore¶
DHIS2 key-value data store.
Usage:
Options:
--help: Show this message and exit.
Commands:
namespaces: List every namespace in the store.keys: List every key in a namespace.get: Print the value stored atnamespace/key...set: Create or updatenamespace/key.delete: Deletenamespace/key.delete-namespace: Delete an entire namespace and every key...
d2w datastore namespaces¶
List every namespace in the store.
Usage:
Options:
--user: Target the per-user store (/api/userDataStore) instead of the shared one.--help: Show this message and exit.
d2w datastore keys¶
List every key in a namespace.
Usage:
Arguments:
namespace: Namespace to list keys in. [required]
Options:
--user: Target the per-user store (/api/userDataStore) instead of the shared one.--help: Show this message and exit.
d2w datastore get¶
Print the value stored at namespace/key (JSON).
Usage:
Arguments:
namespace: Namespace. [required]key: Key. [required]
Options:
--user: Target the per-user store (/api/userDataStore) instead of the shared one.--help: Show this message and exit.
d2w datastore set¶
Create or update namespace/key.
Usage:
Arguments:
namespace: Namespace. [required]key: Key. [required]value: Value — parsed as JSON, or stored as a string if not valid JSON. [required]
Options:
--user: Target the per-user store (/api/userDataStore) instead of the shared one.--help: Show this message and exit.
d2w datastore delete¶
Delete namespace/key.
Usage:
Arguments:
namespace: Namespace. [required]key: Key. [required]
Options:
--user: Target the per-user store (/api/userDataStore) instead of the shared one.-y, --yes: Skip the interactive confirmation.--help: Show this message and exit.
d2w datastore delete-namespace¶
Delete an entire namespace and every key in it.
Usage:
Arguments:
namespace: Namespace to delete (all its keys go with it). [required]
Options:
--user: Target the per-user store (/api/userDataStore) instead of the shared one.-y, --yes: Skip the interactive confirmation.--help: Show this message and exit.
d2w dev¶
Developer/operator tools.
Usage:
Options:
--help: Show this message and exit.
Commands:
codegen: Generate version-aware DHIS2 client code...uid: Generate 11-char DHIS2 UIDs.sample: Inject known-good fixtures to verify the...
d2w dev codegen¶
Generate version-aware DHIS2 client code from /api/schemas.
Usage:
Options:
--help: Show this message and exit.
Commands:
generate: Generate the client for the DHIS2 version...rebuild: Regenerate the client from saved...oas-rebuild: Emit OpenAPI-derived pydantic models into...diff: Diff two committedschemas_manifest.json...
d2w dev codegen generate¶
Generate the client for the DHIS2 version reported by --url.
Usage:
Options:
--url <str>: Base URL of the DHIS2 instance. [required]--username <str>: Basic-auth username.--password <str>: Basic-auth password.--pat <str>: Personal Access Token.--output-root <path>: Directory containing versioned subfolders; defaults to dhis2w-client's generated/ folder.--help: Show this message and exit.
d2w dev codegen rebuild¶
Regenerate the client from saved schemas_manifest.json files (no network).
Useful after touching emit.py / templates when you want every committed
version refreshed without spinning up a live DHIS2 for each. If --manifest
is omitted, walks the output root and rebuilds each version whose
schemas_manifest.json is checked in.
Usage:
Options:
--manifest <path>: Path to a committed schemas_manifest.json. Defaults to every version under the generated root.--output-root <path>: Directory of versioned subfolders; defaults to dhis2w-client generated/.--help: Show this message and exit.
d2w dev codegen oas-rebuild¶
Emit OpenAPI-derived pydantic models into generated/v{N}/oas/.
Reads the committed openapi.json + schemas_manifest.json from each
version directory (no network). Output lands alongside the /api/schemas
emitter's output under schemas/.
Usage:
Options:
--version <str>: Version key (e.g. v42). Defaults to every committed version.--output-root <path>: Directory of versioned subfolders; defaults to dhis2w-client generated/.--help: Show this message and exit.
d2w dev codegen diff¶
Diff two committed schemas_manifest.json files and report drift.
Lists schemas added, removed, and per-property changes (type, klass, bounds, owner/required/etc). Useful for spotting upstream API drift when bumping DHIS2 majors.
Usage:
Arguments:
from_version: Source version key (e.g. v42). [required]to_version: Target version key (e.g. v43). [required]
Options:
--output-root <path>: Directory of versioned subfolders; defaults to dhis2w-client generated/.--json: Emit a JSON dump instead of the human-readable report.--help: Show this message and exit.
d2w dev uid¶
Generate 11-char DHIS2 UIDs.
Usage:
Options:
-n, --count <int range>: How many UIDs to generate. [default: 1; 1<=x<=10000]--help: Show this message and exit.
d2w dev sample¶
Inject known-good fixtures to verify the stack end-to-end (route, data, pat, oauth2-client).
Usage:
Options:
--help: Show this message and exit.
Commands:
route: Create a sample route, run it, and (unless...pat: Create a sample PAT, use it to call...data-value: Write a sample data value, read it back,...oauth2-client: Create a sample OAuth2 client on DHIS2,...all: Run every sample in sequence — route,...
d2w dev sample route¶
Create a sample route, run it, and (unless --keep) delete it.
Verifies the full /api/routes lifecycle end-to-end: create -> run (proxy to target URL) -> delete.
Usage:
Options:
--url <str>: URL the sample route will proxy to. [default: https://httpbin.org/get]--code <str>: [default: SMOKE_ROUTE]--keep: Don't delete the sample route afterwards.--help: Show this message and exit.
d2w dev sample pat¶
Create a sample PAT, use it to call /api/me, then (unless --keep) delete it.
Usage:
Options:
--url <str>: DHIS2 base URL (also: DHIS2_URL env).--admin-user <str>--keep: Don't delete the sample PAT afterwards.--help: Show this message and exit.
d2w dev sample data-value¶
Write a sample data value, read it back, and (unless --keep) delete it.
Uses the Sierra Leone seed fixture by default:
fClA2Erf6IO ("Penta1 doses given") at Rp268JB6Ne4
(Adonkia CHP, facility level) for 202406 (within the seeded 2024
data window). The DE is in the seeded BfMAe6Itzgt ("Child
Health") dataset, so DHIS2's dataset-detection on import
accepts the write. Override with --de / --ou / --pe for
other scopes.
Usage:
Options:
--data-element, --de <str>: DataElement UID. [default: fClA2Erf6IO]--org-unit, --ou <str>: OrganisationUnit UID. [default: Rp268JB6Ne4]--period, --pe <str>: Period (e.g. 202406). [default: 202406]--value <str>: [default: 42]--keep: Don't delete the sample data value afterwards.--help: Show this message and exit.
d2w dev sample oauth2-client¶
Create a sample OAuth2 client on DHIS2, verify it persisted, then (unless --keep) delete it.
Lifecycle: POST /api/oAuth2Clients -> GET /api/oAuth2Clients/{uid} -> DELETE /api/oAuth2Clients/{uid}. The admin user is the owner DHIS2 records on the client; no user-impersonation happens.
Usage:
Options:
--url <str>: DHIS2 base URL (also: DHIS2_URL env).--admin-user <str>--client-id <str>: OAuth2 client_id; default = smoke-<epoch>.--keep: Don't delete the sample OAuth2 client afterwards.--help: Show this message and exit.
d2w dev sample all¶
Run every sample in sequence — route, data-value, pat, oauth2-client.
Usage:
Options:
--url <str>: DHIS2 base URL (also: DHIS2_URL env).--admin-user <str>--keep: Don't delete the fixtures afterwards.--help: Show this message and exit.
d2w doctor¶
Probe a DHIS2 instance for known gotchas + requirements.
Usage:
Options:
--all: Run every category (metadata + integrity + bugs).--help: Show this message and exit.
Commands:
metadata: Run workspace metadata-health probes only...integrity: Run DHIS2's own...bugs: Run BUGS.md workaround drift detection...
d2w doctor metadata¶
Run workspace metadata-health probes only (data sets without DEs, programs without stages, ...).
Usage:
Options:
--help: Show this message and exit.
d2w doctor integrity¶
Run DHIS2's own /api/dataIntegrity/summary and surface each check as a probe.
Usage:
Options:
--help: Show this message and exit.
d2w doctor bugs¶
Run BUGS.md workaround drift detection (workspace maintenance, not operator-facing).
Usage:
Options:
--help: Show this message and exit.
d2w files¶
Manage DHIS2 documents + file resources.
Usage:
Options:
--help: Show this message and exit.
Commands:
documents: Documents (/api/documents).resources: File resources (/api/fileResources).
d2w files documents¶
Documents (/api/documents).
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List documents — external URL links and...list: List documents — external URL links and...get: Show metadata for one document.upload: Upload a binary document — prints the new...upload-url: Create an EXTERNAL_URL document — no bytes...download: Download the binary payload todestination.delete: Delete one document.
d2w files documents ls¶
List documents — external URL links and UPLOAD_FILE blobs.
Pass --details to inline each UPLOAD_FILE's fileResource contentType / size /
storageStatus. NOTE: /api/documents does not expose the fileResource UID, so details
are only available where a document's url is itself an 11-char UID (older data); for
filename-style urls the detail columns show -.
Usage:
Options:
--filter <str>: DHIS2 filter, e.g.name:like:Annual.--page <int>: 1-indexed page number.--page-size <int>: Rows per page (default 50).--details: For each UPLOAD_FILE, also fetch the backing fileResource's contentType / size / storageStatus (one extra request per row).--help: Show this message and exit.
d2w files documents list¶
List documents — external URL links and UPLOAD_FILE blobs.
Pass --details to inline each UPLOAD_FILE's fileResource contentType / size /
storageStatus. NOTE: /api/documents does not expose the fileResource UID, so details
are only available where a document's url is itself an 11-char UID (older data); for
filename-style urls the detail columns show -.
Usage:
Options:
--filter <str>: DHIS2 filter, e.g.name:like:Annual.--page <int>: 1-indexed page number.--page-size <int>: Rows per page (default 50).--details: For each UPLOAD_FILE, also fetch the backing fileResource's contentType / size / storageStatus (one extra request per row).--help: Show this message and exit.
d2w files documents get¶
Show metadata for one document.
Usage:
Arguments:
uid: Document UID. [required]
Options:
--help: Show this message and exit.
d2w files documents upload¶
Upload a binary document — prints the new UID.
Usage:
Arguments:
file: File to upload. [required]
Options:
--name <str>: Document name (defaults to filename).--help: Show this message and exit.
d2w files documents upload-url¶
Create an EXTERNAL_URL document — no bytes uploaded; DHIS2 links out to url.
Usage:
Arguments:
name: Document display name. [required]url: External URL DHIS2 will link to. [required]
Options:
--help: Show this message and exit.
d2w files documents download¶
Download the binary payload to destination.
Usage:
Arguments:
uid: Document UID. [required]destination: Output file path. [required]
Options:
--help: Show this message and exit.
d2w files documents delete¶
Delete one document.
Usage:
Arguments:
uid: Document UID. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w files resources¶
File resources (/api/fileResources).
Usage:
Options:
--help: Show this message and exit.
Commands:
upload: Upload a file resource; prints the new UID...get: Show metadata for one file resource.download: Download the file-resource payload to...
d2w files resources upload¶
Upload a file resource; prints the new UID (reference it from the owning metadata object).
Usage:
Arguments:
file: File to upload as a fileResource. [required]
Options:
--domain <data_value|push_analysis|document|message_attachment|user_avatar|org_unit|icon|job_data>: FileResource domain (DATA_VALUE, ICON, MESSAGE_ATTACHMENT, ...). [default: DATA_VALUE]--help: Show this message and exit.
d2w files resources get¶
Show metadata for one file resource.
Usage:
Arguments:
uid: FileResource UID. [required]
Options:
--help: Show this message and exit.
d2w files resources download¶
Download the file-resource payload to destination.
Usage:
Arguments:
uid: FileResource UID. [required]destination: Output file path. [required]
Options:
--help: Show this message and exit.
d2w maintenance¶
DHIS2 maintenance (tasks, cache, integrity, cleanup, refresh).
Usage:
Options:
--help: Show this message and exit.
Commands:
cache: Clear every server-side cache (Hibernate +...task: Background-task polling (all long-running...cleanup: Hard-remove soft-deleted rows (unblocks...dataintegrity: DHIS2 data-integrity checks.refresh: Regenerate analytics / resource /...validation: Run validation rules + inspect violations...predictors: Run predictor expressions (CRUD on...
d2w maintenance cache¶
Clear every server-side cache (Hibernate + app caches).
Usage:
Options:
--help: Show this message and exit.
d2w maintenance task¶
Background-task polling (all long-running DHIS2 ops).
Usage:
Options:
--help: Show this message and exit.
Commands:
types: List every background-job type DHIS2...ls: List every task UID recorded for a given...list: List every task UID recorded for a given...status: Print every notification emitted by a...watch: Poll a task until it reports...
d2w maintenance task types¶
List every background-job type DHIS2 tracks (ANALYTICS_TABLE, DATA_INTEGRITY, ...).
Usage:
Options:
--help: Show this message and exit.
d2w maintenance task ls¶
List every task UID recorded for a given job type.
Usage:
Arguments:
task_type: Task type, e.g. ANALYTICS_TABLE. [required]
Options:
--help: Show this message and exit.
d2w maintenance task list¶
List every task UID recorded for a given job type.
Usage:
Arguments:
task_type: Task type, e.g. ANALYTICS_TABLE. [required]
Options:
--help: Show this message and exit.
d2w maintenance task status¶
Print every notification emitted by a task, oldest first.
Usage:
Arguments:
task_type: Task type, e.g. ANALYTICS_TABLE. [required]task_uid: Task UID returned by the async POST. [required]
Options:
--help: Show this message and exit.
d2w maintenance task watch¶
Poll a task until it reports completed=true, streaming each new notification.
Usage:
Arguments:
task_type: Task type, e.g. DATA_INTEGRITY. [required]task_uid: Task UID returned by the async POST. [required]
Options:
--interval <float>: Poll interval in seconds. [default: 2.0]--timeout <float>: Abort after N seconds (default 600). [default: 600.0]--help: Show this message and exit.
d2w maintenance cleanup¶
Hard-remove soft-deleted rows (unblocks metadata deletion).
Usage:
Options:
--help: Show this message and exit.
Commands:
data-values: Hard-remove soft-deleted data values from...events: Hard-remove soft-deleted tracker events.enrollments: Hard-remove soft-deleted tracker enrollments.tracked-entities: Hard-remove soft-deleted tracked entities.
d2w maintenance cleanup data-values¶
Hard-remove soft-deleted data values from /api/dataValueSets imports.
Usage:
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w maintenance cleanup events¶
Hard-remove soft-deleted tracker events.
Usage:
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w maintenance cleanup enrollments¶
Hard-remove soft-deleted tracker enrollments.
Usage:
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w maintenance cleanup tracked-entities¶
Hard-remove soft-deleted tracked entities.
Usage:
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w maintenance dataintegrity¶
DHIS2 data-integrity checks.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List every built-in data-integrity check...list: List every built-in data-integrity check...run: Kick off a data-integrity run; with...result: Read the stored result of a completed...
d2w maintenance dataintegrity ls¶
List every built-in data-integrity check (name, section, severity).
Usage:
Options:
--help: Show this message and exit.
d2w maintenance dataintegrity list¶
List every built-in data-integrity check (name, section, severity).
Usage:
Options:
--help: Show this message and exit.
d2w maintenance dataintegrity run¶
Kick off a data-integrity run; with --watch, stream progress to completion.
Usage:
Arguments:
check...: Check name(s); omit to run every check.
Options:
--details: Hit /details (populates issues[]) instead of /summary.--slow: Include the ~19isSlowchecks DHIS2 skips by default. Resolves the full check list via /api/dataIntegrity and passes every name explicitly — DHIS2 only runs a slow check when it's named in thechecksfilter.-w, --watch: After kicking off the job, poll /api/system/tasks until it reports completed=true.--interval <float>: Poll interval in seconds when --watch is set. [default: 2.0]--timeout <float>: Abort polling after N seconds (default 600). [default: 600.0]--help: Show this message and exit.
d2w maintenance dataintegrity result¶
Read the stored result of a completed data-integrity run (summary or details mode).
Usage:
Arguments:
check...: Check name(s) to read; omit for all.
Options:
--details: Hit /details (issues[]) instead of /summary (count only).--help: Show this message and exit.
d2w maintenance refresh¶
Regenerate analytics / resource / monitoring backing tables.
Usage:
Options:
--help: Show this message and exit.
Commands:
analytics: Regenerate the full analytics star schema...resource-tables: Regenerate resource tables only...monitoring: Regenerate monitoring tables...
d2w maintenance refresh analytics¶
Regenerate the full analytics star schema (/api/resourceTables/analytics, job=ANALYTICS_TABLE).
Primary workflow after pushing new data values: DHIS2's analytics queries
read from these tables, so they must be rebuilt for fresh data to show up.
Also refreshes resource tables unless --skip-resource-tables is set.
Usage:
Options:
--last-years <int>--skip-resource-tables-w, --watch: After kicking off the job, poll /api/system/tasks until it reports completed=true.--interval <float>: Poll interval in seconds when --watch is set. [default: 2.0]--timeout <float>: Abort polling after N seconds (default 600). [default: 600.0]--help: Show this message and exit.
d2w maintenance refresh resource-tables¶
Regenerate resource tables only (/api/resourceTables, job=RESOURCE_TABLE).
Rebuilds the supporting OU / category hierarchy tables without touching
the analytics star schema. Use when OU / category metadata changed but
no new data values landed — faster than a full refresh analytics run.
Usage:
Options:
-w, --watch: After kicking off the job, poll /api/system/tasks until it reports completed=true.--interval <float>: Poll interval in seconds when --watch is set. [default: 2.0]--timeout <float>: Abort polling after N seconds (default 600). [default: 600.0]--help: Show this message and exit.
d2w maintenance refresh monitoring¶
Regenerate monitoring tables (/api/resourceTables/monitoring, job=MONITORING).
Rebuilds the tables backing DHIS2's data-quality / validation-rule monitoring. Independent of the analytics + resource tables.
Usage:
Options:
-w, --watch: After kicking off the job, poll /api/system/tasks until it reports completed=true.--interval <float>: Poll interval in seconds when --watch is set. [default: 2.0]--timeout <float>: Abort polling after N seconds (default 600). [default: 600.0]--help: Show this message and exit.
d2w maintenance validation¶
Run validation rules + inspect violations (CRUD on rules: d2w metadata list validationRules).
Usage:
Options:
--help: Show this message and exit.
Commands:
run: Run a validation-rule analysis + render...send-notifications: Fire configured notification templates for...validate-expression: Parse-check an expression + render a human...result: List / get / delete persisted validation...
d2w maintenance validation run¶
Run a validation-rule analysis + render the violations.
Usage:
Arguments:
org_unit: Org-unit UID to evaluate rules under (DHIS2 walks the sub-tree). [required]
Options:
--start-date <str>: Period start, YYYY-MM-DD. [required]--end-date <str>: Period end, YYYY-MM-DD. [required]--group <str>: ValidationRuleGroup UID to narrow the rules evaluated.--max-results <int>: Cap on violations returned (DHIS2 default ~500).--notification: Fire configured notification templates for each triggered rule.--persist: Write violations into/api/validationResults(otherwise ephemeral).--help: Show this message and exit.
d2w maintenance validation send-notifications¶
Fire configured notification templates for every current validation violation.
Usage:
Options:
--help: Show this message and exit.
d2w maintenance validation validate-expression¶
Parse-check an expression + render a human description.
Usage:
Arguments:
expression: DHIS2 expression to parse-check. [required]
Options:
--context <str>: Expression parser context: one of generic, validation-rule, indicator, predictor, program-indicator. [default: generic]--help: Show this message and exit.
d2w maintenance validation result¶
List / get / delete persisted validation results.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List persisted validation results.list: List persisted validation results.get: Show one persisted validation result by id.delete: Bulk-delete validation results by filter.
d2w maintenance validation result ls¶
List persisted validation results.
Usage:
Options:
--org-unit, --ou <str>: Org-unit UID filter.--period, --pe <str>: Period filter (e.g. 202501).--vr <str>: Validation-rule UID filter.--page <int>--page-size <int>--help: Show this message and exit.
d2w maintenance validation result list¶
List persisted validation results.
Usage:
Options:
--org-unit, --ou <str>: Org-unit UID filter.--period, --pe <str>: Period filter (e.g. 202501).--vr <str>: Validation-rule UID filter.--page <int>--page-size <int>--help: Show this message and exit.
d2w maintenance validation result get¶
Show one persisted validation result by id.
Usage:
Arguments:
result_id: Numeric validation-result id. [required]
Options:
--help: Show this message and exit.
d2w maintenance validation result delete¶
Bulk-delete validation results by filter. At least one filter is required.
Usage:
Options:
--org-unit, --ou <str>: Org-unit UID filter. Repeatable.--period, --pe <str>: Period filter. Repeatable.--vr <str>: Validation-rule UID filter. Repeatable.--help: Show this message and exit.
d2w maintenance predictors¶
Run predictor expressions (CRUD on predictors: d2w metadata list predictors).
Usage:
Options:
--help: Show this message and exit.
Commands:
run: Run predictor expressions + emit data...
d2w maintenance predictors run¶
Run predictor expressions + emit data values for the given date range.
Usage:
Options:
--start-date <str>: Period start, YYYY-MM-DD. [required]--end-date <str>: Period end, YYYY-MM-DD. [required]--predictor <str>: Run one predictor by UID. Mutually exclusive with --group.--group <str>: Run all predictors in a PredictorGroup by UID.--help: Show this message and exit.
d2w messaging¶
DHIS2 internal messaging.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List conversations the authenticated user...list: List conversations the authenticated user...get: Show one conversation's metadata + message...send: Create a new conversation with an initial...reply: Reply to an existing conversation with a...mark-read: Mark one or more conversations as read.mark-unread: Mark one or more conversations as unread.delete: Delete a conversation (soft-delete for the...set-priority: Set a conversation's ticket-workflow...set-status: Set a conversation's ticket-workflow status.assign: Assign a conversation to a user (ticket...unassign: Remove the assignee from a conversation.
d2w messaging ls¶
List conversations the authenticated user is part of.
Usage:
Options:
--filter <str>: DHIS2 filter. Example:read:eq:falsefor unread only.--page <int>: 1-indexed page number.--page-size <int>: Rows per page (default 50).--help: Show this message and exit.
d2w messaging list¶
List conversations the authenticated user is part of.
Usage:
Options:
--filter <str>: DHIS2 filter. Example:read:eq:falsefor unread only.--page <int>: 1-indexed page number.--page-size <int>: Rows per page (default 50).--help: Show this message and exit.
d2w messaging get¶
Show one conversation's metadata + message thread.
Usage:
Arguments:
uid: Conversation UID. [required]
Options:
--help: Show this message and exit.
d2w messaging send¶
Create a new conversation with an initial message.
Usage:
Arguments:
subject: Subject line. [required]text: Message body. [required]
Options:
-u, --user <str>: User UID recipient. Repeatable.-g, --user-group <str>: User-group UID recipient. Repeatable.--org-unit, --ou <str>: Organisation-unit UID recipient. Repeatable.-a, --attachment <str>: FileResource UID to attach (upload viad2w files resources upload --domain MESSAGE_ATTACHMENTfirst). Repeatable.--help: Show this message and exit.
d2w messaging reply¶
Reply to an existing conversation with a plain-text message.
DHIS2's reply endpoint takes text/plain only on v42 — attachments +
internal-note flag only work on the initial send call.
Usage:
Arguments:
uid: Conversation UID. [required]text: Reply body (plain text). [required]
Options:
--help: Show this message and exit.
d2w messaging mark-read¶
Mark one or more conversations as read.
Usage:
Arguments:
uid...: Conversation UID(s). One or more. [required]
Options:
--help: Show this message and exit.
d2w messaging mark-unread¶
Mark one or more conversations as unread.
Usage:
Arguments:
uid...: Conversation UID(s). One or more. [required]
Options:
--help: Show this message and exit.
d2w messaging delete¶
Delete a conversation (soft-delete for the calling user; other participants keep it).
Usage:
Arguments:
uid: Conversation UID. [required]
Options:
--help: Show this message and exit.
d2w messaging set-priority¶
Set a conversation's ticket-workflow priority.
Values: NONE / LOW / MEDIUM / HIGH. Applies to any messageType — most meaningful on TICKET conversations, stored on PRIVATE threads too.
Usage:
Arguments:
uid: Conversation UID. [required]priority: Priority — NONE / LOW / MEDIUM / HIGH. [required]
Options:
--help: Show this message and exit.
d2w messaging set-status¶
Set a conversation's ticket-workflow status.
Values: NONE / OPEN / PENDING / INVALID / SOLVED. Not wired into the
initial send — DHIS2's API requires a separate POST on the
/status sub-resource.
Usage:
Arguments:
uid: Conversation UID. [required]status: Status — NONE / OPEN / PENDING / INVALID / SOLVED. [required]
Options:
--help: Show this message and exit.
d2w messaging assign¶
Assign a conversation to a user (ticket workflows).
Usage:
Arguments:
uid: Conversation UID. [required]user: User UID to assign the conversation to. [required]
Options:
--help: Show this message and exit.
d2w messaging unassign¶
Remove the assignee from a conversation.
Usage:
Arguments:
uid: Conversation UID. [required]
Options:
--help: Show this message and exit.
d2w metadata¶
DHIS2 metadata inspection.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List instances of a metadata resource.list: List instances of a metadata resource.search: Cross-resource metadata search.usage: Reverse lookup — find every object that...get: Fetch one metadata object by UID.export: Download a metadata bundle from `GET...import: Upload a metadata bundle via `POST...patch: Apply an RFC 6902 JSON Patch to a metadata...rename: Bulk-rename metadata objects by RFC 6902...retag: Bulk-rewrite ref / enum fields on metadata...share: Merge a sharing change across many UIDs of...diff: Compare two metadata bundles (or one...diff-profiles: Diff a metadata slice between two...merge: Export resources from one profile and...merge-bundle: Import a saved bundle file into a target...type: Metadata resource types (the catalog).option-sets: OptionSet workflows (get / find / sync).attributes: Cross-resource AttributeValue workflows...program-rules: Program rule workflows (get / vars-for /...sql-views: SQL view workflows (get / execute /...visualizations: Visualization authoring (get / create /...dashboards: Dashboard composition (get / add-item /...maps: Map authoring (get / create / clone /...data-elements: DataElement authoring (get / create /...data-element-groups: DataElementGroup workflows (get / members...data-element-group-sets: DataElementGroupSet workflows (get /...indicators: Indicator authoring (get / create / rename...indicator-groups: IndicatorGroup workflows (get / members /...indicator-group-sets: IndicatorGroupSet workflows (get / create...program-indicators: ProgramIndicator authoring (get / create /...program-indicator-groups: ProgramIndicatorGroup workflows (get /...category-options: CategoryOption authoring (get / create /...category-option-groups: CategoryOptionGroup workflows (get /...category-option-group-sets: CategoryOptionGroupSet workflows (get /...categories: Category authoring (get / create / rename...category-combos: CategoryCombo authoring (get / create /...category-option-combos: CategoryOptionCombo read access (get /...data-sets: DataSet authoring (get / create / rename /...sections: Section authoring (get / create / rename /...validation-rules: ValidationRule authoring (get / create /...validation-rule-groups: ValidationRuleGroup workflows (get /...predictors: Predictor authoring (get / create / rename...predictor-groups: PredictorGroup workflows (get / members /...tracked-entity-attributes: TrackedEntityAttribute authoring (get /...tracked-entity-types: TrackedEntityType authoring (get / create...programs: Program authoring (get / create / rename /...program-stages: ProgramStage authoring (get / create /...organisation-units: OrganisationUnit hierarchy workflows (get...organisation-unit-groups: OrganisationUnitGroup workflows (get /...organisation-unit-group-sets: OrganisationUnitGroupSet workflows (get /...organisation-unit-levels: OrganisationUnitLevel naming (get / rename).legend-sets: LegendSet authoring (get / create / clone...
d2w metadata ls¶
List instances of a metadata resource.
Usage:
Arguments:
resource: Resource type, e.g. dataElements, indicators [required]
Options:
--fields <str>: DHIS2 field selector: plain ('id,name'), presets (':identifiable', ':nameable', ':owner', ':all'), nested ('children'), or exclusions (':all,!lastUpdated'). [default: id,name]--filter <str>: Filter asproperty:operator:value. Repeatable — AND'd by default, use --root-junction OR. Operators: eq (exact), ilike (contains), \(ilike (starts-with), ilike\) (ends-with), token (word), gt/ge/lt/le (numbers/dates), in: (any-of), null / !null (presence); drop theifor case-sensitive. Nested paths use dots, e.g. dataSetElements.dataSet.id:eq:<uid> or categoryCombo.id:eq:<uid>. E.g. name:$ilike:anc lists names starting with 'anc'.--root-junction <str>: Combine repeated --filter as AND (default) or OR. [default: AND]--order <str>: Sort clause like 'name:asc' or 'created:desc'. Repeatable (later clauses tie-break).--page <int>: Server-side page number (1-based). With NO paging flag the FULL collection is returned; passing --page switches to paged mode (pageSize defaults to 50). Ignored when --all is set.--page-size <int>: Rows per page; applies only in paged mode (when --page/--page-size is given), default 50. Omit all paging flags to get everything. Ignored when --all is set.--all: Stream every page server-side (ignores --page/--page-size). Useful for dumping a full catalog.--translate / --no-translate: Return server-side translations for i18n fields.--locale <str>: Locale for --translate, e.g. 'fr'.--count: Print only the total number of matching items (DHIS2 pager total), not the rows. Respects --filter; ignores --fields / --page / --page-size / --all.-o, --output <path>: Write the result JSON to this file and print a one-line summary instead of the rows. Combine with --fields / --filter / --all to dump a full slice without flooding the caller.--help: Show this message and exit.
d2w metadata list¶
List instances of a metadata resource.
Usage:
Arguments:
resource: Resource type, e.g. dataElements, indicators [required]
Options:
--fields <str>: DHIS2 field selector: plain ('id,name'), presets (':identifiable', ':nameable', ':owner', ':all'), nested ('children'), or exclusions (':all,!lastUpdated'). [default: id,name]--filter <str>: Filter asproperty:operator:value. Repeatable — AND'd by default, use --root-junction OR. Operators: eq (exact), ilike (contains), \(ilike (starts-with), ilike\) (ends-with), token (word), gt/ge/lt/le (numbers/dates), in: (any-of), null / !null (presence); drop theifor case-sensitive. Nested paths use dots, e.g. dataSetElements.dataSet.id:eq:<uid> or categoryCombo.id:eq:<uid>. E.g. name:$ilike:anc lists names starting with 'anc'.--root-junction <str>: Combine repeated --filter as AND (default) or OR. [default: AND]--order <str>: Sort clause like 'name:asc' or 'created:desc'. Repeatable (later clauses tie-break).--page <int>: Server-side page number (1-based). With NO paging flag the FULL collection is returned; passing --page switches to paged mode (pageSize defaults to 50). Ignored when --all is set.--page-size <int>: Rows per page; applies only in paged mode (when --page/--page-size is given), default 50. Omit all paging flags to get everything. Ignored when --all is set.--all: Stream every page server-side (ignores --page/--page-size). Useful for dumping a full catalog.--translate / --no-translate: Return server-side translations for i18n fields.--locale <str>: Locale for --translate, e.g. 'fr'.--count: Print only the total number of matching items (DHIS2 pager total), not the rows. Respects --filter; ignores --fields / --page / --page-size / --all.-o, --output <path>: Write the result JSON to this file and print a one-line summary instead of the rows. Combine with --fields / --filter / --all to dump a full slice without flooding the caller.--help: Show this message and exit.
d2w metadata search¶
Cross-resource metadata search.
Three concurrent /api/metadata?filter=<field>:<op>:<q> calls (one
per match axis: id, code, name) merged client-side with UID dedup.
Paste whatever you have — UID, partial UID, business code, or name
fragment — to find every matching object grouped by resource.
--resource dataElements narrows to one resource kind. --fields
id,name,code,valueType asks DHIS2 for extra columns (rendered
after the standard four). --exact switches from ilike substring
to eq strict match — useful when a partial UID would otherwise
match too many siblings.
Usage:
Arguments:
query: UID, code, or name fragment to search for. [required]
Options:
--page-size <int>: Max hits per resource type (default 50). [default: 50]--resource <str>: Narrow to one DHIS2 resource (e.g. dataElements, dashboards).--fields <str>: DHIS2 fields selector; extras land on SearchHit.extras (rendered as trailing columns).--exact: Use:eq:instead of:ilike:— strict UID / code match.--help: Show this message and exit.
d2w metadata usage¶
Reverse lookup — find every object that references the given UID.
Useful as a deletion-safety check: any dataset / visualization / map /
dashboard / program that references the UID shows up in the table.
Empty result means no reference was found on any covered path, but
is not a hard proof that the UID is safe to delete — coverage is
best-effort (see _USAGE_PATTERNS in the client).
Internally: resolves the UID's owning resource via
/api/identifiableObjects/{uid} first, then fans out concurrent
/api/<target>?filter=<path>:eq:<uid> calls over every known
reference-shape for that owning type.
Usage:
Arguments:
uid: UID to reverse-lookup — find every object that references it. [required]
Options:
--page-size <int>: Max hits per reference path (default 100). [default: 100]--help: Show this message and exit.
d2w metadata get¶
Fetch one metadata object by UID.
Prints a concise Rich summary by default (id, name, code, common metadata +
notable extras). Use --json for the full payload when debugging or
piping into jq. Pass --fields to narrow what DHIS2 returns.
Usage:
Arguments:
resource: Resource type, e.g. dataElements [required]uid: Object UID [required]
Options:
--fields <str>: DHIS2 fields selector.--help: Show this message and exit.
d2w metadata export¶
Download a metadata bundle from GET /api/metadata.
Prints a per-resource count summary to stderr so stdout stays pipe-friendly
when --output is omitted. With --check-references (default), walks the
exported bundle and warns on any reference to a UID not in the bundle —
so a filtered --resource dataElements export doesn't silently produce a
bundle that won't round-trip because categoryCombos / optionSets / ...
are missing.
Usage:
Options:
--resource <str>: Resource type to include (repeatable). Omit for every type DHIS2 exports by default.--fields <str>: DHIS2 field selector. Defaults to ':owner' for a lossless round-trip import. [default: :owner]--filter <str>: Per-resource filter in the formRESOURCE:property:operator:value. Repeatable. Example:--filter dataElements:name:like:ANC. Same DSL asd2w metadata list --filter, prefixed with the resource name.--resource-fields <str>: Per-resource field selector in the formRESOURCE:SELECTOR. Repeatable. Overrides the global--fieldsfor the named resource. Example:--resource-fields dataElements::identifiable.--skip-sharing: Exclude sharing blocks from exported objects.--skip-translation: Exclude translation blocks.--skip-validation: Skip validation during export (matches DHIS2's server-side option).--check-references / --no-check-references: After export, walk the bundle and warn on references to UIDs not in the bundle (e.g. a dataElement's categoryCombo missing from a filtered export). On by default. [default: check-references]-o, --output <path>: Write the bundle to this file (JSON). A full-catalog export is tens of MB (org-unit geometry) — prefer this; omitting prints the whole bundle to stdout.--pretty / --no-pretty: Indent JSON output (default: pretty). [default: pretty]--help: Show this message and exit.
d2w metadata import¶
Upload a metadata bundle via POST /api/metadata and print the import report.
Usage:
Arguments:
file: Path to the metadata bundle JSON. [required]
Options:
--strategy <str>: CREATE | UPDATE | CREATE_AND_UPDATE | DELETE (default CREATE_AND_UPDATE). [default: CREATE_AND_UPDATE]--atomic-mode <str>: ALL (rollback on any failure) or NONE (commit surviving objects). [default: ALL]--dry-run: Validate + preheat without committing. Output is the import report DHIS2 would have produced.--identifier <str>: UID | CODE | AUTO (default UID). [default: UID]--skip-sharing--skip-translation--skip-validation--merge-mode <str>: REPLACE (overwrite) or MERGE (patch) existing objects.--preheat-mode <str>: REFERENCE (default), ALL, or NONE.--flush-mode <str>: AUTO (default) or OBJECT.--help: Show this message and exit.
d2w metadata patch¶
Apply an RFC 6902 JSON Patch to a metadata object (PATCH /api/<resource>/{uid}).
Two input modes:
--file patch.json— full patch array on disk, one op per entry:[{"op": "replace", "path": "/name", "value": "New"}, ...]--set path=value/--remove path(each repeatable) — inline shorthand for the common replace/remove cases. Values parse as JSON when possible (so--set /valueType=INTEGERsends a string,--set /disabled=truesends a boolean).
Usage:
Arguments:
resource: Resource type, e.g. dataElements, indicators. [required]uid: UID of the object to patch. [required]
Options:
--file <path>: JSON file with a RFC 6902 patch array. Mutually exclusive with --set/--remove.--set <str>: Inlinereplaceop aspath=value. Repeatable. Values are JSON-decoded when they parse as JSON ({"a":1},true,42) and treated as strings otherwise.--remove <str>: Inlineremoveop aspath. Repeatable.--help: Show this message and exit.
d2w metadata rename¶
Bulk-rename metadata objects by RFC 6902 patch.
Fans out concurrent PATCH /api/<resource>/{uid} requests via the
shared client.metadata.patch_bulk primitive (#187); per-UID
failures render through the same conflict table used by
metadata import instead of raising. Prefix / suffix flags are
idempotent — re-running won't double-prefix already-prefixed
objects.
Use --dry-run to preview which objects match + what the
before/after labels would be, then drop the flag to apply.
Usage:
Arguments:
resource: Resource type, e.g. dataElements, indicators. [required]
Options:
--filter <str>: DHIS2 filter DSL (<prop>:<op>:<value>), repeatable. Example:--filter code:like:DE_ANCto narrow the cohort.--root-junction <str>: Combine repeated --filter as AND (default) or OR.--name-prefix <str>: Prefix each matched object'sname(idempotent).--name-suffix <str>: Suffix each matched object'sname(idempotent).--name-strip-prefix <str>: Remove this non-empty prefix from each matched object'sname(idempotent; no-op when absent).--name-strip-suffix <str>: Remove this non-empty suffix from each matched object'sname(idempotent; no-op when absent).--short-name-prefix <str>: Prefix each matched object'sshortName(idempotent).--short-name-suffix <str>: Suffix each matched object'sshortName(idempotent).--short-name-strip-prefix <str>: Remove this non-empty prefix from each matched object'sshortName(idempotent).--short-name-strip-suffix <str>: Remove this non-empty suffix from each matched object'sshortName(idempotent).--set-description <str>: Replace every matched object'sdescriptionwith this string.--concurrency <int>: Max concurrent PATCH requests (default 8). [default: 8]--dry-run: Preview the planned patches without sending them.--all: Opt into renaming EVERY object when no --filter is given (asks to confirm).-y, --yes: Skip the confirmation prompt for a catalog-wide (--all) rename.--help: Show this message and exit.
d2w metadata retag¶
Bulk-rewrite ref / enum fields on metadata objects.
Sister verb to metadata rename. Flags map to RFC 6902 patches:
--category-combo <uid> → replace /categoryCombo, --option-set
<uid> → replace /optionSet, --clear-option-set → remove
/optionSet, --aggregation-type TYPE → replace
/aggregationType, --legend-set <uid> (repeatable) → replace
/legendSets with the whole list, --clear-legend-sets → empty
that list. Stack multiple flags in one invocation.
Per-UID failures render through the shared ConflictRow renderer
— e.g. --domain-type TRACKER against an Indicator surfaces as
409s instead of raising.
Usage:
Arguments:
resource: Resource type, e.g. dataElements, indicators. [required]
Options:
--filter <str>: DHIS2 filter DSL (<prop>:<op>:<value>), repeatable.--root-junction <str>: Combine repeated --filter as AND (default) or OR.--category-combo <str>: Replace/categoryCombowith the given CategoryCombo UID.--option-set <str>: Replace/optionSetwith the given OptionSet UID.--clear-option-set: Remove/optionSet(null out the ref).--aggregation-type <str>: Replace/aggregationType(e.g. SUM, AVERAGE).--domain-type <str>: Replace/domainType(AGGREGATE / TRACKER).--legend-set <str>: Replace/legendSetswith the given UIDs (repeatable).--clear-legend-sets: Empty/legendSets.--concurrency <int>: Max concurrent PATCH requests (default 8). [default: 8]--dry-run: Preview without sending patches.--all: Opt into retagging EVERY object when no --filter is given (asks to confirm).-y, --yes: Skip the confirmation prompt for a catalog-wide (--all) retag.--help: Show this message and exit.
d2w metadata share¶
Merge a sharing change across many UIDs of one resource.
Read-merge-write: each UID's current sharing block is fetched first,
the new grants are merged into the existing ones (existing grants are
preserved; a grant for an already-granted UID replaces its access
string), and --public-access only changes publicAccess when given.
Per-UID failures render through the same row table used by
metadata rename instead of raising.
Use --dry-run to preview the merged sharing per UID, then drop the
flag to apply. UIDs come from positional args or stdin (-); pipe from
d2w --json metadata list ... | jq -r '.[].id' to filter-then-share without
leaving the shell.
Usage:
Arguments:
resource_type: DHIS2 resource type — singular or plural, e.g.dataElement/dataElements,dataSet/dataSets,program. Normalized to the singular/api/sharing?type=form. [required]uids...: UIDs to share. Pass-to read one UID per line from stdin.
Options:
--public-access <str>: Replace the public-access string. 8-char DHIS2 pattern (rwrw----,r-------,--------). Omit to keep each object's current public access unchanged.--user-access <str>: Repeatable; grant a user access inUID:accessform (e.g.U_ALICE:rw------).--user-group-access <str>: Repeatable; grant a user-group access inUID:accessform.--concurrency <int>: Max concurrent POSTs (default 8). [default: 8]--dry-run: Preview the planned grants without sending them.--help: Show this message and exit.
d2w metadata diff¶
Compare two metadata bundles (or one bundle against the live instance).
Per-resource counts of create/update/delete. Objects that differ only on
DHIS2's per-instance noise (lastUpdated, createdBy, etc.) are treated as
unchanged by default — --ignore extends that list.
Usage:
Arguments:
left: Left-hand bundle — the 'source of truth' you're comparing against. [required]right: Right-hand bundle. Omit with--liveto diff against the connected DHIS2 instance.
Options:
--live: Use the connected DHIS2 instance as the right-hand side. Exports only the resource types present in the left bundle (no full-catalog fetch). Incompatible with a positional right arg.--show-uids: List up to 5 offending UIDs per per-resource row.--ignore <str>: Fields to skip when deciding if an object changed. Repeatable. Defaults cover DHIS2's per-instance noise (lastUpdated, createdBy, access, ...); pass--ignore sharingetc. to extend.--help: Show this message and exit.
d2w metadata diff-profiles¶
Diff a metadata slice between two registered profiles (staging vs prod drift).
Runs both exports in parallel, narrows to --resource types, optionally
filters each resource (--filter resource:prop:op:val), then structurally
diffs the two bundles ignoring DHIS2's per-instance noise
(timestamps, createdBy, access strings, …).
A whole-instance diff is almost never useful — staging and prod diverge on
user accounts, org-unit assignments, and incidental settings by design. Pick
a narrow resource slice (-r dataElements -r indicators), filter further
with --filter, and extend --ignore for anything else that's expected to
differ.
Exit code is 0 by default regardless of drift (so operators running this
interactively aren't tripped by per-command-exit conventions). Pass
--exit-on-drift for the CI shape.
Usage:
Arguments:
profile_a: Name of the 'left' profile (source of truth). [required]profile_b: Name of the 'right' profile (candidate). [required]
Options:
-r, --resource <str>: Resource type to compare (e.g. dataElements, indicators). Repeatable. Required — whole-instance diffs are almost always noise.--filter <str>: Per-resource filter inresource:property:operator:valueform. Repeatable. Example:--filter dataElements:name:like:ANConly compares data elements whose name contains 'ANC'. Same DHIS2 filter DSL asd2w metadata list --filter.--fields <str>: DHIS2 field selector applied on both profiles. Defaults to ':owner' — the selector DHIS2 itself uses for cross-instance imports (preserves every field needed for a faithful round-trip). [default: :owner]--ignore <str>: Additional fields to skip when deciding if an object changed. Repeatable. Defaults already cover DHIS2's per-instance noise (lastUpdated, createdBy, access, ...). Common extensions for drift checks:--ignore sharing --ignore translations.--show-uids: List up to 5 offending UIDs per per-resource row.--exit-on-drift: Exit 1 when any object differs. CI-friendly (default is always exit 0).--help: Show this message and exit.
d2w metadata merge¶
Export resources from one profile and import them into another.
Pairs with d2w metadata diff-profiles (which reads the same shape
of narrow resource slice + filters). Preview first with
diff-profiles, then apply the same --resource + --filter args
through merge to land the changes on the target.
Require --resource — a whole-instance merge would overwrite users,
org units, and incidental settings that staging and prod routinely
differ on for non-drift reasons.
--dry-run flips the target import into importMode=VALIDATE.
DHIS2 walks the bundle, reports conflicts + stats, and commits
nothing. Use to catch "this object references a user UID that
doesn't exist on the target" before the real run.
Usage:
Arguments:
source_profile: Source profile — the--fromside of the merge. [required]target_profile: Target profile — where the source's resources land. [required]
Options:
-r, --resource <str>: Resource type to merge (e.g. dataElements, indicators). Repeatable. Required — whole-instance merges are almost never what you want.--filter <str>: Per-resource filter inresource:property:operator:valueform. Repeatable. Same DSL asd2w metadata list --filterandd2w metadata diff-profiles.--fields <str>: DHIS2 field selector applied on the source export. Defaults to ':owner' (faithful round-trip). [default: :owner]--strategy <str>: Import strategy — CREATE / UPDATE / CREATE_AND_UPDATE / DELETE (default: CREATE_AND_UPDATE). [default: CREATE_AND_UPDATE]--atomic <str>: atomicMode — ALL / NONE (default: ALL; one broken object aborts the whole import). [default: ALL]--include-sharing / --skip-sharing: Carry sharing blocks across. OFF by default — different instances typically have different user / group UIDs and sharing imports fail with false-positive conflicts. [default: skip-sharing]--dry-run: SendimportMode=VALIDATEto the target; reports conflicts + counts without committing.--help: Show this message and exit.
d2w metadata merge-bundle¶
Import a saved bundle file into a target profile.
The bundle-source variant of d2w metadata merge: instead of
exporting from a source profile, read the bundle from disk. Useful
when the bundle came from a saved metadata export, was hand-crafted
by an operator, or was produced by a non-DHIS2 tool. All other
semantics match merge — atomic + sharing skipped by default,
--dry-run flips to importMode=VALIDATE.
Usage:
Arguments:
target_profile: Target profile — where the bundle's resources land. [required]bundle: Path to a JSON metadata bundle (the shapeGET /api/metadatareturns). [required]
Options:
-r, --resource <str>: Resource type to import from the bundle (e.g. dataElements). Repeatable. The bundle is filtered to these collections before the POST, so the count summary reports exactly what was written. Optional — when omitted, the whole bundle is imported.--strategy <str>: Import strategy — CREATE / UPDATE / CREATE_AND_UPDATE / DELETE (default: CREATE_AND_UPDATE). [default: CREATE_AND_UPDATE]--atomic <str>: atomicMode — ALL / NONE (default: ALL; one broken object aborts the whole import). [default: ALL]--include-sharing / --skip-sharing: Carry sharing blocks across. OFF by default — different instances typically have different user / group UIDs and sharing imports fail with false-positive conflicts. [default: skip-sharing]--dry-run: SendimportMode=VALIDATEto the target; reports conflicts + counts without committing.--help: Show this message and exit.
d2w metadata type¶
Metadata resource types (the catalog).
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List the metadata resource types exposed...list: List the metadata resource types exposed...
d2w metadata type ls¶
List the metadata resource types exposed by the connected DHIS2 instance.
Usage:
Options:
--help: Show this message and exit.
d2w metadata type list¶
List the metadata resource types exposed by the connected DHIS2 instance.
Usage:
Options:
--help: Show this message and exit.
d2w metadata option-sets¶
OptionSet workflows (get / find / sync).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one OptionSet with its options...find: Locate a single option inside a set by...create: Create an OptionSet (then add its options...delete: Delete an OptionSet by UID.sync: Idempotently sync an OptionSet to match a...attributes: External-system code mapping on Options...
d2w metadata option-sets get¶
Show one OptionSet with its options resolved inline.
Usage:
Arguments:
uid_or_code: OptionSet UID (11 chars) or business code. [required]
Options:
--help: Show this message and exit.
d2w metadata option-sets find¶
Locate a single option inside a set by code or name; exit 1 if no match.
Usage:
Options:
--set <str>: OptionSet UID or business code. [required]--code <str>: Business code of the option to locate.--name <str>: Display name of the option (exact match).--help: Show this message and exit.
d2w metadata option-sets create¶
Create an OptionSet (then add its options with options sync).
Usage:
Options:
--name <str>: OptionSet name. [required]--value-type <str>: DHIS2 ValueType, e.g. TEXT / NUMBER / INTEGER. [required]--code <str>: Business code.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata option-sets delete¶
Delete an OptionSet by UID.
Usage:
Arguments:
uid: OptionSet UID. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w metadata option-sets sync¶
Idempotently sync an OptionSet to match a JSON spec file.
The spec is a JSON array of {code, name, sort_order?} objects. Codes
not currently in the set get added; codes present but with changed
names or sort order get updated; exact matches are skipped.
Pass --remove-missing to also drop options whose code isn't in the
spec. --dry-run previews the diff without writing.
Usage:
Arguments:
set_ref: OptionSet UID or business code. [required]spec_file: JSON file — list of{code, name, sort_order?}objects. [required]
Options:
--remove-missing: Also delete options whose code isn't in the spec. Off by default — safer for partial refreshes.--dry-run: Compute the diff without writing anything.--help: Show this message and exit.
d2w metadata option-sets attributes¶
External-system code mapping on Options via Attribute values.
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Read one attribute value off an Option;...set: Set / replace an attribute value on an...find: Reverse lookup — find the Option whose...
d2w metadata option-sets attributes get¶
Read one attribute value off an Option; exit 1 if unset.
Usage:
Arguments:
option_uid: Option UID (11 chars). [required]attribute: Attribute UID or business code (e.g. 'SNOMED_CODE'). [required]
Options:
--help: Show this message and exit.
d2w metadata option-sets attributes set¶
Set / replace an attribute value on an Option.
Reads the full Option, merges the new value (replaces any prior value for the same attribute UID), PUTs the payload back. DHIS2's attribute-value list is identity-keyed by attribute UID, so this is idempotent — calling twice with the same value is a no-op.
Usage:
Arguments:
option_uid: Option UID (11 chars). [required]attribute: Attribute UID or business code (e.g. 'SNOMED_CODE'). [required]value: New attribute value. [required]
Options:
--help: Show this message and exit.
d2w metadata option-sets attributes find¶
Reverse lookup — find the Option whose attribute matches a value.
The killer integration helper: external systems know a SNOMED / ICD / LOINC code; this command returns the DHIS2 Option it maps to. Exits 1 on miss with a stderr hint.
Usage:
Options:
--set <str>: OptionSet UID or business code. [required]--attribute <str>: Attribute UID or business code (e.g. 'SNOMED_CODE'). [required]--value <str>: Attribute value to match exactly. [required]--help: Show this message and exit.
d2w metadata attributes¶
Cross-resource AttributeValue workflows (get / set / delete / find).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Read one attribute value off any resource;...set: Set / replace one attribute value on any...delete: Remove one attribute value from any...find: Reverse lookup across any resource — list...
d2w metadata attributes get¶
Read one attribute value off any resource; exit 1 if unset.
Usage:
Arguments:
resource: Plural DHIS2 resource name (e.g.dataElements,options,organisationUnits). [required]resource_uid: UID of the resource instance. [required]attribute: Attribute UID or business code (e.g.ICD10_CODE). [required]
Options:
--help: Show this message and exit.
d2w metadata attributes set¶
Set / replace one attribute value on any resource (read-merge-write).
Usage:
Arguments:
resource: Plural DHIS2 resource name. [required]resource_uid: UID of the resource instance. [required]attribute: Attribute UID or business code. [required]value: New attribute value. [required]
Options:
--help: Show this message and exit.
d2w metadata attributes delete¶
Remove one attribute value from any resource; exit 0 regardless of whether it existed.
Usage:
Arguments:
resource: Plural DHIS2 resource name. [required]resource_uid: UID of the resource instance. [required]attribute: Attribute UID or business code. [required]
Options:
--help: Show this message and exit.
d2w metadata attributes find¶
Reverse lookup across any resource — list every UID whose attribute value matches.
Returns UIDs only (one per line) to keep the helper generic across
resource types. Pipe into d2w metadata get <resource> <uid> or
d2w metadata list <resource> --filter id:in:[...] for typed
follow-ups.
Usage:
Arguments:
resource: Plural DHIS2 resource name. [required]attribute: Attribute UID or business code. [required]value: Attribute value to match exactly. [required]
Options:
--filter <str>: Extra DHIS2 filter constraints to narrow the search (e.g.domainType:eq:AGGREGATE). Repeatable.--help: Show this message and exit.
d2w metadata program-rules¶
Program rule workflows (get / vars-for / validate / where-de-is-used).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one ProgramRule with its condition,...vars-for: List everyProgramRuleVariablein scope...validate-expression: Parse-check a program-rule condition...where-de-is-used: Impact analysis — list every rule whose...
d2w metadata program-rules get¶
Show one ProgramRule with its condition, priority, and every action.
Usage:
Arguments:
rule_uid: ProgramRule UID. [required]
Options:
--help: Show this message and exit.
d2w metadata program-rules vars-for¶
List every ProgramRuleVariable in scope for a program, sorted by name.
Usage:
Arguments:
program_uid: Program UID. [required]
Options:
--help: Show this message and exit.
d2w metadata program-rules validate-expression¶
Parse-check a program-rule condition expression.
DHIS2 doesn't expose a dedicated program-rule expression validator —
the closest is the program-indicator parser (used by default here),
which enforces stricter #{stage.de} syntax than program rules
accept. For the common #{variableName} shorthand program rules
use, the PI validator flags "Invalid Program Stage / DataElement
syntax" — not a real error, just the parser mismatch. Trust a clean
OK as definitely valid; read the specific message on ERROR to
distinguish parser mismatches from real syntax problems.
Usage:
Arguments:
expression: Program-rule condition expression. [required]
Options:
--context <str>: Which DHIS2 expression parser to use: program-indicator (default), validation-rule, indicator, predictor, or generic. [default: program-indicator]--help: Show this message and exit.
d2w metadata program-rules where-de-is-used¶
Impact analysis — list every rule whose actions reference this DataElement.
Useful before renaming / removing a DE: catches rules that'd stop
firing once the reference breaks. Exit 1 if nothing matches (safe
shorthand for grep -q pipelines).
Usage:
Arguments:
data_element_uid: DataElement UID. [required]
Options:
--help: Show this message and exit.
d2w metadata sql-views¶
SQL view workflows (get / execute / refresh / adhoc).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one SqlView's metadata + its stored...execute: Run a SqlView and render its rows as a...refresh: Refresh a MATERIALIZED_VIEW or lazily...adhoc: Register a throwaway SqlView from a .sql...
d2w metadata sql-views get¶
Show one SqlView's metadata + its stored SQL body.
Usage:
Arguments:
view_uid: SqlView UID. [required]
Options:
--help: Show this message and exit.
d2w metadata sql-views execute¶
Run a SqlView and render its rows as a table, JSON array, or CSV.
Usage:
Arguments:
view_uid: SqlView UID. [required]
Options:
--var <str>:${name}substitution for QUERY views, inname:valueform. Repeatable. DHIS2 strips non-alphanumeric characters from values server-side — wildcards belong in the SQL.--criteria <str>: Column filter for VIEW / MATERIALIZED_VIEW results, incolumn:valueform. Repeatable.--format <str>: Output format: table (default), json, or csv. [default: table]--help: Show this message and exit.
d2w metadata sql-views refresh¶
Refresh a MATERIALIZED_VIEW or lazily create a VIEW's DB object.
POST /api/sqlViews/{uid}/execute is idempotent for VIEW types — the
first call creates the Postgres view; subsequent calls are no-ops.
MATERIALIZED_VIEW types re-run the underlying SQL each call.
Usage:
Arguments:
view_uid: SqlView UID. [required]
Options:
--help: Show this message and exit.
d2w metadata sql-views adhoc¶
Register a throwaway SqlView from a .sql file, execute once, delete it on the way out.
Designed for iterating on SQL without leaving test metadata behind. Subject to DHIS2's SQL allowlist — for fully free-form queries, see the Postgres injector example.
Usage:
Arguments:
name: Display name for the throwaway view. [required]sql_path: .sql file containing the query body. [required]
Options:
--type <str>: SqlViewType — QUERY (default), VIEW, or MATERIALIZED_VIEW. [default: QUERY]--keep: Leave the view in place afterwards instead of deleting.--var <str>:${name}substitution inname:valueform. Repeatable.--format <str>: Output format: table (default), json, or csv. [default: table]--help: Show this message and exit.
d2w metadata visualizations¶
Visualization authoring (get / create / clone / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Visualization with axes + data...create: Create a Visualization from flags — one...clone: Clone an existing Visualization with a...delete: Delete a Visualization.
d2w metadata visualizations get¶
Show one Visualization with axes + data dimensions + period / ou selection.
Usage:
Arguments:
viz_uid: Visualization UID. [required]
Options:
--help: Show this message and exit.
d2w metadata visualizations create¶
Create a Visualization from flags — one command, no hand-rolled JSON.
Uses VisualizationSpec defaults per chart type: LINE / COLUMN / BAR /
etc. default to rows= / columns= / filters=; PIVOT_TABLE
defaults to rows= / columns= / filters=; SINGLE_VALUE
collapses to columns= / filters=. Override any slot with
--category-dim / --series-dim / --filter-dim.
Usage:
Options:
--name <str>: Display name for the new Visualization. [required]--type <str>: VisualizationType: LINE, COLUMN, STACKED_COLUMN, BAR, PIVOT_TABLE, SINGLE_VALUE, etc. [required]--data-element, --de <str>: DataElement UID (repeat for multi-DE charts). [required]--period, --pe <str>: Period ID (e.g. 202401, 2024Q1, 2024). Repeat for multi-period. [required]--org-unit, --ou <str>: OrganisationUnit UID. Repeat for multi-OU. [required]--description <str>: Optional long description.--uid <str>: Explicit UID (11 chars). Auto-generates when omitted.--category-dim <str>: Override category axis: dx / pe / ou.--series-dim <str>: Override series dimension: dx / pe / ou.--filter-dim <str>: Override filter dimension: dx / pe / ou.--help: Show this message and exit.
d2w metadata visualizations clone¶
Clone an existing Visualization with a fresh UID + new name.
Usage:
Arguments:
source_uid: Source Visualization UID. [required]
Options:
--new-name <str>: Display name for the cloned Visualization. [required]--new-uid <str>: Explicit UID for the clone (11 chars). Auto-generates when omitted.--new-description <str>: Override the source's description on the clone.--help: Show this message and exit.
d2w metadata visualizations delete¶
Delete a Visualization.
Usage:
Arguments:
viz_uid: Visualization UID to delete. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w metadata dashboards¶
Dashboard composition (get / add-item / remove-item).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Dashboard with every...add-item: Add a Visualization or Map item to a...remove-item: Remove one dashboardItem by its UID.
d2w metadata dashboards get¶
Show one Dashboard with every dashboardItem resolved inline.
Usage:
Arguments:
dashboard_uid: Dashboard UID. [required]
Options:
--help: Show this message and exit.
d2w metadata dashboards add-item¶
Add a Visualization or Map item to a dashboard.
Pass --viz to add a VISUALIZATION item or --map to add a MAP item (exactly one required). Omit --x / --y / --width / --height to auto-stack below existing items (full width); supply them when you want side-by-side tiling.
Usage:
Arguments:
dashboard_uid: Dashboard UID. [required]
Options:
--viz <str>: Visualization UID (mutually exclusive with --map).--map <str>: Map UID to add as a MAP-type dashboard item.--x <int>: Grid x coordinate (0-60). Auto-stacks when omitted.--y <int>: Grid y coordinate. Auto-stacks below existing when omitted.--width <int>: Slot width (1-60). Defaults to 60 when auto.--height <int>: Slot height. Defaults to 20 when auto.--help: Show this message and exit.
d2w metadata dashboards remove-item¶
Remove one dashboardItem by its UID.
Usage:
Arguments:
dashboard_uid: Dashboard UID. [required]item_uid: DashboardItem UID to remove. [required]
Options:
--help: Show this message and exit.
d2w metadata maps¶
Map authoring (get / create / clone / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Map with its viewport + every...create: Create a single-layer thematic choropleth...clone: Clone an existing Map with a fresh UID +...delete: Delete a Map.
d2w metadata maps get¶
Show one Map with its viewport + every mapViews layer.
Usage:
Arguments:
map_uid: Map UID. [required]
Options:
--help: Show this message and exit.
d2w metadata maps create¶
Create a single-layer thematic choropleth Map from flags.
Multi-layer maps need raw Map / MapView construction — use
client.maps.create_from_spec(MapSpec(layers=[...])) from the
library side and extend the spec to include boundary / facility
/ event layers.
Usage:
Options:
--name <str>: Display name for the new Map. [required]--data-element, --de <str>: DataElement UID for the thematic layer. [required]--period, --pe <str>: Period ID. Repeat for multi-period. [required]--org-unit, --ou <str>: OrganisationUnit UID (usually the parent boundary). Repeat for multi. [required]--ou-level <int>: OU hierarchy level(s) to render (e.g. 2 for provinces). Repeat for multi. [required]--description <str>--uid <str>: Explicit UID (11 chars). Auto-generates when omitted.--longitude <float>: [default: 15.0]--latitude <float>: [default: 0.0]--zoom <int>: [default: 4]--basemap <str>: [default: openStreetMap]--classes <int>: Number of color classes on the choropleth. [default: 5]--color-low <str>: Choropleth low-value colour (#hex). [default: #fef0d9]--color-high <str>: Choropleth high-value colour (#hex). [default: #b30000]--help: Show this message and exit.
d2w metadata maps clone¶
Clone an existing Map with a fresh UID + new name.
Usage:
Arguments:
source_uid: Source Map UID. [required]
Options:
--new-name <str>: Display name for the cloned Map. [required]--new-uid <str>: Explicit UID for the clone.--new-description <str>--help: Show this message and exit.
d2w metadata maps delete¶
Delete a Map.
Usage:
Arguments:
map_uid: Map UID to delete. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w metadata data-elements¶
DataElement authoring (get / create / rename / delete + legend-sets).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one DataElement with its references...create: Create a DataElement (defaults aggregate +...rename: Partial-update the label fields on a...set-legend-sets: Replace the legend-set refs on one...delete: Delete a DataElement — DHIS2 rejects...
d2w metadata data-elements get¶
Show one DataElement with its references resolved inline.
Usage:
Arguments:
uid: DataElement UID. [required]
Options:
--help: Show this message and exit.
d2w metadata data-elements create¶
Create a DataElement (defaults aggregate + SUM + instance default categoryCombo).
Usage:
Options:
--name <str>: Full name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--value-type <str>: DHIS2 ValueType, e.g. NUMBER / TEXT / INTEGER_POSITIVE. [required]--domain-type <str>: AGGREGATE or TRACKER. [default: AGGREGATE]--aggregation-type <str>: Default SUM. [default: SUM]--category-combo <str>: CategoryCombo UID (defaults to the instance default).--option-set <str>: OptionSet UID.--legend-set <str>: LegendSet UID. Repeat for multiple.--code <str>: Business code.--form-name <str>: Form name override.--description <str>: Free text.--uid <str>: Explicit 11-char UID.--zero-significant / --no-zero-significant: Treat 0 as data, not absence. [default: no-zero-significant]--help: Show this message and exit.
d2w metadata data-elements rename¶
Partial-update the label fields on a DataElement (read, mutate, PUT).
Usage:
Arguments:
uid: DataElement UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--form-name <str>: New form name.--description <str>: New description.--help: Show this message and exit.
d2w metadata data-elements set-legend-sets¶
Replace the legend-set refs on one DataElement.
Usage:
Arguments:
uid: DataElement UID. [required]
Options:
--legend-set <str>: LegendSet UID to attach. Repeat for multiple. Empty list clears. [required]--help: Show this message and exit.
d2w metadata data-elements delete¶
Delete a DataElement — DHIS2 rejects deletes on DEs with saved values.
Usage:
Arguments:
uid: DataElement UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata data-element-groups¶
DataElementGroup workflows (get / members / create / add-members / remove-members / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group with its member refs and...members: Page through DataElements inside one group.create: Create an empty DataElementGroup.add-members: Add--data-elementmembers via the...remove-members: Drop--data-elementmembers via the...delete: Delete the grouping row — member DEs stay.
d2w metadata data-element-groups get¶
Show one group with its member refs and group-sets it belongs to.
Usage:
Arguments:
uid: DataElementGroup UID. [required]
Options:
--help: Show this message and exit.
d2w metadata data-element-groups members¶
Page through DataElements inside one group.
Usage:
Arguments:
uid: DataElementGroup UID. [required]
Options:
--page <int>: 1-based page number. [default: 1]--page-size <int>: Rows per page. [default: 50]--help: Show this message and exit.
d2w metadata data-element-groups create¶
Create an empty DataElementGroup.
Usage:
Options:
--name <str>: Full name. [required]--short-name <str>: Short name. [required]--uid <str>: Explicit 11-char UID.--code <str>: Business code.--description <str>: Free text.--help: Show this message and exit.
d2w metadata data-element-groups add-members¶
Add --data-element members via the per-item POST shortcut.
Usage:
Arguments:
uid: DataElementGroup UID. [required]
Options:
-e, --data-element <str>: DataElement UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata data-element-groups remove-members¶
Drop --data-element members via the per-item DELETE shortcut.
Usage:
Arguments:
uid: DataElementGroup UID. [required]
Options:
-e, --data-element <str>: DataElement UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata data-element-groups delete¶
Delete the grouping row — member DEs stay.
Usage:
Arguments:
uid: DataElementGroup UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata data-element-group-sets¶
DataElementGroupSet workflows (get / create / add-groups / remove-groups / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group set with its groups.create: Create an empty DataElementGroupSet.add-groups: Add--groupmembers to a group set.remove-groups: Drop--groupmembers from a group set.delete: Delete a DataElementGroupSet — member...
d2w metadata data-element-group-sets get¶
Show one group set with its groups.
Usage:
Arguments:
uid: DataElementGroupSet UID. [required]
Options:
--help: Show this message and exit.
d2w metadata data-element-group-sets create¶
Create an empty DataElementGroupSet.
Usage:
Options:
--name <str>: Full name. [required]--short-name <str>: Short name. [required]--uid <str>: Explicit 11-char UID.--code <str>: Business code.--description <str>: Free text.--compulsory / --not-compulsory: Require DEs to land in exactly one member group. [default: not-compulsory]--data-dimension / --no-data-dimension: Expose as analytics axis. [default: data-dimension]--help: Show this message and exit.
d2w metadata data-element-group-sets add-groups¶
Add --group members to a group set.
Usage:
Arguments:
uid: DataElementGroupSet UID. [required]
Options:
--group <str>: DataElementGroup UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata data-element-group-sets remove-groups¶
Drop --group members from a group set.
Usage:
Arguments:
uid: DataElementGroupSet UID. [required]
Options:
--group <str>: DataElementGroup UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata data-element-group-sets delete¶
Delete a DataElementGroupSet — member groups stay.
Usage:
Arguments:
uid: DataElementGroupSet UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata indicators¶
Indicator authoring (get / create / rename / validate-expression / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Indicator with expression pair +...create: Create an Indicator from a numerator /...rename: Partial-update label fields on an Indicator.validate-expression: Parse-check one indicator expression —...set-legend-sets: Replace the legend-set refs on one Indicator.delete: Delete an Indicator — DHIS2 rejects...
d2w metadata indicators get¶
Show one Indicator with expression pair + indicatorType resolved inline.
Usage:
Arguments:
uid: Indicator UID. [required]
Options:
--help: Show this message and exit.
d2w metadata indicators create¶
Create an Indicator from a numerator / denominator expression pair.
Usage:
Options:
--name <str>: Full name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--indicator-type <str>: IndicatorType UID (pins the output scale). [required]--numerator <str>: DHIS2 numerator expression, e.g. '#{deUid}'. [required]--denominator <str>: DHIS2 denominator expression. [required]--numerator-desc <str>: Human label for the numerator.--denominator-desc <str>: Human label for the denominator.--legend-set <str>: LegendSet UID. Repeat for multiple.--annualized / --not-annualized: Multiply by 365 / period days on aggregation. [default: not-annualized]--decimals <int>: Rendered decimal places.--code <str>: Business code.--description <str>: Free text.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata indicators rename¶
Partial-update label fields on an Indicator.
Usage:
Arguments:
uid: Indicator UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--description <str>: New description.--help: Show this message and exit.
d2w metadata indicators validate-expression¶
Parse-check one indicator expression — fast pre-flight before create.
Usage:
Arguments:
expression: Numerator / denominator expression to validate. [required]
Options:
--help: Show this message and exit.
d2w metadata indicators set-legend-sets¶
Replace the legend-set refs on one Indicator.
Usage:
Arguments:
uid: Indicator UID. [required]
Options:
--legend-set <str>: LegendSet UID to attach. Empty list clears. [required]--help: Show this message and exit.
d2w metadata indicators delete¶
Delete an Indicator — DHIS2 rejects deletes on indicators used in viz/dashboards.
Usage:
Arguments:
uid: Indicator UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata indicator-groups¶
IndicatorGroup workflows (get / members / create / add-members / remove-members / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group with its member refs.members: Page through Indicators inside one group.create: Create an empty IndicatorGroup.add-members: Add--indicatormembers via the per-item...remove-members: Drop--indicatormembers via the...delete: Delete the grouping row — member...
d2w metadata indicator-groups get¶
Show one group with its member refs.
Usage:
Arguments:
uid: IndicatorGroup UID. [required]
Options:
--help: Show this message and exit.
d2w metadata indicator-groups members¶
Page through Indicators inside one group.
Usage:
Arguments:
uid: IndicatorGroup UID. [required]
Options:
--page <int>: 1-based page number. [default: 1]--page-size <int>: Rows per page. [default: 50]--help: Show this message and exit.
d2w metadata indicator-groups create¶
Create an empty IndicatorGroup.
Usage:
Options:
--name <str>: Full name. [required]--short-name <str>: Short name. [required]--uid <str>: Explicit 11-char UID.--code <str>: Business code.--description <str>: Free text.--help: Show this message and exit.
d2w metadata indicator-groups add-members¶
Add --indicator members via the per-item POST shortcut.
Usage:
Arguments:
uid: IndicatorGroup UID. [required]
Options:
-i, --indicator <str>: Indicator UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata indicator-groups remove-members¶
Drop --indicator members via the per-item DELETE shortcut.
Usage:
Arguments:
uid: IndicatorGroup UID. [required]
Options:
-i, --indicator <str>: Indicator UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata indicator-groups delete¶
Delete the grouping row — member indicators stay.
Usage:
Arguments:
uid: IndicatorGroup UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata indicator-group-sets¶
IndicatorGroupSet workflows (get / create / add-groups / remove-groups / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group set with its groups.create: Create an empty IndicatorGroupSet.add-groups: Add--groupmembers to a group set.remove-groups: Drop--groupmembers from a group set.delete: Delete an IndicatorGroupSet — member...
d2w metadata indicator-group-sets get¶
Show one group set with its groups.
Usage:
Arguments:
uid: IndicatorGroupSet UID. [required]
Options:
--help: Show this message and exit.
d2w metadata indicator-group-sets create¶
Create an empty IndicatorGroupSet.
Usage:
Options:
--name <str>: Full name. [required]--short-name <str>: Short name. [required]--uid <str>: Explicit 11-char UID.--code <str>: Business code.--description <str>: Free text.--compulsory / --not-compulsory: Require indicators to land in exactly one member group. [default: not-compulsory]--help: Show this message and exit.
d2w metadata indicator-group-sets add-groups¶
Add --group members to a group set.
Usage:
Arguments:
uid: IndicatorGroupSet UID. [required]
Options:
--group <str>: IndicatorGroup UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata indicator-group-sets remove-groups¶
Drop --group members from a group set.
Usage:
Arguments:
uid: IndicatorGroupSet UID. [required]
Options:
--group <str>: IndicatorGroup UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata indicator-group-sets delete¶
Delete an IndicatorGroupSet — member groups stay.
Usage:
Arguments:
uid: IndicatorGroupSet UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata program-indicators¶
ProgramIndicator authoring (get / create / rename / validate-expression / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one ProgramIndicator with its...create: Create a ProgramIndicator for a given...rename: Partial-update label fields on a...validate-expression: Parse-check one program-indicator...set-legend-sets: Replace the legend-set refs on one...delete: Delete a ProgramIndicator — DHIS2 rejects...
d2w metadata program-indicators get¶
Show one ProgramIndicator with its expression + filter resolved inline.
Usage:
Arguments:
uid: ProgramIndicator UID. [required]
Options:
--help: Show this message and exit.
d2w metadata program-indicators create¶
Create a ProgramIndicator for a given program.
Usage:
Options:
--name <str>: Full name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--program <str>: Program UID — required. [required]--expression <str>: DHIS2 expression (e.g. '#{deUid}'). [required]--analytics-type <str>: EVENT (default) or ENROLLMENT. [default: EVENT]--filter <str>: Boolean filter expression narrowing the rows.--description <str>: Free text.--aggregation-type <str>: Override the default SUM.--decimals <int>: Rendered decimal places.--legend-set <str>: LegendSet UID. Repeat for multiple.--code <str>: Business code.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata program-indicators rename¶
Partial-update label fields on a ProgramIndicator.
Usage:
Arguments:
uid: ProgramIndicator UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--description <str>: New description.--help: Show this message and exit.
d2w metadata program-indicators validate-expression¶
Parse-check one program-indicator expression — fast pre-flight before create.
Usage:
Arguments:
expression: Program-indicator expression to validate. [required]
Options:
--help: Show this message and exit.
d2w metadata program-indicators set-legend-sets¶
Replace the legend-set refs on one ProgramIndicator.
Usage:
Arguments:
uid: ProgramIndicator UID. [required]
Options:
--legend-set <str>: LegendSet UID to attach. Empty list clears. [required]--help: Show this message and exit.
d2w metadata program-indicators delete¶
Delete a ProgramIndicator — DHIS2 rejects deletes on PIs used in viz / dashboards.
Usage:
Arguments:
uid: ProgramIndicator UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata program-indicator-groups¶
ProgramIndicatorGroup workflows (get / members / create / add-members / remove-members / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group with its member refs.members: Page through ProgramIndicators inside one...create: Create an empty ProgramIndicatorGroup.add-members: Add--program-indicatormembers via the...remove-members: Drop--program-indicatormembers via the...delete: Delete the grouping row — member program...
d2w metadata program-indicator-groups get¶
Show one group with its member refs.
Usage:
Arguments:
uid: ProgramIndicatorGroup UID. [required]
Options:
--help: Show this message and exit.
d2w metadata program-indicator-groups members¶
Page through ProgramIndicators inside one group.
Usage:
Arguments:
uid: ProgramIndicatorGroup UID. [required]
Options:
--page <int>: 1-based page number. [default: 1]--page-size <int>: Rows per page. [default: 50]--help: Show this message and exit.
d2w metadata program-indicator-groups create¶
Create an empty ProgramIndicatorGroup.
Usage:
Options:
--name <str>: Full name. [required]--short-name <str>: Short name. [required]--uid <str>: Explicit 11-char UID.--code <str>: Business code.--description <str>: Free text.--help: Show this message and exit.
d2w metadata program-indicator-groups add-members¶
Add --program-indicator members via the per-item POST shortcut.
Usage:
Arguments:
uid: ProgramIndicatorGroup UID. [required]
Options:
-i, --program-indicator <str>: ProgramIndicator UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata program-indicator-groups remove-members¶
Drop --program-indicator members via the per-item DELETE shortcut.
Usage:
Arguments:
uid: ProgramIndicatorGroup UID. [required]
Options:
-i, --program-indicator <str>: ProgramIndicator UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata program-indicator-groups delete¶
Delete the grouping row — member program indicators stay.
Usage:
Arguments:
uid: ProgramIndicatorGroup UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata category-options¶
CategoryOption authoring (get / create / rename / set-validity / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one CategoryOption with its...create: Create a CategoryOption.rename: Partial-update the label fields on a...set-validity: Set thestartDate/endDatevalidity...delete: Delete a CategoryOption — DHIS2 rejects...
d2w metadata category-options get¶
Show one CategoryOption with its categories + groups inline.
Usage:
Arguments:
uid: CategoryOption UID. [required]
Options:
--help: Show this message and exit.
d2w metadata category-options create¶
Create a CategoryOption. Omit --start-date/--end-date for an always-valid option.
Usage:
Options:
--name <str>: Full name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--code <str>: Business code.--description <str>: Free text.--form-name <str>: Form name override.--start-date <str>: ISO-8601 date — beginning of validity window.--end-date <str>: ISO-8601 date — end of validity window.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata category-options rename¶
Partial-update the label fields on a CategoryOption.
Usage:
Arguments:
uid: CategoryOption UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--form-name <str>: New form name.--description <str>: New description.--help: Show this message and exit.
d2w metadata category-options set-validity¶
Set the startDate / endDate validity window on a CategoryOption.
Usage:
Arguments:
uid: CategoryOption UID. [required]
Options:
--start-date <str>: ISO-8601 date (empty to clear).--end-date <str>: ISO-8601 date (empty to clear).--help: Show this message and exit.
d2w metadata category-options delete¶
Delete a CategoryOption — DHIS2 rejects deletes on options in use.
Usage:
Arguments:
uid: CategoryOption UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata category-option-groups¶
CategoryOptionGroup workflows (get / members / create / add-members / remove-members / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group with its member + group-set...members: Page through CategoryOptions inside one...create: Create an empty CategoryOptionGroup.add-members: Add--category-optionmembers via the...remove-members: Drop--category-optionmembers via the...delete: Delete the grouping row — member category...
d2w metadata category-option-groups get¶
Show one group with its member + group-set refs.
Usage:
Arguments:
uid: CategoryOptionGroup UID. [required]
Options:
--help: Show this message and exit.
d2w metadata category-option-groups members¶
Page through CategoryOptions inside one group.
Usage:
Arguments:
uid: CategoryOptionGroup UID. [required]
Options:
--page <int>: 1-based page number. [default: 1]--page-size <int>: Rows per page. [default: 50]--help: Show this message and exit.
d2w metadata category-option-groups create¶
Create an empty CategoryOptionGroup.
Usage:
Options:
--name <str>: Full name. [required]--short-name <str>: Short name. [required]--data-dimension-type <str>: DISAGGREGATION (default) or ATTRIBUTE. [default: DISAGGREGATION]--uid <str>: Explicit 11-char UID.--code <str>: Business code.--description <str>: Free text.--help: Show this message and exit.
d2w metadata category-option-groups add-members¶
Add --category-option members via the per-item POST shortcut.
Usage:
Arguments:
uid: CategoryOptionGroup UID. [required]
Options:
-c, --category-option <str>: CategoryOption UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata category-option-groups remove-members¶
Drop --category-option members via the per-item DELETE shortcut.
Usage:
Arguments:
uid: CategoryOptionGroup UID. [required]
Options:
-c, --category-option <str>: CategoryOption UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata category-option-groups delete¶
Delete the grouping row — member category options stay.
Usage:
Arguments:
uid: CategoryOptionGroup UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata category-option-group-sets¶
CategoryOptionGroupSet workflows (get / create / add-groups / remove-groups / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group set with its groups.create: Create an empty CategoryOptionGroupSet.add-groups: Add--groupmembers to a group set.remove-groups: Drop--groupmembers from a group set.delete: Delete a CategoryOptionGroupSet — member...
d2w metadata category-option-group-sets get¶
Show one group set with its groups.
Usage:
Arguments:
uid: CategoryOptionGroupSet UID. [required]
Options:
--help: Show this message and exit.
d2w metadata category-option-group-sets create¶
Create an empty CategoryOptionGroupSet.
Usage:
Options:
--name <str>: Full name. [required]--short-name <str>: Short name. [required]--data-dimension-type <str>: DISAGGREGATION (default) or ATTRIBUTE. [default: DISAGGREGATION]--data-dimension / --no-data-dimension: Expose as analytics axis. [default: data-dimension]--uid <str>: Explicit 11-char UID.--code <str>: Business code.--description <str>: Free text.--help: Show this message and exit.
d2w metadata category-option-group-sets add-groups¶
Add --group members to a group set.
Usage:
Arguments:
uid: CategoryOptionGroupSet UID. [required]
Options:
--group <str>: CategoryOptionGroup UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata category-option-group-sets remove-groups¶
Drop --group members from a group set.
Usage:
Arguments:
uid: CategoryOptionGroupSet UID. [required]
Options:
--group <str>: CategoryOptionGroup UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata category-option-group-sets delete¶
Delete a CategoryOptionGroupSet — member groups stay.
Usage:
Arguments:
uid: CategoryOptionGroupSet UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata categories¶
Category authoring (get / create / rename / add-option / remove-option / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Category with its options inline.create: Create a Category, optionally wiring...rename: Partial-update the label fields on a...add-option: Append a CategoryOption to this Category's...remove-option: Remove a CategoryOption from this...delete: Delete a Category — DHIS2 rejects deletes...
d2w metadata categories get¶
Show one Category with its options inline.
Usage:
Arguments:
uid: Category UID. [required]
Options:
--help: Show this message and exit.
d2w metadata categories create¶
Create a Category, optionally wiring CategoryOption members on create.
Usage:
Options:
--name <str>: Full name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--code <str>: Business code.--description <str>: Free text.--type <str>: DISAGGREGATION (default) or ATTRIBUTE. [default: DISAGGREGATION]--option <str>: CategoryOption UID to wire on create. Repeatable; order is preserved on save.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata categories rename¶
Partial-update the label fields on a Category.
Usage:
Arguments:
uid: Category UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--description <str>: New description.--help: Show this message and exit.
d2w metadata categories add-option¶
Append a CategoryOption to this Category's ordered membership.
Usage:
Arguments:
uid: Category UID. [required]option_uid: CategoryOption UID to append. [required]
Options:
--help: Show this message and exit.
d2w metadata categories remove-option¶
Remove a CategoryOption from this Category's membership.
Usage:
Arguments:
uid: Category UID. [required]option_uid: CategoryOption UID to remove. [required]
Options:
--help: Show this message and exit.
d2w metadata categories delete¶
Delete a Category — DHIS2 rejects deletes on categories referenced by a CategoryCombo.
Usage:
Arguments:
uid: Category UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata category-combos¶
CategoryCombo authoring (get / create / rename / add-category / remove-category / wait-for-cocs / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one CategoryCombo with its category +...create: Create a CategoryCombo with an ordered...rename: Partial-update label fields on a...add-category: Append a Category to this combo's ordered...remove-category: Remove a Category from this combo's...wait-for-cocs: Block until the COC matrix on this combo...delete: Delete a CategoryCombo — DHIS2 rejects the...build: One-pass create-or-reuse for the full...
d2w metadata category-combos get¶
Show one CategoryCombo with its category + COC refs inline.
Usage:
Arguments:
uid: CategoryCombo UID. [required]
Options:
--help: Show this message and exit.
d2w metadata category-combos create¶
Create a CategoryCombo with an ordered list of Category UIDs.
Usage:
Options:
--name <str>: Full name (<=230 chars). [required]--category <str>: Category UID. Repeatable; order is preserved on save and shapes the COC matrix. [required]--code <str>: Business code.--type <str>: DISAGGREGATION (default) or ATTRIBUTE. [default: DISAGGREGATION]--skip-total / --with-total: Omit the total aggregation row downstream tables draw from this combo. [default: with-total]--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata category-combos rename¶
Partial-update label fields on a CategoryCombo.
Usage:
Arguments:
uid: CategoryCombo UID. [required]
Options:
--name <str>: New name.--code <str>: New code.--help: Show this message and exit.
d2w metadata category-combos add-category¶
Append a Category to this combo's ordered membership.
DHIS2 regenerates the COC matrix server-side. Re-fetch the combo + use
wait-for-cocs if you need to block until the new matrix lands.
Usage:
Arguments:
uid: CategoryCombo UID. [required]category_uid: Category UID to append. [required]
Options:
--help: Show this message and exit.
d2w metadata category-combos remove-category¶
Remove a Category from this combo's membership.
Usage:
Arguments:
uid: CategoryCombo UID. [required]category_uid: Category UID to remove. [required]
Options:
--help: Show this message and exit.
d2w metadata category-combos wait-for-cocs¶
Block until the COC matrix on this combo reaches --expected.
Cold-start regen of a large combo can take tens of seconds, especially
under arm64 emulation. Use after create or add-category when the
next step depends on the matrix being ready.
Usage:
Arguments:
uid: CategoryCombo UID. [required]
Options:
--expected <int>: Expected total of CategoryOptionCombos materialised by this combo. [required]--timeout <float>: Seconds to wait before giving up (default 60). [default: 60.0]--poll <float>: Seconds between polls (default 1). [default: 1.0]--help: Show this message and exit.
d2w metadata category-combos delete¶
Delete a CategoryCombo — DHIS2 rejects the default combo + combos in use.
Usage:
Arguments:
uid: CategoryCombo UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata category-combos build¶
One-pass create-or-reuse for the full Category dimension stack.
Walks a declarative CategoryComboBuildSpec, ensuring every
CategoryOption -> Category -> CategoryCombo referenced exists
on the target. Idempotent — re-running the same spec is a no-op
modulo new options getting wired into existing categories. Polls
the COC matrix until the cross-product count lands.
Lookup is by name (DHIS2 enforces unique names on each layer).
Existing entries are reused; only missing entries get created.
Usage:
Options:
--spec <str>: Path to a JSON CategoryComboBuildSpec, or-to read from stdin. Shape:{name, categories: [{name, options: [{name, ...}, ...]}, ...]}. [required]--timeout <float>: Seconds to wait for the COC matrix to settle (default 120). [default: 120.0]--poll <float>: Seconds between matrix polls (default 1). [default: 1.0]--help: Show this message and exit.
d2w metadata category-option-combos¶
CategoryOptionCombo read access (get / list-for-combo). DHIS2 owns writes.
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one CategoryOptionCombo with its...list-for-combo: List every CategoryOptionCombo...
d2w metadata category-option-combos get¶
Show one CategoryOptionCombo with its parent combo + option refs.
Usage:
Arguments:
uid: CategoryOptionCombo UID. [required]
Options:
--help: Show this message and exit.
d2w metadata category-option-combos list-for-combo¶
List every CategoryOptionCombo materialised by one CategoryCombo.
Usage:
Arguments:
combo_uid: CategoryCombo UID. [required]
Options:
--help: Show this message and exit.
d2w metadata data-sets¶
DataSet authoring (get / create / rename / add-element / remove-element / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one DataSet with its DSE + section +...create: Create a DataSet.rename: Partial-update the label fields on a DataSet.add-element: Attach a DataElement to the DataSet...remove-element: Detach a DataElement from the DataSet.delete: Delete a DataSet — DHIS2 rejects deletes...
d2w metadata data-sets get¶
Show one DataSet with its DSE + section + OU counts inline.
Usage:
Arguments:
uid: DataSet UID. [required]
Options:
--help: Show this message and exit.
d2w metadata data-sets create¶
Create a DataSet.
Usage:
Options:
--name <str>: Full name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--period-type <str>: Period type (Monthly, Weekly, Daily, Quarterly, Yearly, …). [required]-cc, --category-combo <str>: CategoryCombo UID (defaults to the instance default).--code <str>: Business code.--form-name <str>: Form-name override.--description <str>: Free text.--open-future-periods <int>: Number of future periods open for entry.--expiry-days <int>: Days after period-end that entry remains open.--timely-days <int>: Days after period-start considered on-time.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata data-sets rename¶
Partial-update the label fields on a DataSet.
Usage:
Arguments:
uid: DataSet UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--form-name <str>: New form name.--description <str>: New description.--help: Show this message and exit.
d2w metadata data-sets add-element¶
Attach a DataElement to the DataSet (optionally with a per-set CategoryCombo override).
Usage:
Arguments:
data_set_uid: DataSet UID. [required]data_element_uid: DataElement UID to attach. [required]
Options:
-cc, --category-combo <str>: CategoryCombo UID override for this DSE.--help: Show this message and exit.
d2w metadata data-sets remove-element¶
Detach a DataElement from the DataSet.
Usage:
Arguments:
data_set_uid: DataSet UID. [required]data_element_uid: DataElement UID to detach. [required]
Options:
--help: Show this message and exit.
d2w metadata data-sets delete¶
Delete a DataSet — DHIS2 rejects deletes on DataSets with saved values.
Usage:
Arguments:
uid: DataSet UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata sections¶
Section authoring (get / create / rename / add-element / remove-element / reorder / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Section with its ordered DE list...create: Create a Section attached to a DataSet.rename: Partial-update the label / sort-order...add-element: Append (or insert at--position) a...remove-element: Remove a DataElement from the Section...reorder: Replace the Section'sdataElementswith...delete: Delete a Section — DEs stay on the parent...
d2w metadata sections get¶
Show one Section with its ordered DE list inline.
Usage:
Arguments:
uid: Section UID. [required]
Options:
--help: Show this message and exit.
d2w metadata sections create¶
Create a Section attached to a DataSet. Repeat --data-element to seed the ordered DE list.
Usage:
Options:
--name <str>: Section name (<=230 chars). [required]-ds, --data-set <str>: Parent DataSet UID. [required]--sort-order <int>: Ordering within the DataSet (ascending).--description <str>: Free text.--code <str>: Business code.-de, --data-element <str>: DataElement UID (repeatable, order preserved).-i, --indicator <str>: Indicator UID to show in the side pane (repeatable).--show-column-totals / --no-show-column-totals: Render column totals.--show-row-totals / --no-show-row-totals: Render row totals.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata sections rename¶
Partial-update the label / sort-order fields on a Section.
Usage:
Arguments:
uid: Section UID. [required]
Options:
--name <str>: New name.--description <str>: New description.--sort-order <int>: New sort order.--help: Show this message and exit.
d2w metadata sections add-element¶
Append (or insert at --position) a DataElement to the Section.
Usage:
Arguments:
section_uid: Section UID. [required]data_element_uid: DataElement UID. [required]
Options:
--position <int>: 0-indexed insertion position. Omit to append.--help: Show this message and exit.
d2w metadata sections remove-element¶
Remove a DataElement from the Section (stays on the parent DataSet).
Usage:
Arguments:
section_uid: Section UID. [required]data_element_uid: DataElement UID. [required]
Options:
--help: Show this message and exit.
d2w metadata sections reorder¶
Replace the Section's dataElements with exactly the given UIDs in order.
Usage:
Arguments:
section_uid: Section UID. [required]data_element_uids...: DataElement UIDs in the desired order. [required]
Options:
--help: Show this message and exit.
d2w metadata sections delete¶
Delete a Section — DEs stay on the parent DataSet.
Usage:
Arguments:
uid: Section UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata validation-rules¶
ValidationRule authoring (get / create / rename / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one ValidationRule with both...create: Create a ValidationRule.rename: Partial-update the label fields on a...delete: Delete a ValidationRule — any outstanding...
d2w metadata validation-rules get¶
Show one ValidationRule with both expression sides inline.
Usage:
Arguments:
uid: ValidationRule UID. [required]
Options:
--help: Show this message and exit.
d2w metadata validation-rules create¶
Create a ValidationRule.
Usage:
Options:
--name <str>: Rule name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--left <str>: Left-side expression (e.g. #{deUid}). [required]--operator <str>: Comparison operator. [required]--right <str>: Right-side expression. [required]--period-type <str>: Period type. [default: Monthly]--importance <str>: LOW / MEDIUM / HIGH. [default: MEDIUM]--missing-value-strategy <str>: How to treat absent operands. [default: SKIP_IF_ALL_VALUES_MISSING]--description <str>: Free-text description.--code <str>: Business code.--ou-level <int>: OU depth (repeatable). E.g.--ou-level 4for facilities.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata validation-rules rename¶
Partial-update the label fields on a ValidationRule.
Usage:
Arguments:
uid: ValidationRule UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--description <str>: New description.--help: Show this message and exit.
d2w metadata validation-rules delete¶
Delete a ValidationRule — any outstanding results are purged.
Usage:
Arguments:
uid: ValidationRule UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata validation-rule-groups¶
ValidationRuleGroup workflows (get / members / create / add-members / remove-members / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group with its rule refs.members: Page through ValidationRules inside a group.create: Create an empty ValidationRuleGroup.add-members: Attach ValidationRules to a group.remove-members: Detach ValidationRules from a group.delete: Delete a ValidationRuleGroup — member...
d2w metadata validation-rule-groups get¶
Show one group with its rule refs.
Usage:
Arguments:
uid: ValidationRuleGroup UID. [required]
Options:
--help: Show this message and exit.
d2w metadata validation-rule-groups members¶
Page through ValidationRules inside a group.
Usage:
Arguments:
uid: ValidationRuleGroup UID. [required]
Options:
--page <int>: 1-based page. [default: 1]--page-size <int>: Rows per page. [default: 50]--help: Show this message and exit.
d2w metadata validation-rule-groups create¶
Create an empty ValidationRuleGroup.
Usage:
Options:
--name <str>: Group name. [required]--short-name <str>: Short name.--code <str>: Business code.--description <str>: Free text.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata validation-rule-groups add-members¶
Attach ValidationRules to a group.
Usage:
Arguments:
uid: ValidationRuleGroup UID. [required]
Options:
-r, --rule <str>: ValidationRule UID (repeatable). [required]--help: Show this message and exit.
d2w metadata validation-rule-groups remove-members¶
Detach ValidationRules from a group.
Usage:
Arguments:
uid: ValidationRuleGroup UID. [required]
Options:
-r, --rule <str>: ValidationRule UID (repeatable). [required]--help: Show this message and exit.
d2w metadata validation-rule-groups delete¶
Delete a ValidationRuleGroup — member rules stay.
Usage:
Arguments:
uid: ValidationRuleGroup UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata predictors¶
Predictor authoring (get / create / rename / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Predictor with generator + output...create: Create a Predictor.rename: Partial-update the label fields on a...delete: Delete a Predictor.
d2w metadata predictors get¶
Show one Predictor with generator + output inline.
Usage:
Arguments:
uid: Predictor UID. [required]
Options:
--help: Show this message and exit.
d2w metadata predictors create¶
Create a Predictor.
Usage:
Options:
--name <str>: Predictor name. [required]--short-name <str>: Short name. [required]--expression <str>: Generator expression (e.g. #{deUid}). [required]-o, --output <str>: Output DataElement UID. [required]--period-type <str>: Period type. [default: Monthly]--sequential <int>: Sequential sample count (e.g. 3 for 3-month rolling). [default: 3]--annual <int>: Annual sample count. [default: 0]--ou-level <str>: OrganisationUnitLevel UID (repeatable).--output-combo <str>: Output CategoryOptionCombo UID.--description <str>: Free text.--code <str>: Business code.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata predictors rename¶
Partial-update the label fields on a Predictor.
Usage:
Arguments:
uid: Predictor UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--description <str>: New description.--help: Show this message and exit.
d2w metadata predictors delete¶
Delete a Predictor. DHIS2 keeps any data values it has already written.
Usage:
Arguments:
uid: Predictor UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata predictor-groups¶
PredictorGroup workflows (get / members / create / add-members / remove-members / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group with its predictor refs.members: Page through Predictors in a group.create: Create an empty PredictorGroup.add-members: Attach Predictors to a group.remove-members: Detach Predictors from a group.delete: Delete a PredictorGroup — member...
d2w metadata predictor-groups get¶
Show one group with its predictor refs.
Usage:
Arguments:
uid: PredictorGroup UID. [required]
Options:
--help: Show this message and exit.
d2w metadata predictor-groups members¶
Page through Predictors in a group.
Usage:
Arguments:
uid: PredictorGroup UID. [required]
Options:
--page <int>: 1-based page. [default: 1]--page-size <int>: Rows per page. [default: 50]--help: Show this message and exit.
d2w metadata predictor-groups create¶
Create an empty PredictorGroup.
Usage:
Options:
--name <str>: Group name. [required]--short-name <str>: Short name.--code <str>: Business code.--description <str>: Free text.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata predictor-groups add-members¶
Attach Predictors to a group.
Usage:
Arguments:
uid: PredictorGroup UID. [required]
Options:
-p, --predictor <str>: Predictor UID (repeatable). [required]--help: Show this message and exit.
d2w metadata predictor-groups remove-members¶
Detach Predictors from a group.
Usage:
Arguments:
uid: PredictorGroup UID. [required]
Options:
-p, --predictor <str>: Predictor UID (repeatable). [required]--help: Show this message and exit.
d2w metadata predictor-groups delete¶
Delete a PredictorGroup — member predictors stay.
Usage:
Arguments:
uid: PredictorGroup UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata tracked-entity-attributes¶
TrackedEntityAttribute authoring (get / create / rename / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one TrackedEntityAttribute with its...create: Create a TrackedEntityAttribute.rename: Partial-update the label fields on a...delete: Delete a TrackedEntityAttribute — DHIS2...
d2w metadata tracked-entity-attributes get¶
Show one TrackedEntityAttribute with its toggles inline.
Usage:
Arguments:
uid: TrackedEntityAttribute UID. [required]
Options:
--help: Show this message and exit.
d2w metadata tracked-entity-attributes create¶
Create a TrackedEntityAttribute.
Usage:
Options:
--name <str>: Attribute name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--value-type <str>: TEXT / NUMBER / DATE / … [default: TEXT]--aggregation-type <str>: DHIS2 aggregation type. [default: NONE]--option-set <str>: Constraining OptionSet UID.--legend-set <str>: LegendSet UID (repeatable).--unique / --no-unique: Unique across the instance. [default: no-unique]--generated / --no-generated: Auto-generate via --pattern on TEI register. [default: no-generated]--confidential / --no-confidential: Sensitive. [default: no-confidential]--inherit / --no-inherit: Inherit on parent/child TEI link. [default: no-inherit]--display-in-list-no-program / --no-display-in-list-no-program: Show in the list when no program is selected. [default: no-display-in-list-no-program]--orgunit-scope / --no-orgunit-scope: Scope values to the capturing OU. [default: no-orgunit-scope]--pattern <str>: Generator pattern (with --generated).--field-mask <str>: Input mask for the data-entry field.--code <str>: Business code.--form-name <str>: Form-name override.--description <str>: Free text.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata tracked-entity-attributes rename¶
Partial-update the label fields on a TrackedEntityAttribute.
Usage:
Arguments:
uid: TrackedEntityAttribute UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--form-name <str>: New form name.--description <str>: New description.--help: Show this message and exit.
d2w metadata tracked-entity-attributes delete¶
Delete a TrackedEntityAttribute — DHIS2 rejects deletes on TEAs wired into a TET or program.
Usage:
Arguments:
uid: TrackedEntityAttribute UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata tracked-entity-types¶
TrackedEntityType authoring (get / create / rename / add-attribute / remove-attribute / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one TrackedEntityType with its...create: Create a TrackedEntityType.rename: Partial-update the label fields on a...add-attribute: Attach a TrackedEntityAttribute to a...remove-attribute: Detach a TrackedEntityAttribute from a...delete: Delete a TrackedEntityType — DHIS2 rejects...
d2w metadata tracked-entity-types get¶
Show one TrackedEntityType with its attribute link-table counts.
Usage:
Arguments:
uid: TrackedEntityType UID. [required]
Options:
--help: Show this message and exit.
d2w metadata tracked-entity-types create¶
Create a TrackedEntityType.
Usage:
Options:
--name <str>: TET name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--description <str>: Free text.--code <str>: Business code.--form-name <str>: Form-name override.--allow-audit-log / --no-allow-audit-log: Enable the per-TEI audit trail.--feature-type <str>: NONE / POINT / POLYGON — geometry captured per TEI.--min-attrs <int>: Min attributes required to search TEIs.--max-tei <int>: Max TEI count to return per search.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata tracked-entity-types rename¶
Partial-update the label fields on a TrackedEntityType.
Usage:
Arguments:
uid: TrackedEntityType UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--form-name <str>: New form name.--description <str>: New description.--help: Show this message and exit.
d2w metadata tracked-entity-types add-attribute¶
Attach a TrackedEntityAttribute to a TrackedEntityType.
Usage:
Arguments:
tet_uid: TrackedEntityType UID. [required]attribute_uid: TrackedEntityAttribute UID to wire in. [required]
Options:
--mandatory / --no-mandatory: Require on enrollment. [default: no-mandatory]--searchable / --no-searchable: Include in TEI search. [default: no-searchable]--display-in-list / --no-display-in-list: Show in the enrolled-TEI list. [default: display-in-list]--help: Show this message and exit.
d2w metadata tracked-entity-types remove-attribute¶
Detach a TrackedEntityAttribute from a TrackedEntityType.
Usage:
Arguments:
tet_uid: TrackedEntityType UID. [required]attribute_uid: TrackedEntityAttribute UID to detach. [required]
Options:
--help: Show this message and exit.
d2w metadata tracked-entity-types delete¶
Delete a TrackedEntityType — DHIS2 rejects deletes on TETs in use by enrolled TEIs.
Usage:
Arguments:
uid: TrackedEntityType UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata programs¶
Program authoring (get / create / rename / add-attribute / remove-attribute / add-to-ou / remove-from-ou / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one Program with counts inline.create: Create a Program.rename: Partial-update the label fields on a Program.add-attribute: Attach a TrackedEntityAttribute to the...remove-attribute: Detach a TrackedEntityAttribute from the...add-to-ou: Scope the Program to another...remove-from-ou: Drop an OrganisationUnit from the...delete: Delete a Program — DHIS2 rejects deletes...
d2w metadata programs get¶
Show one Program with counts inline.
Usage:
Arguments:
uid: Program UID. [required]
Options:
--help: Show this message and exit.
d2w metadata programs create¶
Create a Program. --program-type WITH_REGISTRATION requires --tracked-entity-type.
Usage:
Options:
--name <str>: Program name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--program-type <str>: WITH_REGISTRATION (tracker) or WITHOUT_REGISTRATION (event). [default: WITH_REGISTRATION]-tet, --tracked-entity-type <str>: TET UID. Required for WITH_REGISTRATION.-cc, --category-combo <str>: CategoryCombo UID (defaults to the instance default).--description <str>: Free text.--code <str>: Business code.--form-name <str>: Form-name override.--display-incident-date / --no-display-incident-date: Capture an incident date.--enrollment-date-label <str>: Custom enrollment-date label.--incident-date-label <str>: Custom incident-date label.--feature-type <str>: Geometry captured per enrollment (NONE / POINT / POLYGON).--only-enroll-once / --no-only-enroll-once: Block re-enrollment of the same TEI.--expiry-days <int>: Days after which enrollments expire for edit.--min-attrs <int>: Min attributes required for TEI search.--max-tei <int>: Max TEI count per search.--use-first-stage-during-registration / --no-use-first-stage-during-registration: Run the first ProgramStage inside the enrollment flow.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata programs rename¶
Partial-update the label fields on a Program.
Usage:
Arguments:
uid: Program UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--form-name <str>: New form name.--description <str>: New description.--help: Show this message and exit.
d2w metadata programs add-attribute¶
Attach a TrackedEntityAttribute to the Program's enrollment form.
Usage:
Arguments:
program_uid: Program UID. [required]attribute_uid: TrackedEntityAttribute UID. [required]
Options:
--mandatory / --no-mandatory: Require on enrollment. [default: no-mandatory]--searchable / --no-searchable: Include in search. [default: no-searchable]--display-in-list / --no-display-in-list: Show in enrolled-TEI list. [default: display-in-list]--sort-order <int>: Position on enrollment form.--allow-future-date / --no-allow-future-date: Permit dates past today. [default: no-allow-future-date]--render-options-as-radio / --no-render-options-as-radio: Render option-set choices as radios instead of a dropdown. [default: no-render-options-as-radio]--help: Show this message and exit.
d2w metadata programs remove-attribute¶
Detach a TrackedEntityAttribute from the Program's enrollment form.
Usage:
Arguments:
program_uid: Program UID. [required]attribute_uid: TrackedEntityAttribute UID. [required]
Options:
--help: Show this message and exit.
d2w metadata programs add-to-ou¶
Scope the Program to another OrganisationUnit.
Usage:
Arguments:
program_uid: Program UID. [required]organisation_unit_uid: OrganisationUnit UID. [required]
Options:
--help: Show this message and exit.
d2w metadata programs remove-from-ou¶
Drop an OrganisationUnit from the Program's scope.
Usage:
Arguments:
program_uid: Program UID. [required]organisation_unit_uid: OrganisationUnit UID. [required]
Options:
--help: Show this message and exit.
d2w metadata programs delete¶
Delete a Program — DHIS2 rejects deletes on programs with enrollments or events.
Usage:
Arguments:
uid: Program UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata program-stages¶
ProgramStage authoring (get / create / rename / add-element / remove-element / reorder / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one ProgramStage with its PSDE list...create: Create a ProgramStage under--program.rename: Partial-update the label fields on a...add-element: Attach a DataElement to the ProgramStage.remove-element: Detach a DataElement from the ProgramStage.reorder: Replace the ProgramStage's PSDE list with...delete: Delete a ProgramStage — DHIS2 rejects...
d2w metadata program-stages get¶
Show one ProgramStage with its PSDE list summary inline.
Usage:
Arguments:
uid: ProgramStage UID. [required]
Options:
--help: Show this message and exit.
d2w metadata program-stages create¶
Create a ProgramStage under --program.
Usage:
Options:
--name <str>: ProgramStage name (<=230 chars). [required]-p, --program <str>: Parent Program UID. [required]--short-name <str>: Short name.--description <str>: Free text.--code <str>: Business code.--sort-order <int>: Stage order inside the Program.--repeatable / --no-repeatable: Allow the stage to reoccur within one enrollment.--auto-generate-event / --no-auto-generate-event: Auto-create an event when the enrollment starts.--generated-by-enrollment-date / --no-generated-by-enrollment-date: Base due-date math on enrollment date (vs incident date).--feature-type <str>: Geometry captured per event (NONE / POINT / POLYGON).--period-type <str>: Period type for scheduled events.--validation-strategy <str>: ON_COMPLETE / ON_UPDATE_AND_INSERT.--min-days <int>: Minimum days from enrollment start before the stage opens.--standard-interval <int>: Default days between scheduled repeats.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w metadata program-stages rename¶
Partial-update the label fields on a ProgramStage.
Usage:
Arguments:
uid: ProgramStage UID. [required]
Options:
--name <str>: New name.--short-name <str>: New short name.--form-name <str>: New form name.--description <str>: New description.--help: Show this message and exit.
d2w metadata program-stages add-element¶
Attach a DataElement to the ProgramStage.
Usage:
Arguments:
stage_uid: ProgramStage UID. [required]data_element_uid: DataElement UID to attach. [required]
Options:
--compulsory / --no-compulsory: Required on save. [default: no-compulsory]--allow-future-date / --no-allow-future-date: Permit dates past today. [default: no-allow-future-date]--display-in-reports / --no-display-in-reports: Show in event reports. [default: display-in-reports]--allow-provided-elsewhere / --no-allow-provided-elsewhere: Mark the value as provided by a different OU. [default: no-allow-provided-elsewhere]--render-options-as-radio / --no-render-options-as-radio: Render option-set picklists as radios. [default: no-render-options-as-radio]--sort-order <int>: Position inside the stage data-entry form.--help: Show this message and exit.
d2w metadata program-stages remove-element¶
Detach a DataElement from the ProgramStage.
Usage:
Arguments:
stage_uid: ProgramStage UID. [required]data_element_uid: DataElement UID. [required]
Options:
--help: Show this message and exit.
d2w metadata program-stages reorder¶
Replace the ProgramStage's PSDE list with exactly the given DE UIDs in order.
Usage:
Arguments:
stage_uid: ProgramStage UID. [required]data_element_uids...: DataElement UIDs in the desired order. [required]
Options:
--help: Show this message and exit.
d2w metadata program-stages delete¶
Delete a ProgramStage — DHIS2 rejects deletes on stages with recorded events.
Usage:
Arguments:
uid: ProgramStage UID. [required]
Options:
-y, --yes: Skip confirmation.--help: Show this message and exit.
d2w metadata organisation-units¶
OrganisationUnit hierarchy workflows (get / tree / create / move / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one OU with parent + core hierarchy...tree: Render a bounded-depth subtree indented by...create: Create a child OU underparent_uid.move: Reparent an OU.delete: Delete an OU.
d2w metadata organisation-units get¶
Show one OU with parent + core hierarchy fields.
Usage:
Arguments:
uid: OrganisationUnit UID. [required]
Options:
--help: Show this message and exit.
d2w metadata organisation-units tree¶
Render a bounded-depth subtree indented by hierarchy level.
Usage:
Arguments:
root_uid: Root OU UID — render this + descendants. [required]
Options:
--max-depth <int>: Depth of descendants to include (0 = just the root). [default: 3]--help: Show this message and exit.
d2w metadata organisation-units create¶
Create a child OU under parent_uid.
Usage:
Arguments:
parent_uid: Parent OU UID to create under. [required]
Options:
--name <str>: Full name (<=230 chars). [required]--short-name <str>: Short name (<=50 chars). [required]--opening-date <str>: ISO-8601 date, e.g. 2024-01-01. [required]--uid <str>: Explicit 11-char UID (generated when omitted).--code <str>: Business code.--description <str>: Free-text description.--help: Show this message and exit.
d2w metadata organisation-units move¶
Reparent an OU. DHIS2 recomputes path + hierarchyLevel.
Usage:
Arguments:
uid: OU UID to reparent. [required]new_parent_uid: New parent OU UID. [required]
Options:
--help: Show this message and exit.
d2w metadata organisation-units delete¶
Delete an OU. DHIS2 rejects deletes on units with children or data.
Usage:
Arguments:
uid: OU UID to delete. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w metadata organisation-unit-groups¶
OrganisationUnitGroup workflows (get / members / create / add-members / remove-members / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group with its member refs and...members: Page through the OUs inside one group.create: Create an empty OrganisationUnitGroup.add-members: Add--oumembers to a group via the...remove-members: Drop--oumembers from a group via the...delete: Delete an OrganisationUnitGroup — members...
d2w metadata organisation-unit-groups get¶
Show one group with its member refs and the group-sets it belongs to.
Usage:
Arguments:
uid: OrganisationUnitGroup UID. [required]
Options:
--help: Show this message and exit.
d2w metadata organisation-unit-groups members¶
Page through the OUs inside one group.
Usage:
Arguments:
uid: OrganisationUnitGroup UID. [required]
Options:
--page <int>: 1-based page number. [default: 1]--page-size <int>: Rows per page. [default: 50]--help: Show this message and exit.
d2w metadata organisation-unit-groups create¶
Create an empty OrganisationUnitGroup.
Usage:
Options:
--name <str>: Full name (<=230 chars, unique). [required]--short-name <str>: Short name (<=50 chars, unique). [required]--uid <str>: Explicit 11-char UID (generated when omitted).--code <str>: Business code.--description <str>: Free-text description.--color <str>: Hex colour (#RRGGBB).--help: Show this message and exit.
d2w metadata organisation-unit-groups add-members¶
Add --ou members to a group via the per-item POST shortcut.
Usage:
Arguments:
uid: OrganisationUnitGroup UID. [required]
Options:
--ou <str>: OU UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata organisation-unit-groups remove-members¶
Drop --ou members from a group via the per-item DELETE shortcut.
Usage:
Arguments:
uid: OrganisationUnitGroup UID. [required]
Options:
--ou <str>: OU UID to remove. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata organisation-unit-groups delete¶
Delete an OrganisationUnitGroup — members stay.
Usage:
Arguments:
uid: OrganisationUnitGroup UID to delete. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w metadata organisation-unit-group-sets¶
OrganisationUnitGroupSet workflows (get / create / add-groups / remove-groups / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one group set with its groups +...create: Create an empty OrganisationUnitGroupSet.add-groups: Add--groupmembers to a group set.remove-groups: Drop--groupmembers from a group set.delete: Delete an OrganisationUnitGroupSet —...
d2w metadata organisation-unit-group-sets get¶
Show one group set with its groups + per-group member counts.
Usage:
Arguments:
uid: OrganisationUnitGroupSet UID. [required]
Options:
--help: Show this message and exit.
d2w metadata organisation-unit-group-sets create¶
Create an empty OrganisationUnitGroupSet.
Usage:
Options:
--name <str>: Full name (<=230 chars, unique). [required]--short-name <str>: Short name (<=50 chars, unique). [required]--uid <str>: Explicit 11-char UID (generated when omitted).--code <str>: Business code.--description <str>: Free-text description.--compulsory / --not-compulsory: Require OUs to land in exactly one group of this set. [default: not-compulsory]--data-dimension / --no-data-dimension: Expose as a pivot/visualisation axis. [default: data-dimension]--help: Show this message and exit.
d2w metadata organisation-unit-group-sets add-groups¶
Add --group members to a group set.
Usage:
Arguments:
uid: OrganisationUnitGroupSet UID. [required]
Options:
--group <str>: OrganisationUnitGroup UID to add. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata organisation-unit-group-sets remove-groups¶
Drop --group members from a group set.
Usage:
Arguments:
uid: OrganisationUnitGroupSet UID. [required]
Options:
--group <str>: OrganisationUnitGroup UID to drop. Repeat for multiple. [required]--help: Show this message and exit.
d2w metadata organisation-unit-group-sets delete¶
Delete an OrganisationUnitGroupSet — groups stay.
Usage:
Arguments:
uid: OrganisationUnitGroupSet UID to delete. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w metadata organisation-unit-levels¶
OrganisationUnitLevel naming (get / rename).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one level row — by UID (default) or...rename: Give a level a human label — turns 'level...
d2w metadata organisation-unit-levels get¶
Show one level row — by UID (default) or by numeric depth.
Usage:
Arguments:
uid: OrganisationUnitLevel UID (or pass --by-level). [required]
Options:
--by-level: Treat UID as the numeric level (1 = roots).--help: Show this message and exit.
d2w metadata organisation-unit-levels rename¶
Give a level a human label — turns 'level 2' into 'Province'.
Usage:
Arguments:
uid: OrganisationUnitLevel UID (or the numeric level with --by-level). [required]
Options:
--name <str>: New human label (e.g. 'Country', 'District', 'Facility'). [required]--by-level: Treat UID as the numeric level (1 = roots).--code <str>: Optionally update the business code.--offline-levels <int>: How many levels to cache offline from this one.--help: Show this message and exit.
d2w metadata legend-sets¶
LegendSet authoring (get / create / clone / delete).
Usage:
Options:
--help: Show this message and exit.
Commands:
get: Show one LegendSet with its ordered...create: Create a LegendSet with ordered...clone: Duplicate an existing LegendSet with the...delete: Delete a LegendSet.
d2w metadata legend-sets get¶
Show one LegendSet with its ordered legends (colour ranges).
Usage:
Arguments:
uid: LegendSet UID. [required]
Options:
--help: Show this message and exit.
d2w metadata legend-sets create¶
Create a LegendSet with ordered colour-range legends.
Each --legend start🔚color[:name] defines one entry — start
must be strictly less than end, color is a #RRGGBB /
#RRGGBBAA hex string, name is optional (auto-generated from the
numeric range when omitted). At least one --legend is required.
Posts through /api/metadata so the LegendSet + its child Legends
land atomically. Returns the freshly-fetched record so DHIS2's
computed fields are populated.
Usage:
Options:
--name <str>: Display name for the new LegendSet. [required]--legend <str>: One legend (colour range) instart🔚color[:name]form. Repeatable, at least one required. Example:--legend 0:1000:#d73027:Low --legend 1000:5000:#1a9850:High. [required]--code <str>: Business code (unique).--uid <str>: Fixed 11-char UID. Omit to let the client generate one.--help: Show this message and exit.
d2w metadata legend-sets clone¶
Duplicate an existing LegendSet with the same bands + fresh UIDs.
Useful for forking a base set ("Coverage 0-100") into a variant without rebuilding the bands by hand.
Usage:
Arguments:
source_uid: Source LegendSet UID to clone. [required]
Options:
--new-name <str>: Name of the clone (default: append ' (clone)' to the source's name).--new-uid <str>: Fixed 11-char UID for the clone. Omit for auto-generated.--new-code <str>: Business code on the clone.--help: Show this message and exit.
d2w metadata legend-sets delete¶
Delete a LegendSet.
Usage:
Arguments:
uid: LegendSet UID to delete. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w profile¶
Manage DHIS2 profiles.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List every known profile with its source...list: List every known profile with its source...verify: Verify one profile or all profiles by...show: Print one profile (secrets redacted by...env: Printexport DHIS2_*lines for a...default: Setdefault = <name>in the global...add: Add (or upsert) a profile.remove: Remove a profile.rename: Rename a profile in-place.login: Run the OAuth2 authorization-code flow for...logout: Clear persisted OAuth2 tokens for a profile.bootstrap: One-shot: provision a PAT or OAuth2 client...oidc-config: Populate an OAuth2 profile by discovering...pat: Personal Access Tokens — provision PATs on...oauth2: Manage DHIS2 OAuth2 clients on the server...
d2w profile ls¶
List every known profile with its source and default status.
Usage:
Options:
-a, --all: Include shadowed profiles (global entries hidden by project ones).--help: Show this message and exit.
d2w profile list¶
List every known profile with its source and default status.
Usage:
Options:
-a, --all: Include shadowed profiles (global entries hidden by project ones).--help: Show this message and exit.
d2w profile verify¶
Verify one profile or all profiles by hitting /api/system/info + /api/me.
Usage:
Arguments:
name: Profile name to verify; omit to verify all.
Options:
--help: Show this message and exit.
d2w profile show¶
Print one profile (secrets redacted by default).
Usage:
Arguments:
name: [required]
Options:
--secrets: Include sensitive values.--help: Show this message and exit.
d2w profile env¶
Print export DHIS2_* lines for a profile, for eval.
Offline read — no instance probe; the wire client auto-detects the version on connect.
Values are printed as-is (the password / token is already plaintext in profiles.toml),
so the output is directly usable: eval "$(d2w profile env local_basic)". The command
only prints to stdout — it cannot mutate the caller's shell. For a redacted view (e.g.
screen-sharing) use d2w profile show instead.
Usage:
Arguments:
name: Profile name; defaults to the active profile.
Options:
--help: Show this message and exit.
d2w profile default¶
Set default = <name> in the global (default) or project profiles.toml.
When name is omitted and stdin is a TTY, the command renders the
profile list + prompts for a numbered selection. Pass --global or
--local to pick the profiles.toml to write (--global is the
default).
Usage:
Arguments:
name: Profile name to set as default. Omit to pick interactively from a list.
Options:
--global: Write to ~/.config/dhis2/profiles.toml (default).--local: Write to ./.dhis2/profiles.toml instead.--verify: Probe the instance after switching.--help: Show this message and exit.
d2w profile add¶
Add (or upsert) a profile.
Secrets are never accepted as command-line flags (they'd leak into shell history).
Read from env (DHIS2_PAT, DHIS2_PASSWORD, DHIS2_OAUTH_CLIENT_SECRET,
DHIS2_SESSION_COOKIE, DHIS2_SESSION_XSRF) or prompted interactively when missing.
Usage:
Arguments:
name: [required]
Options:
--url <str>: DHIS2 base URL (also: DHIS2_URL env).--auth <str>: pat | basic | oauth2 | session [default: pat]--username <str>: Basic-auth username.--client-id <str>: OAuth2 client_id.--scope <str>: OAuth2 scope (DHIS2 only recognisesALL). [default: ALL]--redirect-uri <str>: OAuth2 redirect URI (must match the registered client). [default: http://localhost:8765]--from-env: Pull OAuth2 fields from DHIS2_OAUTH_CLIENT_ID / DHIS2_OAUTH_CLIENT_SECRET / DHIS2_OAUTH_REDIRECT_URI / DHIS2_OAUTH_SCOPES env vars (seeded .env.auth).--global: Save to ~/.config/dhis2/profiles.toml (default — user-wide, applies everywhere).--local: Save to ./.dhis2/profiles.toml instead (project-scoped, overrides global).--default: Set as default after adding.--verify: Probe /api/system/info + /api/me after saving.--version <str>: Expected DHIS2 major for this profile (v41 | v42 | v43). Used by CLI/MCP to pick which version's plugin tree to load; the wire client always auto-detects on connect.--help: Show this message and exit.
d2w profile remove¶
Remove a profile. Without --global/--local, removes from whichever file holds it.
Usage:
Arguments:
name: [required]
Options:
--global: Remove from ~/.config/dhis2/profiles.toml specifically.--local: Remove from ./.dhis2/profiles.toml specifically.-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w profile rename¶
Rename a profile in-place. Preserves scope and updates default if needed.
Usage:
Arguments:
old_name: Current profile name. [required]new_name: New profile name (letters, digits, underscores). [required]
Options:
--verify: Probe the instance after renaming.--help: Show this message and exit.
d2w profile login¶
Run the OAuth2 authorization-code flow for a profile and persist its tokens.
Opens a browser to DHIS2's authorization endpoint, listens on the profile's
redirect_uri (local FastAPI+uvicorn), exchanges the code for tokens,
and writes them to the scope-appropriate tokens.sqlite. OAuth2 profiles only.
Pass --no-browser (or DHIS2_OAUTH_NO_BROWSER=1) to print the URL to
stderr instead of launching the system browser.
Usage:
Arguments:
name: Profile name; omit to use the default.
Options:
--no-browser: Print the DHIS2 authorization URL instead of launching the system browser. Useful over SSH, under Playwright, or when logging in via a different browser. Also accepts DHIS2_OAUTH_NO_BROWSER=1 as default.--help: Show this message and exit.
d2w profile logout¶
Clear persisted OAuth2 tokens for a profile.
Removes the row from the scope-appropriate tokens.sqlite. Next API call
triggers a fresh profile login flow. OAuth2 profiles only.
Usage:
Arguments:
name: Profile name; omit to use the default.
Options:
--help: Show this message and exit.
d2w profile bootstrap¶
One-shot: provision a PAT or OAuth2 client on DHIS2, save a profile, (for oauth2) log in.
Secrets never come in via argv. Read from env
(DHIS2_ADMIN_PAT, DHIS2_ADMIN_PASSWORD, DHIS2_OAUTH_CLIENT_SECRET)
or prompted interactively when missing. Admin creds are used once to POST
/api/apiToken (pat) or /api/oAuth2Clients (oauth2), then discarded.
Re-runs for auth=oauth2 fail at POST /api/oAuth2Clients if client_id is
taken — pass a different --client-id in that case. PAT bootstraps never
collide (DHIS2 mints a fresh server-side UID).
Usage:
Arguments:
name: Profile name to create. [required]
Options:
--auth <str>: pat | oauth2 — which kind of profile to set up. [default: oauth2]--url <str>: DHIS2 base URL (also: DHIS2_URL env).--admin-user <str>: Admin username (for basic bootstrap).--client-id <str>: OAuth2 client_id to register (auth=oauth2). [default: dhis2-utils-local]--redirect-uri <str>: OAuth2 redirect URI. [default: http://localhost:8765]--scope <str>: OAuth2 scope. [default: ALL]--pat-description <str>: PAT description (auth=pat).--pat-expires-in-days <int>: PAT lifetime in days; omit for no expiry.--global: Save to ~/.config/dhis2/profiles.toml (default).--local: Save to ./.dhis2/profiles.toml instead.--login / --no-login: For auth=oauth2, runprofile loginafter saving. Ignored for auth=pat. [default: login]--version <str>: Expected DHIS2 major for this profile (v41 | v42 | v43). Used by CLI/MCP to pick which version's plugin tree to load; the wire client always auto-detects on connect.--help: Show this message and exit.
d2w profile oidc-config¶
Populate an OAuth2 profile by discovering a DHIS2 instance's OIDC endpoints.
Fetches /.well-known/openid-configuration from the given URL, validates the
response, and writes a profile with auth=oauth2 + your client credentials.
Removes the "hand-edit profiles.toml with the right issuer/auth/token URLs"
step from the OAuth2 setup walkthrough.
The URL can be either the DHIS2 base URL (discovery path is appended automatically) or the full discovery URL.
The client_secret never comes in via argv (it would leak to shell history / ps).
Read it from the DHIS2_OAUTH_CLIENT_SECRET env var or a hidden prompt when the
--client-secret flag is omitted.
Usage:
Arguments:
url: DHIS2 base URL or full /.well-known/openid-configuration URL. [required]
Options:
-n, --name <str>: Profile name to save as. [required]--client-id <str>: OAuth2 client_id (from your registration). [required]--client-secret <str>: OAuth2 client_secret. Omit to read DHIS2_OAUTH_CLIENT_SECRET env or a hidden prompt.--scope <str>: OAuth2 scope (DHIS2 only recognisesALL). [default: ALL]--redirect-uri <str>: OAuth2 redirect URI (match your registered client — default is the CLI's loopback listener). [default: http://localhost:8765]--global: Save to ~/.config/dhis2/profiles.toml (default, user-wide).--local: Save to ./.dhis2/profiles.toml instead (project-scoped).--default: Set as default after saving.--login: Triggerd2w profile login <name>immediately after saving.--version <str>: Expected DHIS2 major for this profile (v41 | v42 | v43). Used by CLI/MCP to pick which version's plugin tree to load; the wire client always auto-detects on connect.--help: Show this message and exit.
d2w profile pat¶
Personal Access Tokens — provision PATs on DHIS2.
Usage:
Options:
--help: Show this message and exit.
Commands:
create: Create a DHIS2 Personal Access Token via...
d2w profile pat create¶
Create a DHIS2 Personal Access Token via POST /api/apiToken.
Admin creds come from env or prompt (never argv). The PAT value is only returned once by DHIS2 — capture it here and pipe into a profile:
export DHIS2_PAT=$(d2w dev pat create --url $URL -q)
d2w profile add local --url $URL --auth pat
Or use d2w profile bootstrap --auth pat for a one-shot setup.
Usage:
Options:
--url <str>: DHIS2 base URL (also: DHIS2_URL env).--admin-user <str>--description <str>--expires-in-days <int>--allowed-ip <str>: IP allowlist entry; repeat for multiple.--allowed-method <str>: HTTP method allowlist; repeat for each method.--allowed-referrer <str>: Referer allowlist entry; repeat for multiple.-q, --quiet: Print only the PAT value, suitable for $(command substitution).--help: Show this message and exit.
d2w profile oauth2¶
Manage DHIS2 OAuth2 clients on the server (admin ops).
Usage:
Options:
--help: Show this message and exit.
Commands:
client: OAuth2 client registrations at...
d2w profile oauth2 client¶
OAuth2 client registrations at /api/oAuth2Clients.
Usage:
Options:
--help: Show this message and exit.
Commands:
register: Register an OAuth2 client on DHIS2 via...
d2w profile oauth2 client register¶
Register an OAuth2 client on DHIS2 via POST /api/oAuth2Clients.
Secrets (admin credentials, client_secret) come from env or interactive prompt — never argv.
Prints client_id + metadata UID so they can be piped into
d2w profile add --auth oauth2 .... For a one-shot bootstrap (register
+ save profile + log in) use d2w profile bootstrap instead.
Usage:
Options:
--url <str>: DHIS2 base URL (also: DHIS2_URL env).--admin-user <str>--client-id <str>: [default: dhis2-utils-local]--redirect-uri <str>: [default: http://localhost:8765]--scope <str>: [default: ALL]--name <str>--help: Show this message and exit.
d2w query¶
d2ql query + transform language.
Usage:
Options:
--help: Show this message and exit.
Commands:
eval: Run a d2ql program (inline or--file)...run: Run a d2ql program read from a file.explain: Show how a d2ql pipeline (inline or...ast: Print the parsed d2ql AST (no profile...d2path: Evaluate a bare d2path expression over a...repl: Interactive d2ql REPL.
d2w query eval¶
Run a d2ql program (inline or --file) against the active profile and render the rows.
Usage:
Arguments:
text: A d2ql program (quote it); or read one with --file.
Options:
-f, --file <path>: Read the d2ql program from this file.-d, --define <str>: Run/explain this named definition.-o, --out <str>: Write rows to this file (json/ndjson/csv).--help: Show this message and exit.
d2w query run¶
Run a d2ql program read from a file.
Usage:
Arguments:
file: Path to a .d2ql program file. [required]
Options:
-d, --define <str>: Run/explain this named definition.-o, --out <str>: Write rows to this file (json/ndjson/csv).--help: Show this message and exit.
d2w query explain¶
Show how a d2ql pipeline (inline or --file) splits between DHIS2 pushdown and local evaluation.
Usage:
Arguments:
text: A d2ql program (quote it); or read one with --file.
Options:
-f, --file <path>: Read the d2ql program from this file.-d, --define <str>: Run/explain this named definition.--help: Show this message and exit.
d2w query ast¶
Print the parsed d2ql AST (no profile needed; inline program or --file).
Usage:
Arguments:
text: A d2ql program (quote it); or read one with --file.
Options:
-f, --file <path>: Read the d2ql program from this file.--help: Show this message and exit.
d2w query d2path¶
Evaluate a bare d2path expression over a local JSON document (no profile needed).
Usage:
Arguments:
expression: A d2path expression (quote it). [required]
Options:
-i, --input <path>: JSON file to evaluate against. [required]--help: Show this message and exit.
d2w query repl¶
Interactive d2ql REPL. Uses the Textual TUI when the tui extra is installed, else line mode.
Usage:
Options:
--help: Show this message and exit.
d2w route¶
DHIS2 integration routes.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List registered routes.list: List registered routes.get: Fetch one route by UID or code.create: Create a route via POST /api/routes.update: Replace a route via PUT /api/routes/{uid}.patch: Apply a JSON Patch to a route via PATCH...delete: Delete a route.run: Execute a route — DHIS2 proxies the...
d2w route ls¶
List registered routes.
Usage:
Options:
--fields <str>: [default: id,code,name,url,disabled,auth]--help: Show this message and exit.
d2w route list¶
List registered routes.
Usage:
Options:
--fields <str>: [default: id,code,name,url,disabled,auth]--help: Show this message and exit.
d2w route get¶
Fetch one route by UID or code.
Usage:
Arguments:
route: Route UID (e.g. E8OPcc45A22) or code (e.g. chap). [required]
Options:
--fields <str>--help: Show this message and exit.
d2w route create¶
Create a route via POST /api/routes.
With --file: a full JSON spec. Omit auth (or set it to null) for no upstream auth.
Flag form: pass --code/--name/--url. Add --no-auth for an unauthenticated route (required
when not running in a TTY — the auth wizard needs interactive input). Secrets never come via
argv — they're read from env (DHIS2_ROUTE_UPSTREAM_*) or hidden prompts in the wizard.
Usage:
Options:
--file <path>: JSON file with the route definition (bypass the interactive wizard).--code <str>--name <str>--url <str>: Target URL the route proxies to.--authorities <str>: Comma-separated DHIS2 authorities allowed to run this route.--no-auth: Create an unauthenticated route (skip the auth wizard) — for headless/bridge use.--help: Show this message and exit.
d2w route update¶
Replace a route via PUT /api/routes/{uid}.
DHIS2 PUT expects the complete object. For partial updates use patch.
Usage:
Arguments:
route: Route UID (e.g. E8OPcc45A22) or code (e.g. chap). [required]
Options:
--file <path>: JSON file with the full route spec (PUT semantics). [required]--help: Show this message and exit.
d2w route patch¶
Apply a JSON Patch to a route via PATCH /api/routes/{uid}.
Usage:
Arguments:
route: Route UID (e.g. E8OPcc45A22) or code (e.g. chap). [required]
Options:
--file <path>: JSON Patch array (RFC 6902). [required]--help: Show this message and exit.
d2w route delete¶
Delete a route.
Usage:
Arguments:
route: Route UID (e.g. E8OPcc45A22) or code (e.g. chap). [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w route run¶
Execute a route — DHIS2 proxies the request to the configured target URL.
route accepts the route's UID or its code. When the route's target
URL ends in a wildcard (/**), --path SEGMENT is required: it is
what DHIS2 substitutes into the wildcard before calling upstream.
Usage:
Arguments:
route: Route UID (e.g. E8OPcc45A22) or code (e.g. chap). [required]
Options:
-X, --method <str>: [default: GET]--body <path>: JSON body file for POST/PUT.--path <str>: Additional path segment appended to the route's target URL.--help: Show this message and exit.
d2w security¶
DHIS2 security posture (read-only).
Usage:
Options:
--help: Show this message and exit.
Commands:
settings: Show the server's security-relevant system...authorities: Show my effective authorities, categorised...audit: Run the security checks step by step and...report: Re-render an existing run's report files...
d2w security settings¶
Show the server's security-relevant system settings. --json for the full payload.
Usage:
Options:
--help: Show this message and exit.
d2w security authorities¶
Show my effective authorities, categorised by security risk. --json for the full payload.
Usage:
Options:
--help: Show this message and exit.
d2w security audit¶
Run the security checks step by step and stream a report to a folder. --json prints the report.
Usage:
Options:
--output-dir <directory>: Parent directory for the run folder (default: current dir).--format <str>: Comma-separated formats: md,txt,csv,html (default: all).--checks <str>: Comma-separated check keys to run (default: all). Valid keys: version, transport, settings, authorities, roles, hygiene, credential-probe, guest, apps, sharing, auth-methods, tokens, routes, audit-config.--skip <str>: Comma-separated check keys to skip.--progress / --no-progress: Animate step-by-step progress on a TTY. [default: progress]--credential-probe / --no-credential-probe: Actively test the default admin/district login against /api/me (on by default). [default: credential-probe]--stale-days <int range>: Days without login before a privileged account is stale. [default: 90; x>=1]--max-password-age <int range>: Days before an unchanged password is treated as stale. [default: 365; x>=1]--two-factor-detail / --no-two-factor-detail: On v42+, also list each superuser lacking 2FA (per-user /api/users/twoFactor read). [default: no-two-factor-detail]--max-objects <int range>: Max objects the sharing scan inspects across all types before stopping (default 5000; truncation is loud). [x>=1]--sharing-graph, --visualize: Also write the interactive d3 sharing explorer (sharing-explorer.html) into the run folder.--resume <directory>: Resume an interrupted run folder.--dhis-conf <file>: Path to a local COPY of the server's dhis.conf for the audit-config check. The audit posture is not API-readable; secrets are reported set/not-set only and never echoed. [env var: DHIS2_CONF_LOCATION]--version-fallback / --no-version-fallback: When the server's exact generated tree is not shipped (e.g. a dev/master build), bind the nearest lower generated tree instead of failing. [default: no-version-fallback]--help: Show this message and exit.
d2w security report¶
Re-render an existing run's report files from its JSONL spine, without re-scanning.
Usage:
Arguments:
folder: An existing run folder to re-render. [required]
Options:
--format <str>: Comma-separated formats (default: all).--help: Show this message and exit.
d2w system¶
DHIS2 system info.
Usage:
Options:
--help: Show this message and exit.
Commands:
whoami: Expose everything DHIS2 reports about the...info: Print DHIS2 system info (version, build,...calendar: Print the active DHIS2 calendar, or change...settings: Read/write DHIS2 system settings.
d2w system whoami¶
Expose everything DHIS2 reports about the authenticated user. --json for the raw object.
Usage:
Options:
--help: Show this message and exit.
d2w system info¶
Print DHIS2 system info (version, build, analytics state, env).
Usage:
Options:
--help: Show this message and exit.
d2w system calendar¶
Print the active DHIS2 calendar, or change it when a value is supplied.
keyCalendar is the system-wide calendar DHIS2 uses to interpret periods.
The default is iso8601. Changing it is rare and risky — most instances
pick a calendar at deploy time and never touch it again. Switching the
calendar after data collection has started can leave existing periods
unreadable and break analytics, so this command requires interactive
confirmation (or --yes).
Usage:
$ d2w system calendar [OPTIONS] [value]:<coptic|ethiopian|gregorian|islamic|iso8601|julian|nepali|persian|thai>
Arguments:
value:<coptic|ethiopian|gregorian|islamic|iso8601|julian|nepali|persian|thai>: When supplied, writekeyCalendar(one of: coptic, ethiopian, gregorian, islamic, iso8601, julian, nepali, persian, thai). Omit to print the current calendar.
Options:
-y, --yes: Skip the interactive confirmation. Required for non-interactive callers (CI, scripts).--help: Show this message and exit.
d2w system settings¶
Read/write DHIS2 system settings.
Usage:
Options:
--help: Show this message and exit.
Commands:
set: Set a single system setting.set-many: Bulk-set system settings from a JSON file.get: Print one system setting's value; exit 1...ls: List every system setting (key = value).list: List every system setting (key = value).
d2w system settings set¶
Set a single system setting.
Usage:
Arguments:
key: System setting key (e.g. applicationTitle, keyApplicationFooter). [required]value: New value. [required]
Options:
--help: Show this message and exit.
d2w system settings set-many¶
Bulk-set system settings from a JSON file.
JSON scalars are coerced to the string form DHIS2 expects: booleans map to
lowercase true / false, numbers to their plain form, strings pass
through, and structured values (lists / objects) are re-serialized as JSON.
Usage:
Arguments:
file: JSON file containing a {key: value} object. [required]
Options:
--help: Show this message and exit.
d2w system settings get¶
Print one system setting's value; exit 1 if it is unset.
Usage:
Arguments:
key: System setting key (e.g. applicationTitle). [required]
Options:
--help: Show this message and exit.
d2w system settings ls¶
List every system setting (key = value).
Usage:
Options:
--help: Show this message and exit.
d2w system settings list¶
List every system setting (key = value).
Usage:
Options:
--help: Show this message and exit.
d2w user¶
DHIS2 user administration.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List users.list: List users.get: Fetch one user by UID or username.invite: Create a user and send the invitation email.reinvite: Re-send the invitation email for a pending...reset-password: Trigger DHIS2's password-reset email (POST...group: Manage DHIS2 user groups.role: Manage DHIS2 user roles.
d2w user ls¶
List users.
Examples: d2w user list d2w user list --filter 'disabled:eq:true' --order 'username:asc' d2w user list --filter 'username:like:admin'
Usage:
Options:
--fields <str>: DHIS2 field selector. Supports plain lists ('id,username,email'), presets (':identifiable', ':nameable', ':owner', ':all'), and exclusions (':all,!password'). [default: id,username,displayName,email,disabled,lastLogin]--filter <str>: Filter 'property:operator:value' (repeatable).--root-junction <str>: Combine repeated --filter as AND (default) or OR. [default: AND]--order <str>: Sort clause 'property:asc|desc' (repeatable).--page <int>: Server-side page number (1-based).--page-size <int>: Server-side page size (default 50).--help: Show this message and exit.
d2w user list¶
List users.
Examples: d2w user list d2w user list --filter 'disabled:eq:true' --order 'username:asc' d2w user list --filter 'username:like:admin'
Usage:
Options:
--fields <str>: DHIS2 field selector. Supports plain lists ('id,username,email'), presets (':identifiable', ':nameable', ':owner', ':all'), and exclusions (':all,!password'). [default: id,username,displayName,email,disabled,lastLogin]--filter <str>: Filter 'property:operator:value' (repeatable).--root-junction <str>: Combine repeated --filter as AND (default) or OR. [default: AND]--order <str>: Sort clause 'property:asc|desc' (repeatable).--page <int>: Server-side page number (1-based).--page-size <int>: Server-side page size (default 50).--help: Show this message and exit.
d2w user get¶
Fetch one user by UID or username. Prints a concise summary; --json for full payload.
Usage:
Arguments:
uid_or_username: User UID (11 chars) or username. [required]
Options:
--fields <str>: DHIS2 field selector.--help: Show this message and exit.
d2w user invite¶
Create a user and send the invitation email.
Hits POST /api/users/invite. DHIS2's configured mailer sends the link; the new user sets their password on accept. Prints the new user's UID.
Usage:
Arguments:
email: Email address for the new user (receives the invitation link). [required]
Options:
--first-name <str>: User's given name. [required]--surname <str>: User's surname. [required]--username <str>: Desired username. Omit to let DHIS2 derive from the email prefix.--user-role <str>: User-role UID (repeatable). Grants the role on accept.--org-unit, --ou <str>: Organisation-unit UID for capture scope (repeatable).--help: Show this message and exit.
d2w user reinvite¶
Re-send the invitation email for a pending user (POST /api/users/{uid}/invite).
Usage:
Arguments:
uid: UID of a user who hasn't yet completed their invite. [required]
Options:
--help: Show this message and exit.
d2w user reset-password¶
Trigger DHIS2's password-reset email (POST /api/users/{uid}/reset).
Usage:
Arguments:
uid: UID of the user to reset. [required]
Options:
--help: Show this message and exit.
d2w user group¶
Manage DHIS2 user groups.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List user groups.list: List user groups.get: Fetch one user group by UID.create: Create a user group (then add members with...delete: Delete a user group by UID.add-member: Add a user to a group (POST...remove-member: Remove a user from a group (DELETE...sharing-get: Print the current sharing block for one...sharing-grant-user: Grant one user access to a group (shortcut...
d2w user group ls¶
List user groups.
Usage:
Options:
--fields <str>: DHIS2 field selector. [default: id,name,displayName,users]--filter <str>: Filter 'property:operator:value' (repeatable).--order <str>: Sort clause 'property:asc|desc' (repeatable).--page-size <int>: Server-side page size.--help: Show this message and exit.
d2w user group list¶
List user groups.
Usage:
Options:
--fields <str>: DHIS2 field selector. [default: id,name,displayName,users]--filter <str>: Filter 'property:operator:value' (repeatable).--order <str>: Sort clause 'property:asc|desc' (repeatable).--page-size <int>: Server-side page size.--help: Show this message and exit.
d2w user group get¶
Fetch one user group by UID. Prints a concise summary; --json for full payload.
Usage:
Arguments:
uid: User-group UID. [required]
Options:
--fields <str>: DHIS2 field selector.--help: Show this message and exit.
d2w user group create¶
Create a user group (then add members with add-member).
Usage:
Options:
--name <str>: User-group name. [required]--code <str>: Business code.--uid <str>: Explicit 11-char UID.--help: Show this message and exit.
d2w user group delete¶
Delete a user group by UID.
Usage:
Arguments:
uid: User-group UID. [required]
Options:
-y, --yes: Skip the confirmation prompt.--help: Show this message and exit.
d2w user group add-member¶
Add a user to a group (POST /api/userGroups/<gid>/users/<uid>).
Usage:
Arguments:
group_uid: User-group UID. [required]user_uid: User UID to add. [required]
Options:
--help: Show this message and exit.
d2w user group remove-member¶
Remove a user from a group (DELETE /api/userGroups/<gid>/users/<uid>).
Usage:
Arguments:
group_uid: User-group UID. [required]user_uid: User UID to remove. [required]
Options:
--help: Show this message and exit.
d2w user group sharing-get¶
Print the current sharing block for one user group. --json for full payload.
Usage:
Arguments:
uid: User-group UID. [required]
Options:
--help: Show this message and exit.
d2w user group sharing-grant-user¶
Grant one user access to a group (shortcut over /api/sharing).
Preserves existing userAccesses/userGroupAccesses by fetching the current sharing block first, then appending the new grant.
Usage:
Arguments:
group_uid: User-group UID. [required]user_uid: User UID to grant. [required]
Options:
--metadata-write / --metadata-read: Grant metadata write (default) or read-only. [default: metadata-write]--help: Show this message and exit.
d2w user role¶
Manage DHIS2 user roles.
Usage:
Options:
--help: Show this message and exit.
Commands:
ls: List user roles.list: List user roles.get: Fetch one user role by UID.authority-list: Print the sorted authorities carried by...add-user: Grant a user a role (POST...remove-user: Revoke a role from a user (DELETE...
d2w user role ls¶
List user roles.
Usage:
Options:
--fields <str>: DHIS2 field selector. [default: id,name,displayName,authorities,users]--filter <str>: Filter (repeatable).--order <str>: Sort clause (repeatable).--page-size <int>: Server-side page size.--help: Show this message and exit.
d2w user role list¶
List user roles.
Usage:
Options:
--fields <str>: DHIS2 field selector. [default: id,name,displayName,authorities,users]--filter <str>: Filter (repeatable).--order <str>: Sort clause (repeatable).--page-size <int>: Server-side page size.--help: Show this message and exit.
d2w user role get¶
Fetch one user role by UID. Prints a concise summary; --json for full payload.
Usage:
Arguments:
uid: User-role UID. [required]
Options:
--fields <str>: DHIS2 field selector.--help: Show this message and exit.
d2w user role authority-list¶
Print the sorted authorities carried by one role, one per line.
Usage:
Arguments:
uid: User-role UID. [required]
Options:
--help: Show this message and exit.
d2w user role add-user¶
Grant a user a role (POST /api/userRoles/<rid>/users/<uid>).
Usage:
Arguments:
role_uid: User-role UID. [required]user_uid: User UID to grant the role to. [required]
Options:
--help: Show this message and exit.
d2w user role remove-user¶
Revoke a role from a user (DELETE /api/userRoles/<rid>/users/<uid>).
Usage:
Arguments:
role_uid: User-role UID. [required]user_uid: User UID to revoke the role from. [required]
Options:
--help: Show this message and exit.
d2w fhir¶
FHIR Implementation Guide generation from DHIS2 metadata.
Usage:
Options:
--help: Show this message and exit.
Commands:
init: Scaffold a dockerized SUSHI IG project...validate: Check the instance's codes for...generate: Generate FSH files from DHIS2 metadata...
d2w fhir init¶
Scaffold a dockerized SUSHI IG project with a fhir.toml for d2w fhir generate.
Usage:
Arguments:
directory: Project directory (default: current directory). [default: .]
Options:
--id <str>: IG package id. [default: dhis2.fhir.example]--canonical <str>: Canonical base URL for the IG (no trailing slash). [default: http://example.org/fhir]--name <str>: SUSHI name (default: derived from --id).--title <str>: IG title (default: derived from --name).--publisher <str>: Publisher name. [default: Example Organisation]--status <str>: IG life cycle, draft or active. Drives the sushi-config status and the status and experimental flag on every generated definitional resource. [default: draft]--publisher-url <str>: Publisher home page. Omit it unless you have a real site: the IG publisher links it from every generated page, and pointing it at the canonical yields one broken link per page.--profile <str>: DHIS2 profile to seed theprofilekey of the scaffolded fhir.toml with, sod2w fhir generatereads that instance without a flag. Offline: the name is written as given, never resolved against profiles.toml.--sushi-timeout <int>: Seconds the IG publisher gives its internal SUSHI run, written to[FSH] timeoutof ig/fsh.ini. The registry ships as pre-built JSON and never reaches SUSHI, so this bounds the FSH targets: an IG whose SUSHI run overruns the ceiling fails the build with exit 143. [default: 1800]--max-level <int>: Deepest organisation-unit level to generate, seeding[generate.organisation_units]max_level. Every unit emits two instances and a hierarchy fans out at the bottom, so this is the dial that bounds how many resources the IG publisher renders. Offline: the level is written to fhir.toml as given, never checked against an instance.--data-set <str>: Data set UID to seed[generate.data_sets]include_ids with (repeatable). Offline: the UID is written to fhir.toml as given, never checked against an instance.--event <str>: Event program UID to seed[generate.event_programs]include_ids with (repeatable). Offline: the UID is written to fhir.toml as given, never checked against an instance.--tracker-program <str>: Tracker program UID to seed[generate.tracker_programs]include_ids with (repeatable); the program emits one Questionnaire per program stage. Offline: the UID is written to fhir.toml as given, never checked against an instance.--force: Overwrite scaffold files that already exist.--refresh: Bring an existing project's scaffold-managed files up to date. Identity comes from the project's own fhir.toml, which a refresh never writes, and a file carrying a line the scaffold would not produce is left alone and reported, so your edits survive. Rejects --force.--help: Show this message and exit.
d2w fhir validate¶
Check the instance's codes for FHIR-safety; writes md/csv/pdf reports grouped by type. Exits 1 on errors.
Usage:
Options:
--report <file>: Report path stem, without extension (default: reports/fhir-validate-report under the project root or current directory).--format <str>: Comma-separated report formats to write: md, csv, pdf. [default: md,csv,pdf]--code-source <str>: Override[generate]concept_code_source for this run: id or code. In id mode the option code findings are informational; run with code to see what switching would cost.--all: List info-level findings individually instead of rolled up.--no-fail: Exit 0 even when errors are found.--help: Show this message and exit.
d2w fhir generate¶
Generate FSH files from DHIS2 metadata into the nearest FHIR project.
Usage:
Options:
--help: Show this message and exit.
Commands:
foundation: Generate the DHIS2 identifier aliases, the...option-sets: Generate CodeSystem/ValueSet JSON from...categories: Generate CodeSystem/ValueSet JSON from...questionnaires: Generate Questionnaire FSH into...examples: Generate example QuestionnaireResponses...org-units: Generate Organization/Location FSH from...pages: Generate the narrative site pages and the...all: Generate the foundation, terminology,...
d2w fhir generate foundation¶
Generate the DHIS2 identifier aliases, the extensions, and the capture contract into the FHIR project.
Usage:
Options:
--help: Show this message and exit.
d2w fhir generate option-sets¶
Generate CodeSystem/ValueSet JSON from DHIS2 option sets into the nearest FHIR project.
Usage:
Options:
--help: Show this message and exit.
d2w fhir generate categories¶
Generate CodeSystem/ValueSet JSON from DHIS2 categories into the nearest FHIR project.
Usage:
Options:
--help: Show this message and exit.
d2w fhir generate questionnaires¶
Generate Questionnaire FSH into data-sets/, event-programs/, tracker-programs/, and data-dictionary/.
A data set and an event program are one Questionnaire each; a tracker program is one Questionnaire per program stage, filed under the UID of the program it belongs to.
Usage:
Options:
--help: Show this message and exit.
d2w fhir generate examples¶
Generate example QuestionnaireResponses for every configured data set, event program, and tracker stage.
Usage:
Options:
--help: Show this message and exit.
d2w fhir generate org-units¶
Generate Organization/Location FSH from DHIS2 organisation units into the nearest FHIR project.
Usage:
Options:
--help: Show this message and exit.
d2w fhir generate pages¶
Generate the narrative site pages and the per-artifact intros into ig/input/pagecontent/.
Usage:
Options:
--help: Show this message and exit.
d2w fhir generate all¶
Generate the foundation, terminology, questionnaires, examples, org-unit instances, and the pages.
The questionnaire pass covers all four directories: data-sets/, event-programs/, tracker-programs/ (one file per stage, under its program's UID), and data-dictionary/.
Usage:
Options:
--help: Show this message and exit.