I am currently working on [FM2-591] toOpenmrsType translator for ServiceRequest should be implemented - OpenMRS Issues which ensures to implement the toOpenmrsType method for the ServiceRequest resource. This ticket is depended on by [FM2-584] Add support for Json Merge Patch operations - ServiceRequest Resource - OpenMRS Issues.
I have translated concept, subject, encounter and orderer with a snippet like shown below;-
@Override
public TestOrder toOpenmrsType(@Nonnull TestOrder currentTestOrder, @Nonnull ServiceRequest serviceRequest) {
notNull(currentTestOrder, "The existing Openmrs TestOrder object should not be null");
notNull(serviceRequest, "The ServiceRequest object should not be null");
if (serviceRequest.hasId()) {
currentTestOrder.setUuid(serviceRequest.getIdElement().getIdPart());
}
currentTestOrder.setConcept(conceptTranslator.toOpenmrsType(serviceRequest.getCode()));
currentTestOrder.setPatient(patientReferenceTranslator.toOpenmrsType(serviceRequest.getSubject()));
currentTestOrder.setEncounter(encounterReferenceTranslator.toOpenmrsType(serviceRequest.getEncounter()));
currentTestOrder.setOrderer(providerReferenceTranslator.toOpenmrsType(serviceRequest.getRequester()));
return currentTestOrder;
}
I however realise according to the toFhirResource, there are elements like occurence, performer that don’t really have direct elements in the TestOrder object. How do i go about that? or is it that not every element has got to be translated? An overview of how these translations should be done maybe?