This repository contains two main functionalities:
- Metadata Offline Processor - Processes metadata for datasets, programs, permissions, and visualizations from JSON files to create a final package
- Metadata Comparator/Merge Tool - A web-based tool for comparing and selectively merging DHIS2 metadata JSON files
- Node.js (>=18.x)
-
Clone the repository:
git clone https://github.com/Eyeseetea/dhis2-metadata-skeleton.git cd dhis2-metadata-skeleton -
Install dependencies:
nvm use yarn install
src/- Source code for both CLI and web toolscapture/- Directory for dataset and program JSON filesvisualizations/- Directory for visualization JSON filespermissions/- Directory for permission JSON filesoutput/- Directory where processed output is saved
A command-line tool that processes metadata for datasets, programs, permissions, and visualizations from JSON files to create a final package for end users.
- Dataset Processing: Read and process dataset metadata
- Program Processing: Handle program metadata
- Permission Management: Process permission configurations
- Visualization Processing: Handle visualization definitions
- Batch Operations: Process multiple metadata files and combine them into a single output package
To run the metadata processor:
yarn start metadata buildThis command will:
- Read metadata files from the
capture/,visualizations/, andpermissions/directories - Process and validate the metadata
- Output the processed results to the
output/directory
A modern web-based tool that allows you to compare two DHIS2 metadata JSON files, visualize their differences, and selectively merge changes to create a unified metadata package. The application will open in your browser at http://localhost:8081 (or the port specified in the .env file).
- Side-by-Side Comparison: View two metadata JSON files with syntax highlighting
- Visual Diff Detection: Automatically identify and highlight differences
- Smart Merging: Selectively choose which changes to include from either file
- Granular Control: Accept or reject changes at the individual property level
- Batch Operations: Accept all changes from left or right file with a single click
- Live Preview: See the merged result in real-time before downloading
- Export: Download the merged metadata as a JSON file
- File Upload: Load metadata files from your computer or via command-line arguments
Start the comparator with file paths as arguments:
yarn start metadata compare -f=path/to/first-file.json -s=path/to/second-file.jsonOr using the shorter alias:
yarn compare-metadata -f=path/to/first-file.json -s=path/to/second-file.jsonAlternative long-form syntax:
yarn start metadata compare --file1=path/to/first-file.json --file2=path/to/second-file.jsonWhen file paths are provided, they are automatically loaded into the comparator.
If no file paths are provided, start the comparator:
yarn start metadata compareOr:
yarn compare-metadataThen:
- Click "Upload File 1" to select your base metadata JSON file
- Click "Upload File 2" to select the metadata file you want to compare/merge
- Review Differences - The tool automatically detects and displays all differences between the files
- Select Changes - For each difference, choose whether to keep the change from the left or right file
- Preview Merged Result - View the merged output in real-time
- Download Result - Export the final merged metadata as a JSON file
yarn testyarn build-folder