use of com.nedap.archie.rm.generic.PartySelf in project fhir-bridge by ehrbase.
the class EntryEntityConverter method convert.
@Override
public E convert(@NonNull R resource) {
E entity = convertInternal(resource);
entity.setLanguage(resolveLanguageOrDefault(resource));
entity.setSubject(new PartySelf());
return entity;
}
use of com.nedap.archie.rm.generic.PartySelf in project ehrbase by ehrbase.
the class EhrAccess method getStatus.
// get latest status
@Override
public EhrStatus getStatus() {
EhrStatus status = new EhrStatus();
status.setModifiable(isModifiable());
status.setQueryable(isQueryable());
// set otherDetails if available
if (getStatusAccess().getStatusRecord().getOtherDetails() != null) {
status.setOtherDetails(getStatusAccess().getStatusRecord().getOtherDetails());
}
// Locatable attribute
status.setArchetypeNodeId(getArchetypeNodeId());
Object name = new RecordedDvCodedText().fromDB(getStatusAccess().getStatusRecord(), STATUS.NAME);
status.setName(name instanceof DvText ? (DvText) name : (DvCodedText) name);
UUID statusId = getStatusAccess().getStatusRecord().getId();
status.setUid(new HierObjectId(statusId.toString() + "::" + getServerConfig().getNodename() + "::" + I_StatusAccess.getLatestVersionNumber(this, statusId)));
PartySelf partySelf = (PartySelf) new PersistedPartyProxy(this).retrieve(getParty());
status.setSubject(partySelf);
return status;
}
use of com.nedap.archie.rm.generic.PartySelf in project ehrbase by ehrbase.
the class PersistedPartySelf method render.
@Override
public PartyProxy render(PartyIdentifiedRecord partyIdentifiedRecord) {
PartyRef partyRef = null;
if (partyIdentifiedRecord.getPartyRefType() != null) {
ObjectId objectID = new PersistedObjectId().fromDB(partyIdentifiedRecord);
partyRef = new PartyRef(objectID, partyIdentifiedRecord.getPartyRefNamespace(), partyIdentifiedRecord.getPartyRefType());
}
return new PartySelf(partyRef);
}
use of com.nedap.archie.rm.generic.PartySelf in project ehrbase by ehrbase.
the class EhrController method createEhr.
@PostMapping
@ResponseStatus(value = HttpStatus.CREATED)
public // overwrites default 200, fixes the wrong listing of 200 in swagger-ui (EHR-56)
ResponseEntity<EhrResponseData> createEhr(@RequestParam(value = "subjectId", required = false) String subjectId, @RequestParam(value = "subjectNamespace", required = false) String subjectNamespace, @RequestParam(value = "committerId", required = false) String committerId, @RequestParam(value = "committerName", required = false) String committerName, @RequestHeader(value = "Content-Type", required = false) String contentType, @RequestBody(required = false) String content) {
// subjectId and subjectNamespace are not required by EhrScape spec but without those parameters a 400 error shall be returned
if ((subjectId == null) || (subjectNamespace == null)) {
throw new InvalidApiParameterException("subjectId or subjectNamespace missing");
} else if ((subjectId.isEmpty()) || (subjectNamespace.isEmpty())) {
throw new InvalidApiParameterException("subjectId or subjectNamespace emtpy");
}
EhrStatus ehrStatus = extractEhrStatus(content);
PartySelf partySelf = new PartySelf(new PartyRef(new HierObjectId(subjectId), subjectNamespace, null));
ehrStatus.setSubject(partySelf);
UUID ehrId = ehrService.create(ehrStatus, null);
// TODO: use config file or alike to set the basic api path
URI url = URI.create(getBaseEnvLinkURL() + "/rest/ecis/v1/ehr/" + ehrId.toString());
return Optional.ofNullable(ehrId).flatMap(i -> buildEhrResponseData(i, Action.CREATE, contentType)).map(ResponseEntity.created(url)::body).orElse(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build());
}
use of com.nedap.archie.rm.generic.PartySelf in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityWithAnyProxy.
@Test
public void testSaveCompositionEntityWithAnyProxy() {
ehr = openEhrClient.ehrEndpoint().createEhr();
GECCOSerologischerBefundComposition composition1 = new GECCOSerologischerBefundComposition();
composition1.setLanguage(Language.DE);
composition1.setTerritory(Territory.DE);
composition1.setCategoryDefiningCode(org.ehrbase.client.classgenerator.shareddefinition.Category.EVENT);
composition1.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
composition1.setComposer(new PartyIdentified(null, "Test", null));
composition1.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
composition1.setParticipations(new ArrayList<>());
composition1.setBefund(new ArrayList<>());
Enhancer enhancerObservation = new Enhancer();
enhancerObservation.setSuperclass(BefundObservation.class);
enhancerObservation.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
if (method.getDeclaringClass() != Object.class && method.getName().equals("getLanguage")) {
return Language.EN;
} else {
return proxy.invokeSuper(obj, args);
}
});
BefundObservation befundObservation = (BefundObservation) enhancerObservation.create();
composition1.getBefund().add(befundObservation);
befundObservation.setSubject(new PartySelf());
befundObservation.setJedesEreignis(new ArrayList<>());
// Read will be overwritten by enhancerObservation
befundObservation.setLanguage(Language.DE);
befundObservation.setAnforderungDefiningCode(AnforderungDefiningCode.SARS_COV2_COVID19_AB_PANEL_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
befundObservation.setOriginValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
BefundJedesEreignisPointEvent event = new BefundJedesEreignisPointEvent();
event.setTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
event.setLabortestBezeichnungDefiningCode(LabortestBezeichnungDefiningCode.SEROLOGIC_TEST_PROCEDURE);
event.setVirusnachweistestDefiningCode(VirusnachweistestDefiningCode.SARS_COV2_COVID19_AB_PRESENCE_IN_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
event.setErgebnisStatusValue("registered");
befundObservation.getJedesEreignis().add(event);
Enhancer enhancerProAnalytQuantitativesErgebnisDvCount = new Enhancer();
enhancerProAnalytQuantitativesErgebnisDvCount.setSuperclass(ProAnalytQuantitativesErgebnisDvCount.class);
enhancerProAnalytQuantitativesErgebnisDvCount.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
if (method.getDeclaringClass() != Object.class && method.getName().equals("getQuantitativesErgebnisMagnitude")) {
return 33l;
} else {
return proxy.invokeSuper(obj, args);
}
});
ProAnalytQuantitativesErgebnisDvCount quantitativesErgebnis = (ProAnalytQuantitativesErgebnisDvCount) enhancerProAnalytQuantitativesErgebnisDvCount.create();
quantitativesErgebnis.setQuantitativesErgebnisMagnitude(22l);
event.setQuantitativesErgebnis(quantitativesErgebnis);
GECCOSerologischerBefundComposition composition = composition1;
composition = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(composition);
Optional<GECCOSerologischerBefundComposition> actual = openEhrClient.compositionEndpoint(ehr).find(composition.getVersionUid().getUuid(), GECCOSerologischerBefundComposition.class);
assertThat(actual).isPresent();
assertThat(actual.get().getBefund()).size().isEqualTo(1);
BefundObservation actualObservation = actual.get().getBefund().get(0);
assertThat(actualObservation.getLanguage()).isEqualTo(Language.EN);
assertThat(actualObservation.getJedesEreignis()).size().isEqualTo(1);
assertThat(actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis()).isNotNull();
assertThat(actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis().getClass()).isEqualTo(ProAnalytQuantitativesErgebnisDvCount.class);
assertThat(((ProAnalytQuantitativesErgebnisDvCount) actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis()).getQuantitativesErgebnisMagnitude()).isEqualTo(33L);
}
Aggregations