Search in sources :

Example 6 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project cqf-ruler by DBCG.

the class ActivityDefinitionApplyProvider method resolveDiagnosticReport.

private DiagnosticReport resolveDiagnosticReport(ActivityDefinition activityDefinition, String patientId) {
    DiagnosticReport diagnosticReport = new DiagnosticReport();
    diagnosticReport.setStatus(DiagnosticReport.DiagnosticReportStatus.UNKNOWN);
    diagnosticReport.setSubject(new Reference(patientId));
    if (activityDefinition.hasCode()) {
        diagnosticReport.setCode(activityDefinition.getCode());
    } else {
        throw new ActivityDefinitionApplyException("Missing required ActivityDefinition.code property for DiagnosticReport");
    }
    if (activityDefinition.hasRelatedArtifact()) {
        List<Attachment> presentedFormAttachments = new ArrayList<>();
        for (RelatedArtifact artifact : activityDefinition.getRelatedArtifact()) {
            Attachment attachment = new Attachment();
            if (artifact.hasUrl()) {
                attachment.setUrl(artifact.getUrl());
            }
            if (artifact.hasDisplay()) {
                attachment.setTitle(artifact.getDisplay());
            }
            presentedFormAttachments.add(attachment);
        }
        diagnosticReport.setPresentedForm(presentedFormAttachments);
    }
    return diagnosticReport;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) DiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport) Attachment(org.hl7.fhir.dstu3.model.Attachment) RelatedArtifact(org.hl7.fhir.dstu3.model.RelatedArtifact)

Example 7 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project cqf-ruler by DBCG.

the class ActivityDefinitionApplyProvider method resolveCommunication.

private Communication resolveCommunication(ActivityDefinition activityDefinition, String patientId) {
    Communication communication = new Communication();
    communication.setStatus(Communication.CommunicationStatus.UNKNOWN);
    communication.setSubject(new Reference(patientId));
    if (activityDefinition.hasCode()) {
        communication.setReasonCode(Collections.singletonList(activityDefinition.getCode()));
    }
    if (activityDefinition.hasRelatedArtifact()) {
        for (RelatedArtifact artifact : activityDefinition.getRelatedArtifact()) {
            if (artifact.hasUrl()) {
                Attachment attachment = new Attachment().setUrl(artifact.getUrl());
                if (artifact.hasDisplay()) {
                    attachment.setTitle(artifact.getDisplay());
                }
                Communication.CommunicationPayloadComponent payload = new Communication.CommunicationPayloadComponent();
                payload.setContent(artifact.hasDisplay() ? attachment.setTitle(artifact.getDisplay()) : attachment);
                communication.setPayload(Collections.singletonList(payload));
            }
        // TODO - other relatedArtifact types
        }
    }
    return communication;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) Attachment(org.hl7.fhir.dstu3.model.Attachment) RelatedArtifact(org.hl7.fhir.dstu3.model.RelatedArtifact) Communication(org.hl7.fhir.dstu3.model.Communication)

Example 8 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project cqf-ruler by DBCG.

the class ActivityDefinitionApplyProvider method resolveCommunication.

private Communication resolveCommunication(ActivityDefinition activityDefinition, String patientId) {
    Communication communication = new Communication();
    communication.setStatus(Communication.CommunicationStatus.UNKNOWN);
    communication.setSubject(new Reference(patientId));
    if (activityDefinition.hasCode()) {
        communication.setReasonCode(Collections.singletonList(activityDefinition.getCode()));
    }
    if (activityDefinition.hasRelatedArtifact()) {
        for (RelatedArtifact artifact : activityDefinition.getRelatedArtifact()) {
            if (artifact.hasUrl()) {
                Attachment attachment = new Attachment().setUrl(artifact.getUrl());
                if (artifact.hasDisplay()) {
                    attachment.setTitle(artifact.getDisplay());
                }
                Communication.CommunicationPayloadComponent payload = new Communication.CommunicationPayloadComponent();
                payload.setContent(artifact.hasDisplay() ? attachment.setTitle(artifact.getDisplay()) : attachment);
                communication.setPayload(Collections.singletonList(payload));
            }
        // TODO - other relatedArtifact types
        }
    }
    return communication;
}
Also used : Reference(org.hl7.fhir.r4.model.Reference) Attachment(org.hl7.fhir.r4.model.Attachment) RelatedArtifact(org.hl7.fhir.r4.model.RelatedArtifact) Communication(org.hl7.fhir.r4.model.Communication)

Example 9 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project quality-measure-and-cohort-service by Alvearie.

the class FhirTestBase method getLibrary.

protected Library getLibrary(String name, String version, String... attachmentData) throws Exception {
    if (attachmentData == null || attachmentData.length == 0 || (attachmentData.length > 2) && ((attachmentData.length % 2) != 0)) {
        fail("Invalid attachment data. Data must consist of one or more pairs of resource path and content-type strings");
    }
    List<String> pairs = new ArrayList<>(Arrays.asList(attachmentData));
    if (pairs.size() == 1) {
        pairs.add("text/cql");
    }
    List<Attachment> attachments = new ArrayList<>();
    for (int i = 0; i < pairs.size(); i += 2) {
        String resource = pairs.get(i);
        String contentType = pairs.get(i + 1);
        try (InputStream is = ClassLoader.getSystemResourceAsStream(resource)) {
            assertNotNull(String.format("No such resource %s found in classpath", resource), is);
            String text = IOUtils.toString(is, StandardCharsets.UTF_8);
            Attachment attachment = new Attachment();
            attachment.setContentType(contentType);
            attachment.setData(text.getBytes());
            attachments.add(attachment);
        }
    }
    Library library = new Library();
    library.setId("library-" + name + "-" + version);
    library.setName(name);
    library.setUrl(IBM_PREFIX + "/Library/" + name);
    library.setVersion(version);
    library.setContent(attachments);
    return library;
}
Also used : InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) Attachment(org.hl7.fhir.r4.model.Attachment) Library(org.hl7.fhir.r4.model.Library)

Example 10 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project quality-measure-and-cohort-service by Alvearie.

the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testAttachment__shouldThrowException.

@Test(expected = UnsupportedFhirTypeException.class)
public void testAttachment__shouldThrowException() {
    ParameterDefinition parameterDefinition = getBaseParameterDefinition("Attachment");
    Attachment fhirValue = new Attachment();
    parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
    R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition);
}
Also used : Attachment(org.hl7.fhir.r4.model.Attachment) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Test(org.junit.Test)

Aggregations

Attachment (org.hl7.fhir.r4.model.Attachment)33 ArrayList (java.util.ArrayList)23 Attachment (com.ibm.cloud.cloudant.v1.model.Attachment)17 Test (org.testng.annotations.Test)17 DocumentRevisionStatus (com.ibm.cloud.cloudant.v1.model.DocumentRevisionStatus)16 Revisions (com.ibm.cloud.cloudant.v1.model.Revisions)16 Reference (org.hl7.fhir.r4.model.Reference)15 Document (com.ibm.cloud.cloudant.v1.model.Document)10 HashMap (java.util.HashMap)9 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)8 Observation (org.hl7.fhir.r4.model.Observation)8 DesignDocument (com.ibm.cloud.cloudant.v1.model.DesignDocument)7 ReplicationDocument (com.ibm.cloud.cloudant.v1.model.ReplicationDocument)7 Coding (org.hl7.fhir.r4.model.Coding)7 Resource (org.hl7.fhir.r4.model.Resource)7 DocumentResult (com.ibm.cloud.cloudant.v1.model.DocumentResult)6 MockResponse (okhttp3.mockwebserver.MockResponse)6 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)6 NotImplementedException (org.apache.commons.lang3.NotImplementedException)6 DiagnosticReport (org.hl7.fhir.r4.model.DiagnosticReport)6