Skip to content

Commit 59c3281

Browse files
Merge pull request #5 from EyeSeeTea/feature/generic-config-CU-869bd706j
Add settings section to configure dataSet
2 parents 5f5c3af + 27707ba commit 59c3281

170 files changed

Lines changed: 4873 additions & 12654 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib"
3+
}

README.md

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
## Introduction
22

3-
_d2-reports_ than can be used as an standalone DHIS2 webapp or an standard HTML report (App: Reports). DHIS2 versions tested: 2.34.
4-
5-
## Reports
6-
7-
### NHWA Comments
8-
9-
This report shows data values for data sets `NHWA Module ...`. There are two kinds of data values displayed in the report table:
10-
11-
1. Data values that have comments.
12-
2. Data values related pairs (value/comment), which are rendered as a single row. The pairing criteria is:
13-
14-
- Comment data element `NHWA_Comment of Abc`.
15-
- Value data element: `NHWA_Abc`.
16-
17-
The API endpoint `/dataValueSets` does not provide all the features we need, so we use a custom SQL View instead.
3+
Data Approval App
184

195
## Initial setup
206

@@ -30,18 +16,65 @@ Start the development server at `http://localhost:8082` using `https://play.dhis
3016
$ PORT=8082 REACT_APP_DHIS2_BASE_URL="https://play.dhis2.org/2.34" yarn start
3117
```
3218

33-
## Deploy
19+
## Generate sql view for a dataSet
3420

35-
Create an standard report:
21+
Script to generate necessary sqlViews for dataSets and create a DataSetConfiguration.
22+
23+
If you want to persist the sqlViews and configuration to DHIS2 please configure the following variables in your `.env` file:
3624

3725
```
38-
$ yarn build-report # Creates dist/index.html
39-
$ yarn build-<key>-metadata -u 'user:pass' --url http://dhis2-server.org # Creates dist/metadata.json (key is a particular report group, e.g. nhwa)
40-
$ yarn post-<key>-metadata -u 'user:pass' --url http://dhis2-server.org # Posts dist/metadata.json (key is a particular report group, e.g. nhwa)
26+
REACT_APP_DHIS2_BASE_URL=http://localhost:8080
27+
REACT_APP_DHIS2_AUTH='admin:district'
4128
```
4229

43-
Create an standalone DHIS2 webapp app:
30+
Run the script:
31+
32+
```shell
33+
yarn run generate-sqlviews \
34+
--dataSet MY_DS_CODE \
35+
--dataSet-destination MY_DS_APPROVAL_CODE \
36+
--dataElement-submission DATAELEMENT_CODE_SUBMISSION-APVD \
37+
--dataElement-approval DATAELEMENT_CODE_APPROVAL_DATE-APVD \
38+
--persist dhis
39+
```
40+
41+
Parameters:
42+
43+
- `--dataSet` (`-ds`): dataSet code of the original dataSet
44+
- `--dataSet-destination` (`-ds-dest`): dataSet code of the destination/approval dataSet (required)
45+
- `--dataElement-submission` (`-de-sub`): dataElement code where the submission date is going to be saved (this must be in the APPROVAL dataSet)
46+
- `--dataElement-approval` (`-de-apprv`): dataElement code where the approval date is going to be saved (this must be in the APPROVAL dataSet)
47+
- `--persist`: save sqlViews to `dhis` or `disk`
48+
49+
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:
4456

4557
```
46-
$ yarn build-webapp # Creates dist/d2-reports.zip
58+
REACT_APP_DHIS2_BASE_URL=http://localhost:8080
59+
REACT_APP_DHIS2_AUTH='admin:district'
4760
```
61+
62+
Run the script:
63+
64+
```shell
65+
yarn run generate-dataset-approval --dataSet MY_DS_CODE \
66+
--dataElement-submission "MY_DS_CODE-Submission date module1-APVD" \
67+
--dataElement-approval "MY_DS_CODE-Approval date module1-APVD" \
68+
--persist
69+
```
70+
71+
Parameters:
72+
73+
- `--dataSet` (`-ds`): dataSet code of the original dataSet (required)
74+
- `--post`: commit metadata to DHIS2 (default: validate only)
75+
76+
Notes:
77+
78+
- Writes a metadata JSON file named `<dataSetCode>_<timestamp>.json` in the current directory.
79+
- Show dataElements without code and saves them to `warning_<dataSetCode>_<timestamp>.json`.
80+
- On validation/import errors, saves details to `errors_<dataSetCode>_<timestamp>.json`.

0 commit comments

Comments
 (0)