mirror of
https://github.com/pcvolkmer/mv64e-etl-processor
synced 2025-09-13 17:02:52 +00:00
Compare commits
4 Commits
master
...
gics-provi
Author | SHA1 | Date | |
---|---|---|---|
|
4bd6117ba8 | ||
|
ace5637ed8 | ||
|
88857cf201 | ||
|
db89d84353 |
@@ -39,6 +39,8 @@ public class GicsConsentService implements IConsentService {
|
|||||||
private final RestTemplate restTemplate;
|
private final RestTemplate restTemplate;
|
||||||
private final FhirContext fhirContext;
|
private final FhirContext fhirContext;
|
||||||
private final GIcsConfigProperties gIcsConfigProperties;
|
private final GIcsConfigProperties gIcsConfigProperties;
|
||||||
|
private final String BROAD_CONSENT_PROFILE_URI = "https://www.medizininformatik-initiative.de/fhir/modul-consent/StructureDefinition/mii-pr-consent-einwilligung";
|
||||||
|
private final String BROAD_CONSENT_POLICY = "urn:oid:2.16.840.1.113883.3.1937.777.24.2.1791";
|
||||||
|
|
||||||
public GicsConsentService(
|
public GicsConsentService(
|
||||||
GIcsConfigProperties gIcsConfigProperties,
|
GIcsConfigProperties gIcsConfigProperties,
|
||||||
@@ -302,6 +304,36 @@ public class GicsConsentService implements IConsentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bundle getConsent(String patientId, Date requestDate, ConsentDomain consentDomain) {
|
public Bundle getConsent(String patientId, Date requestDate, ConsentDomain consentDomain) {
|
||||||
return currentConsentForPersonAndTemplate(patientId, consentDomain, requestDate);
|
Bundle gIcsResultBundle = currentConsentForPersonAndTemplate(patientId, consentDomain, requestDate);
|
||||||
|
if (ConsentDomain.BROAD_CONSENT == consentDomain) {
|
||||||
|
return convertGicsResultToMiiBroadConsent(gIcsResultBundle);
|
||||||
|
}
|
||||||
|
return gIcsResultBundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Bundle convertGicsResultToMiiBroadConsent(Bundle gIcsResultBundle) {
|
||||||
|
if (gIcsResultBundle == null
|
||||||
|
|| gIcsResultBundle.getEntry().isEmpty()
|
||||||
|
|| !(gIcsResultBundle.getEntry().getFirst().getResource() instanceof Consent))
|
||||||
|
return gIcsResultBundle;
|
||||||
|
|
||||||
|
Bundle.BundleEntryComponent bundleEntryComponent = gIcsResultBundle.getEntry().getFirst();
|
||||||
|
|
||||||
|
var consentAsOne = (Consent) bundleEntryComponent.getResource();
|
||||||
|
if (consentAsOne.getPolicy().stream().noneMatch(p -> p.getUri().equals(BROAD_CONSENT_POLICY))) {
|
||||||
|
consentAsOne.addPolicy(new Consent.ConsentPolicyComponent().setUri(BROAD_CONSENT_POLICY));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (consentAsOne.getMeta().getProfile().stream().noneMatch(p -> p.getValue().equals(BROAD_CONSENT_PROFILE_URI))) {
|
||||||
|
consentAsOne.getMeta().addProfile(BROAD_CONSENT_PROFILE_URI);
|
||||||
|
}
|
||||||
|
|
||||||
|
consentAsOne.setPolicyRule(null);
|
||||||
|
|
||||||
|
gIcsResultBundle.getEntry().stream().skip(1).forEach(c -> consentAsOne.getProvision().addProvision(((Consent) c.getResource()).getProvision().getProvisionFirstRep()));
|
||||||
|
|
||||||
|
gIcsResultBundle.getEntry().clear();
|
||||||
|
gIcsResultBundle.addEntry(bundleEntryComponent);
|
||||||
|
return gIcsResultBundle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ import java.time.Instant;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.fail;
|
||||||
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
|
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
|
||||||
import static org.springframework.test.web.client.response.MockRestResponseCreators.withServerError;
|
import static org.springframework.test.web.client.response.MockRestResponseCreators.withServerError;
|
||||||
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
|
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
|
||||||
@@ -177,5 +178,8 @@ class GicsConsentServiceTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void convertGicsResultToMiiBroadConsent() {
|
||||||
|
fail("todo: implement Test gicsConsentService.convertGicsResultToMiiBroadConsent");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +80,7 @@ class ConsentProcessorTest {
|
|||||||
val checkResult = consentProcessor.consentGatedCheckAndTryEmbedding(inputMtb)
|
val checkResult = consentProcessor.consentGatedCheckAndTryEmbedding(inputMtb)
|
||||||
|
|
||||||
assertThat(checkResult).isTrue
|
assertThat(checkResult).isTrue
|
||||||
assertThat(inputMtb.metadata.researchConsents).hasSize(26)
|
assertThat(inputMtb.metadata.researchConsents).isNotEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
Reference in New Issue
Block a user