Migration Advice for Visits

I am trying to migrate data to OpenMRS. I have 1634497 visits (and growing at over 2000 per week) to migrate. Each of these has a unique number which I would like to preserve because many paper records have this number on them. My plan is to the REST API to load the data.

I am unsure how to add this data to a visit. Do I need to add a visit attribute type? (The current value is a positive integer.)

I would also like to be able query visits using this number.

Thank you, Tim

Yes you would need to create a visit attribute type for that unique number.

In order to query visits using this visit attribute type number, you will need to extend (a ticket and pull request to the webservices rest module) our REST API to add support for this. The underlying platform already has a JAVA API for it.

This is the REST part: https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/VisitResource1_9.java#L297-L308

And this is where it makes the platform API call: https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/VisitResource1_9.java#L315

This is the platform Java API: https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/VisitService.java#L256-L259