use of com.nedap.archie.rm.datavalues.DvIdentifier in project fhir-bridge by ehrbase.
the class ReferenceToPartyIdentifiedConverter method convert.
@Override
public PartyIdentified convert(Reference source) {
if (source == null) {
return null;
}
PartyIdentified partyIdentified = new PartyIdentified();
DvIdentifier identifier = new DvIdentifier();
if (source.hasReference()) {
identifier.setId(source.getReference());
} else if (source.hasIdentifier()) {
identifier.setAssigner(source.getIdentifier().getSystem());
identifier.setId(source.getIdentifier().getValue());
} else {
throw new ConversionException("Reference should have either a reference or an identifier");
}
partyIdentified.addIdentifier(identifier);
return partyIdentified;
}
use of com.nedap.archie.rm.datavalues.DvIdentifier in project fhir-bridge by ehrbase.
the class DvIdentifierParser method parseIdentifierIntoDvIdentifier.
public static DvIdentifier parseIdentifierIntoDvIdentifier(Identifier identifier) {
DvIdentifier dvIdentifier = new DvIdentifier();
setDvIdentifierAssinger(dvIdentifier, identifier);
setDvIdentifierId(dvIdentifier, identifier);
setDvIdentifierType(dvIdentifier, identifier);
return dvIdentifier;
}
use of com.nedap.archie.rm.datavalues.DvIdentifier in project ehrbase by ehrbase.
the class ContextAccess method mapRmEventContext.
/**
* @throws InternalServerException on failure of decoding DvText or DvDateTime
*/
@Override
public EventContext mapRmEventContext() {
// get the facility entry
PartyIdentifiedRecord partyIdentifiedRecord = getContext().fetchOne(PARTY_IDENTIFIED, PARTY_IDENTIFIED.ID.eq(eventContextRecord.getFacility()));
// facility identifiers
PartyIdentified healthCareFacility = null;
if (partyIdentifiedRecord != null) {
List<DvIdentifier> identifiers = new ArrayList<>();
getContext().fetch(IDENTIFIER, IDENTIFIER.PARTY.eq(partyIdentifiedRecord.getId())).forEach(record -> {
DvIdentifier dvIdentifier = new DvIdentifier();
dvIdentifier.setIssuer(record.getIssuer());
dvIdentifier.setAssigner(record.getAssigner());
dvIdentifier.setId(record.getIdValue());
dvIdentifier.setType(record.getTypeName());
identifiers.add(dvIdentifier);
});
// get PartyRef values from record
healthCareFacility = getPartyIdentifiedFromRecord(partyIdentifiedRecord, identifiers);
}
List<Participation> participationList = new ArrayList<>();
// get the participations
getContext().fetch(PARTICIPATION, PARTICIPATION.EVENT_CONTEXT.eq(eventContextRecord.getId())).forEach(record -> {
// retrieve performer
PartyProxy performer = new PersistedPartyProxy(this).retrieve(record.getPerformer());
DvInterval<DvDateTime> dvInterval = convertDvIntervalDvDateTimeFromRecord(record);
DvCodedText mode = convertModeFromRecord(record);
Participation participation = new Participation(performer, (DvText) new RecordedDvCodedText().fromDB(record, PARTICIPATION.FUNCTION), mode, dvInterval);
participationList.add(participation);
});
DvCodedText concept = (DvCodedText) new RecordedDvCodedText().fromDB(eventContextRecord, EVENT_CONTEXT.SETTING);
ItemStructure otherContext = null;
if (eventContextRecord.getOtherContext() != null) {
otherContext = new RawJson().unmarshal((eventContextRecord.getOtherContext().data()), ItemStructure.class);
}
return new EventContext(healthCareFacility, new RecordedDvDateTime().decodeDvDateTime(eventContextRecord.getStartTime(), eventContextRecord.getStartTimeTzid()), new RecordedDvDateTime().decodeDvDateTime(eventContextRecord.getEndTime(), eventContextRecord.getEndTimeTzid()), participationList.isEmpty() ? null : participationList, eventContextRecord.getLocation(), concept, otherContext);
}
use of com.nedap.archie.rm.datavalues.DvIdentifier in project ehrbase by ehrbase.
the class BaseServiceImp method getUserUuid.
/**
* Get default user UUID, derived from authenticated user via Spring Security.<br> Internally
* checks and retrieves the matching user UUID, if it already exists with given info.
*
* @return UUID of default user, derived from authenticated user.
*/
protected UUID getUserUuid() {
var name = authenticationFacade.getAuthentication().getName();
List<DvIdentifier> identifiers = new ArrayList<>();
var identifier = new DvIdentifier();
identifier.setId(name);
identifier.setIssuer("EHRbase");
identifier.setAssigner("EHRbase");
identifier.setType("EHRbase Security Authentication User");
identifiers.add(identifier);
// for matching name + identifiers. So it will find already created parties for existing users.
return new PersistedPartyProxy(getDataAccess()).getOrCreate("EHRbase Internal " + name, UUID.randomUUID().toString(), DEMOGRAPHIC, "User", PARTY, identifiers);
}
use of com.nedap.archie.rm.datavalues.DvIdentifier in project openEHR_SDK by ehrbase.
the class UnflattenerTest method testUnflattenEpsiode.
@Test
public void testUnflattenEpsiode() {
EpisodeOfCareComposition episode = buildEpisodeOfCareComposition();
Unflattener cut = new Unflattener(new TestDataTemplateProvider());
Composition actual = (Composition) cut.unflatten(episode);
assertThat(actual).isNotNull();
assertThat(actual.getContent()).size().isEqualTo(1);
AdminEntry actualAdminEntry = (AdminEntry) actual.getContent().get(0);
List<Object> identifiers = actualAdminEntry.itemsAtPath("/data[at0001]/items[at0002]/value");
assertThat(identifiers).extracting(i -> ((DvIdentifier) i).getId()).containsExactlyInAnyOrder("123", "456");
List<Object> uris = actualAdminEntry.itemsAtPath("/data[at0001]/items[at0013]/value");
assertThat(uris).extracting(u -> ((DvURI) u).getValue()).containsExactlyInAnyOrder(URI.create("https://github.com/ehrbase"));
}
Aggregations