Metadata Sync is a DHIS2 Web Application part of EyeSeeTea's DHIS2 Suite that simplifies and automates the process of sending data and metadata from one DHIS2 instance to one or several other DHIS2 implementations, however different they might be. You can watch a presentation video of the app
You can find a user guide at the wiki and there are also several video tutorials available.
You can download Metadata Sync from the DHIS2 App Hub
For more links, see the Metadata Sync App website
Metadata Sync development is sustainable thanks to the partners for which we build customized DHIS2 solutions. This application has been funded by the WHO Global Malaria Programme, Medecins Sans Frontières (MSF), Samaritan’s Purse, Health Information Systems Program South Africa and the U.S. President’s Malaria Initiative (PMI) to support countries in strengthening the collection and use of health data by using DHIS2.
It has also been funded by WHO and the WHO Integrated Data Platform (WIDP), where several WHO departments and units share a dedicated hosting and maintenance provided by EyeSeeTea, back some specific new features. The Long Term Agreement EyeSeeTea holds with WHO for this maintenance includes maintenance of this application, ensuring that it will always work at least with the last version of WIDP. We are passionate about both DHIS2 and open source, so giving back to the community through dedicated open-source development is and will always be part of EyeSeeTea’s commitment. You can also support our work through a one-time contribution or becoming a regular github sponsor
We’d like to hear your thoughts on the app in general, improvements, new features or any of the technologies being used. Just drop as a line at community@eyeseetea.com and let us know! If you prefer, you can also create a new issue on our GitHub repository. Note that you will have to register and be logged in to GitHub to create a new issue.
$ nvm use # uses node version in .nvmrc if present
$ yarn install
This project uses Yarn 4 managed by Corepack and declares:
"packageManager": "yarn@4.12.0"To avoid Corepack modifying the package.json of other projects when you run corepack enable or yarn in repositories that do not define packageManager, it is recommended to disable the global auto‑pin:
- Open your shell configuration (
zsh):
nano ~/.zshrc # or use code/vim, etc.- Add this line at the end of the file:
export COREPACK_ENABLE_AUTO_PIN=0- Reload the configuration in the current session:
source ~/.zshrc- Verify that it is active:
echo $COREPACK_ENABLE_AUTO_PIN
# should print: 0From that point on, with corepack enable active, when you run yarn in projects without packageManager, Corepack will no longer add the packageManager field automatically to their package.json.
If running yarn shows an error like:
This project's package.json defines "packageManager": "yarn@4.12.0". However the current global version of Yarn is 1.22.x.
do the following once on your machine:
# 1) Remove global Yarn (optional but recommended)
npm uninstall -g yarn
# 2) Enable Corepack (shipped with Node 16.9+ / 14.19+)
corepack enable
# 3) Set Yarn 1.x as the default for projects WITHOUT packageManager
corepack prepare yarn@1.22.22 --activateThen, in this project (normal case, once Corepack is enabled):
nvm use # use the version from .nvmrc
yarn installIf for some reason yarn --version still shows 1.x inside this repo (for example due to old Corepack state), prepare the Yarn 4 binary without changing the global default or package.json:
COREPACK_ENABLE_AUTO_PIN=0 corepack prepare yarn@4.12.0
yarn --version # should now print 4.12.0
yarn installAfter this:
- This repo will use Yarn 4.12.0.
- Other repos without
packageManagerwill keep using Yarn 1.22.22 (or whatever you activated withcorepack prepare).
File public/app-config.json must be created by duplicating public/app-config.template.json and filling in the encryptionKey.
The app uses the DHIS2 data store to persist custom data. Whenever the schema of the data store changes, we'll create a migration task with an incremental version. *.ts files in this folder are automatically loaded.
When writing a migration, we must define the old/new types of data structures used in that migration task. Note that we cannot rely on types on the app, as they may have diverged. For fields/objects we must reference but don't care the type, we will use unknown (not any).
When the app starts, it will check the data store version and open a dialog if a migration is required. You can also run the migrations on the CLI:
$ yarn migrate 'http://admin:PASSWORD@localhost:8080'
The app provides a server-side scheduler script that runs synchronization rules in the background. The script requires Node v10+.
- Unzip metadata-synchronization-server.zip and can be executed like this:
$ cd metadata-synchronization-server
$ node index.js -c app-config.json
To connect to the destination instance, it requires a configuration file. If no configuration file is supplied the following is used as a placeholder:
{
"encryptionKey": "encryptionKey",
"baseUrl": "https://play.dhis2.org/2.30",
"username": "admin",
"password": "district"
}$ yarn start
Now in your browser, go to http://localhost:8081.
Notes:
-
Requests to DHIS2 will be transparently proxied (see
src/setupProxy.js) fromhttp://localhost:8081/dhis2/pathtohttp://localhost:8080/pathto avoid CORS and cross-domain problems. -
The optional environment variable
VITE_DHIS2_AUTH=USERNAME:PASSWORDforces some credentials to be used by the proxy. This variable is usually not set, so the app has the same user logged in atVITE_DHIS2_BASE_URL. -
Create a file
.env.local(copy it from.env) to customize environment variables so you can simply runyarn start. -
why-did-you-render is installed and runs in development mode by default. Edit
src/presentation/utils/wdyr.tsto customize or disable it.
$ yarn start -p 8082 core-app|data-metadata-app|module-package-app|modules-list|package-exporter|msf-aggregate-data-app
This will open the development server for the given front-end at port 8082 and will connect to DHIS 2 instance http://localhost:8080.
VITE_DHIS2_BASE_URL=http://localhost:8080
To use a different DHIS2 instance url set this environment variable before running a start command.
Run unit tests:
$ yarn test
To build all the front-ends:
$ yarn build
To build a given front-end:
$ yarn build [all|core-app|data-metadata-app|module-package-app|modules-list|package-exporter|msf-aggregate-data-app|sp-emergency-responses|wmr]
yarn build already builds the scheduler and emits the metadata-synchronization-server.zip file
alongside the front-end zips, so it is always included in releases.
To build the scheduler on its own:
$ yarn build-scheduler
This script generate a metadata-synchronization-server.zip file.
$ yarn update-po
# ... add/edit translations in po files ...
$ yarn localize
These commands use @dhis2/cli-app-scripts through d2-app-scripts i18n extract and d2-app-scripts i18n generate.
Check for unused or missing dependencies:
$ yarn run depcheck

