I’m coming to this discussion a little late, but I just wanted to chime in with our experience of building similar-but-different Event Capture programs across 40+ countries (https://equitytool.org). Our scenario was that the core program structure and indicator algorithms were the same across all countries, but things like the number of data elements, the data element names and the weightings differed significantly from country-to-country. The way we got around this was to create a dynamic Excel workbook which provided an area for easy user input of variables for each country, such as data element names and weightings, and a worksheet that used a master template plus these inputs to construct an XML metadata file for that specific country’s Event Capture program.
This was a lot of work to set up, but it has ensured very consistent quality of configurations across countries, and has made maintenance a lot easier. When we need to make corrections or updates to our core program, or we have to modify our programs to work with new versions of DHIS2, all we have to do is make the necessary adjustments once in the master Excel template, then re-generate all of the specific country XML metadata files (which can be re-imported to update existing deployments, since we also generate UIDs for all elements).
The effort involved in setting this up initially probably only makes it viable in a scenario where you have a lot of variation between countries, and need to provide ongoing management of updates etc; if you only have minor variation between countries, then I think Markus’ approach with constants + program rules to hide data elements etc would be much quicker and simpler to implement.
Regardless of the way forward you choose, I’d definitely recommend carefully thinking through how you will manage corrections and updates once all of these variations of the program are out there - eg the inevitable correction to the core program that needs to be sent out after deployment, or sharing an enhancement that a number of different countries have requested…