ssmusoke
(Stephen Senkomago Musoke)
September 11, 2016, 5:49pm
1
I am looking for examples on how to import locations and address hierarchy via meta data deploy via code from CSV files.
The example for locations https://wiki.openmrs.org/display/docs/Metadata+Deploy+Module#MetadataDeployModule-Bundles does not include:
Parent locations - via uuids
Location tags - via uuids
The location class https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/Location.java only allows addition of a parent location via the locationid which is not possible when the locations are being loaded from a CSV file since only the uuids are available at the time of loading from CSV source.
The address hierarchy only shows how to load the file via the UI but not via code
darius
(Darius Jazayeri)
September 13, 2016, 12:38am
2
You would need to ultimately leverage this method to load a location with a parent and tags via metadatadeploy: https://github.com/openmrs/openmrs-module-metadatadeploy/blob/1.7/api/src/main/java/org/openmrs/module/metadatadeploy/bundle/CoreConstructors.java#L235
To achieve this via a CSV I would suggest that you let CSV columns contain parentLocation.name, and tag.name, and you look up the uuids for these while loading.
ssmusoke
(Stephen Senkomago Musoke)
September 13, 2016, 8:25am
3
@darius thank you very much the Location core constructor solves the issue that I had.
For the address hierarchy I used the example of the HaitiAddressBundle here https://github.com/PIH/openmrs-module-pihcore/blob/e45677a1e66bbbac7bbf8ccf6ef95f4cfe0ea79c/api/src/main/java/org/openmrs/module/pihcore/deploy/bundle/haiti/HaitiAddressBundle.java
@mogoodrich any thoughts of moving the address bundles to the Address Hierarchy Module?