Iniz: support "wildcardInclusions"

@mksd and others:

The Iniz loader currently supports specifying a list of wildcard exclusions, and all files that match those patterns are excluded:

Thought about expanding this allow the specification of files to include, instead of exclude?

At PIH, we’d like a little more fine-grained control of what metadata we install where, and I think having this option would facilitate that.

In case you are interested in the weeds, in our Haiti implementation, there are some locations we only want to install at one of our sites (Mirebalais).

So I could see having two location csv files: locations.csv locations-mirebalais.

… where locations are installed at all the sites, but “location-mirebalais” is only installed at Mirebalais.

We’ve already got some custom code to invoke the Iniz loading:

… so one way for us to support this conditional-loading-by-site generically within our own implementations would be to modify the above code to call unsafeLoad first with an exclusion wildcard value like “-” (skip any file with a hyphen) and then again with an inclusion wildcard value of “*-[current_site_name]”.


Take care, Mark

Hi @mogoodrich,

In short: sure. For the record @ibacher and I we briefly discussed this on the original PR: Bundle a standalone validator tool · Issue #84 · mekomsolutions/openmrs-module-initializer · GitHub

We dropped it at the time, but basically the main question was to figure out what to do when both the inclusions and exclusions lists are specified at the same time for a domain?

Also for the record, this is the piece of code where deep down the wildcard exclusions list is eventually processed:

Cool, that makes total sense… I, do, was wondering what do it if someone try to do both an include and an exclude (and I think I agree with the @ibacher thought of not allowing both). I’ll dig into this deeper and come up with a proposal in the coming days/weeks.

@mksd @ibacher ticketed here:

I would expect inclusions to be processed first and exclusions second. Inclusions define the scope and exclusions filter within that scope. So, including “*.csv” and excluding “f*” would give you all CSVs that don’t start with an f.

That feels natural and is definitely fine with me, as long as it’s properly documented in the end.

@mogoodrich if you agree and that it responds to your use cases, you could add this in the issue’s description as part of the acceptance criteria?

1 Like

@mksd yep, makes sense to me, I will update/alter the issue…

1 Like