Skip to content

Commit ccd5871

Browse files
committed
add script to generate dataSet approvals
1 parent 1ae0f16 commit ccd5871

6 files changed

Lines changed: 691 additions & 1290 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,31 @@ Parameters:
4747
- `--persist`: save sqlViews to `dhis` or `disk`
4848

4949
When `--persist dhis` is used, the script also creates a DataSetConfiguration in the DHIS2 DataStore with `submitAndComplete: true`, `revokeAndIncomplete: true`, and empty permissions (only admin users have access to this dataSet. You can edit this in the settings page of the application).
50+
51+
## Generate DataSet Approval metadata
52+
53+
Script to clone an existing DataSet and its DataElements with the `-APVD` suffix, generating a new approval DataSet and metadata file.
54+
55+
Make sure the following variables are configured in your `.env` file:
56+
57+
```
58+
REACT_APP_DHIS2_BASE_URL=http://localhost:8080
59+
REACT_APP_DHIS2_AUTH='admin:district'
60+
```
61+
62+
Run the script:
63+
64+
```shell
65+
yarn run generate-dataset-approval --dataSet MY_DS_CODE
66+
```
67+
68+
Parameters:
69+
70+
- `--dataSet` (`-ds`): dataSet code of the original dataSet (required)
71+
- `--post`: commit metadata to DHIS2 (default: validate only)
72+
73+
Notes:
74+
75+
- Writes a metadata JSON file named `<dataSetCode>_<timestamp>.json` in the current directory.
76+
- Skips dataElements without code and saves them to `skipped_<dataSetCode>_<timestamp>.json`.
77+
- On validation/import errors, saves details to `errors_<dataSetCode>_<timestamp>.json`.

0 commit comments

Comments
 (0)