Need help defining the app.json for multiple patient identifiers in the registration app and identifier location error

OpenMRS Reference Application Version: 2.5 Registration App Version: 1.7-SNAPSHOT

I saw this commit in August that allows you to collect patient identifiers in the registration app. I built the code and am running it on Reference Application v2.5 for testing. I’m trying to build the app.json section and fields to be able to collect the identifiers and get an error when trying to save the form.

Here’s the app configuration I’m pasting into the Manage Apps page:

{
"id": "testregistrationapp.basicRegisterPatient",
"instanceOf": "registrationapp.registerPatient",
"label": "Register Patient",
"description": "Create a new Patient Record",
"extensions": [
	{
		"id": "registrationapp.basicRegisterPatient.homepageLink",
		"extensionPointId": "org.openmrs.referenceapplication.homepageLink",
		"type": "link",
		"label": "registrationapp.app.registerPatient.label",
		"url": "registrationapp/registerPatient.page?appId=testregistrationapp.basicRegisterPatient",
		"icon": "icon-user",
		"order": 1,
		"requiredPrivilege": "App: registrationapp.registerPatient"
	}
],
"config": {
	"afterCreatedUrl": "/coreapps/clinicianfacing/patient.page?patientId={{patientId}}",
	"sections": [
		{
			"id": "contactInfo",
			"label": "registrationapp.patient.contactInfo.label",
			"questions": [
				{
					"legend": "registrationapp.patient.phone.label",
					"id": "phoneNumberLabel",
					"fields": [
						{
							"type": "personAttribute",
							"label": "registrationapp.patient.phone.question",
							"formFieldName": "phoneNumber",
							"uuid": "14d4f066-15f5-102d-96e4-000c29c2a5d7",
							"widget": {
								"providerName": "uicommons",
								"fragmentId": "field/text"
							},
							"cssClasses": ["phone"]
						}
					]
				}
			]
		},
		{
			"id": "patient-identification",
			"label": "Patient-Identifier(s)",
			"questions": [
				{
					"legend": "Old Identification Number",
					"id": "Old_Identification_Number_patientIdentifier",
					"fields": [
						{
							"type": "patientIdentifier",
							"label": "Old Identification Number",
							"formFieldName": "oldIdentificationNumber",
							"uuid": "8d79403a-c2cc-11de-8d13-0010c6dffd0f",
							"widget": {
								"providerName": "uicommons",
								"fragmentId": "field/text"
							}
						}
					]
				}
			]
		}
	]
}

}

Questions:

  • Is it correct to assume that I could collect multiple patient identifiers in this way?
  • Are there any fields I can add to the patient-identifier(s) question set that would automatically capture the current login location?

FYI: @mogoodrich, @jmaxy, @arbaughj

1 Like

If you don’t actually need to capture the location, then you could set the PatientIdentifierType.locationBehavior to NOT_USED (here it is in code: https://github.com/openmrs/openmrs-core/blob/2.0.4.1/api/src/main/java/org/openmrs/PatientIdentifierType.java#L35)

(In fact PatientIdentifier.location is supposed to represent the authority who assigned the identifier, within whose remit it’s meaningful and unique. So you probably don’t actually want to default to login location.)

1 Like

Thanks! I updated the documentation to this effect.

@mogoodrich I left a placeholder in the documentation around manual identifier override, but didn’t have the knowledge to complete it. Can you point me to a sample app.json?

@craigappl just took a quick look at this and I don’t think I have a good example. It looks like if you set “allowManualdentifier” to “true”, but don’t specify a custom identifier section, the registration app will automatically add a section that allows the use to decide whether or not to manually enter a patient identifier.

However, if you do specify your own identifier section, it doesn’t show this–so you’d need to manually configure it yourself. I haven’t tested it, but by glancing at the code I think you’d want to add a field with a widget configured like this:

"widget": {
     "providerName": "registrationapp",
     "fragmentId": "field/allowManualIdentifier",
     "config" : {
        "identifierTypeName": "Whatever display name you want"
        }
}

(I think that widget would be enough, you don’t need to specify formFieldName, uuid, etc)

@craigappl did you make any headway with the suggestion?

And I am wondering if the manual identifier can be optional as is the case in our implementation since I ran into this issue [SOLVED] Preferred Identifier - Patient Registration + Removing Automatic Assignment Question