Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
Release 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
subigre committed Mar 21, 2022
2 parents b1a9260 + 967073b commit 7ad847c
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>org.ehrbase.fhirbridge</groupId>
<artifactId>fhir-bridge</artifactId>
<version>1.4.2</version>
<version>1.5.0</version>

<name>FHIR Bridge</name>

Expand Down Expand Up @@ -297,6 +297,10 @@
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-elasticsearch</artifactId>
</exclusion>
<exclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void process(Exchange exchange) throws Exception {
if (subject.hasReference()) {
Patient patient = patientDao.read(subject.getReferenceElement());
patientId = patient.getIdElement();
subject.setResource(patient);
} else if (hasIdentifier(subject)) {
patientId = handleSubjectIdentifier(subject, requestDetails);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.nedap.archie.rm.archetyped.FeederAuditDetails;
import com.nedap.archie.rm.datavalues.DvIdentifier;
import org.ehrbase.client.classgenerator.interfaces.RMEntity;
import org.ehrbase.fhirbridge.fhir.support.Resources;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Resource;
import org.springframework.lang.NonNull;

Expand All @@ -39,14 +41,42 @@ protected FeederAudit buildFeederAudit(@NonNull S resource) {
FeederAudit result = new FeederAudit();
String systemId = resource.getMeta().hasSource() ? resource.getMeta().getSource() : DEFAULT_SYSTEM_ID;
result.setOriginatingSystemAudit(new FeederAuditDetails(systemId, null, null, null, null, null, null));

List<DvIdentifier> identifiers = new ArrayList<>();

if (resource.hasId()) {
DvIdentifier identifier = new DvIdentifier();
identifier.setId(resource.getId());
identifier.setType("fhir_logical_id");
List<DvIdentifier> identifiers = new ArrayList<>();
identifiers.add(identifier);
result.setOriginatingSystemItemIds(identifiers);
}

identifiers.addAll(subjectIdentifiers(resource));

result.setOriginatingSystemItemIds(identifiers);
return result;
}

protected List<DvIdentifier> subjectIdentifiers(S resource) {
List<DvIdentifier> identifiers = new ArrayList<>();

Resources.getSubject(resource)
.ifPresent(reference -> {
var id = new DvIdentifier();
id.setAssigner("fhir_patient_id");
id.setId(reference.getReferenceElement().getValue());
identifiers.add(id);

var identifier = new DvIdentifier();
identifier.setType("fhir_patient_identifier");
if (reference.hasIdentifier()) {
identifier.setId(reference.getIdentifier().getValue());
} else {
identifier.setId(((Patient) reference.getResource()).getIdentifierFirstRep().getValue());
}
identifiers.add(identifier);
});

return identifiers;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.ehrbase.fhirbridge.ehr.converter.generic;

import com.nedap.archie.rm.datavalues.DvIdentifier;
import com.nedap.archie.rm.generic.PartyIdentified;
import com.nedap.archie.rm.generic.PartyProxy;
import com.nedap.archie.rm.generic.PartySelf;
Expand All @@ -8,6 +9,8 @@
import org.hl7.fhir.r4.model.Patient;
import org.springframework.lang.NonNull;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

public abstract class PatientToCompositionConverter<C extends CompositionEntity> extends CompositionConverter<Patient, C> {
Expand All @@ -29,4 +32,21 @@ protected PartyProxy convertComposer(Patient resource) {
protected Optional<PartyIdentified> convertHealthCareFacility(Patient resource) {
return Optional.empty();
}

@Override
protected List<DvIdentifier> subjectIdentifiers(Patient patient) {
List<DvIdentifier> identifiers = new ArrayList<>();

var id = new DvIdentifier();
id.setAssigner("fhir_patient_id");
id.setId(patient.getId());
identifiers.add(id);

var identifier = new DvIdentifier();
identifier.setType("fhir_patient_identifier");
identifier.setId(patient.getIdentifierFirstRep().getValue());

identifiers.add(identifier);
return identifiers;
}
}

0 comments on commit 7ad847c

Please sign in to comment.