Search in sources :

Example 51 with RelatedArtifact

use of org.hl7.fhir.r4.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeResearchStudy.

protected void composeResearchStudy(Complex parent, String parentType, String name, ResearchStudy element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ResearchStudy", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ResearchStudy", "identifier", element.getIdentifier().get(i), i);
    if (element.hasTitleElement())
        composeString(t, "ResearchStudy", "title", element.getTitleElement(), -1);
    for (int i = 0; i < element.getProtocol().size(); i++) composeReference(t, "ResearchStudy", "protocol", element.getProtocol().get(i), i);
    for (int i = 0; i < element.getPartOf().size(); i++) composeReference(t, "ResearchStudy", "partOf", element.getPartOf().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "ResearchStudy", "status", element.getStatusElement(), -1);
    if (element.hasPrimaryPurposeType())
        composeCodeableConcept(t, "ResearchStudy", "primaryPurposeType", element.getPrimaryPurposeType(), -1);
    if (element.hasPhase())
        composeCodeableConcept(t, "ResearchStudy", "phase", element.getPhase(), -1);
    for (int i = 0; i < element.getCategory().size(); i++) composeCodeableConcept(t, "ResearchStudy", "category", element.getCategory().get(i), i);
    for (int i = 0; i < element.getFocus().size(); i++) composeCodeableConcept(t, "ResearchStudy", "focus", element.getFocus().get(i), i);
    for (int i = 0; i < element.getCondition().size(); i++) composeCodeableConcept(t, "ResearchStudy", "condition", element.getCondition().get(i), i);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "ResearchStudy", "contact", element.getContact().get(i), i);
    for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "ResearchStudy", "relatedArtifact", element.getRelatedArtifact().get(i), i);
    for (int i = 0; i < element.getKeyword().size(); i++) composeCodeableConcept(t, "ResearchStudy", "keyword", element.getKeyword().get(i), i);
    for (int i = 0; i < element.getLocation().size(); i++) composeCodeableConcept(t, "ResearchStudy", "location", element.getLocation().get(i), i);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "ResearchStudy", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getEnrollment().size(); i++) composeReference(t, "ResearchStudy", "enrollment", element.getEnrollment().get(i), i);
    if (element.hasPeriod())
        composePeriod(t, "ResearchStudy", "period", element.getPeriod(), -1);
    if (element.hasSponsor())
        composeReference(t, "ResearchStudy", "sponsor", element.getSponsor(), -1);
    if (element.hasPrincipalInvestigator())
        composeReference(t, "ResearchStudy", "principalInvestigator", element.getPrincipalInvestigator(), -1);
    for (int i = 0; i < element.getSite().size(); i++) composeReference(t, "ResearchStudy", "site", element.getSite().get(i), i);
    if (element.hasReasonStopped())
        composeCodeableConcept(t, "ResearchStudy", "reasonStopped", element.getReasonStopped(), -1);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "ResearchStudy", "note", element.getNote().get(i), i);
    for (int i = 0; i < element.getArm().size(); i++) composeResearchStudyResearchStudyArmComponent(t, "ResearchStudy", "arm", element.getArm().get(i), i);
    for (int i = 0; i < element.getObjective().size(); i++) composeResearchStudyResearchStudyObjectiveComponent(t, "ResearchStudy", "objective", element.getObjective().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 52 with RelatedArtifact

use of org.hl7.fhir.r4.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeEffectEvidenceSynthesis.

protected void composeEffectEvidenceSynthesis(Complex parent, String parentType, String name, EffectEvidenceSynthesis element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "EffectEvidenceSynthesis", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "EffectEvidenceSynthesis", "url", element.getUrlElement(), -1);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "EffectEvidenceSynthesis", "identifier", element.getIdentifier().get(i), i);
    if (element.hasVersionElement())
        composeString(t, "EffectEvidenceSynthesis", "version", element.getVersionElement(), -1);
    if (element.hasNameElement())
        composeString(t, "EffectEvidenceSynthesis", "name", element.getNameElement(), -1);
    if (element.hasTitleElement())
        composeString(t, "EffectEvidenceSynthesis", "title", element.getTitleElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "EffectEvidenceSynthesis", "status", element.getStatusElement(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "EffectEvidenceSynthesis", "date", element.getDateElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "EffectEvidenceSynthesis", "publisher", element.getPublisherElement(), -1);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "EffectEvidenceSynthesis", "contact", element.getContact().get(i), i);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "EffectEvidenceSynthesis", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "EffectEvidenceSynthesis", "note", element.getNote().get(i), i);
    for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "EffectEvidenceSynthesis", "useContext", element.getUseContext().get(i), i);
    for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "EffectEvidenceSynthesis", "jurisdiction", element.getJurisdiction().get(i), i);
    if (element.hasCopyrightElement())
        composeMarkdown(t, "EffectEvidenceSynthesis", "copyright", element.getCopyrightElement(), -1);
    if (element.hasApprovalDateElement())
        composeDate(t, "EffectEvidenceSynthesis", "approvalDate", element.getApprovalDateElement(), -1);
    if (element.hasLastReviewDateElement())
        composeDate(t, "EffectEvidenceSynthesis", "lastReviewDate", element.getLastReviewDateElement(), -1);
    if (element.hasEffectivePeriod())
        composePeriod(t, "EffectEvidenceSynthesis", "effectivePeriod", element.getEffectivePeriod(), -1);
    for (int i = 0; i < element.getTopic().size(); i++) composeCodeableConcept(t, "EffectEvidenceSynthesis", "topic", element.getTopic().get(i), i);
    for (int i = 0; i < element.getAuthor().size(); i++) composeContactDetail(t, "EffectEvidenceSynthesis", "author", element.getAuthor().get(i), i);
    for (int i = 0; i < element.getEditor().size(); i++) composeContactDetail(t, "EffectEvidenceSynthesis", "editor", element.getEditor().get(i), i);
    for (int i = 0; i < element.getReviewer().size(); i++) composeContactDetail(t, "EffectEvidenceSynthesis", "reviewer", element.getReviewer().get(i), i);
    for (int i = 0; i < element.getEndorser().size(); i++) composeContactDetail(t, "EffectEvidenceSynthesis", "endorser", element.getEndorser().get(i), i);
    for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "EffectEvidenceSynthesis", "relatedArtifact", element.getRelatedArtifact().get(i), i);
    if (element.hasSynthesisType())
        composeCodeableConcept(t, "EffectEvidenceSynthesis", "synthesisType", element.getSynthesisType(), -1);
    if (element.hasStudyType())
        composeCodeableConcept(t, "EffectEvidenceSynthesis", "studyType", element.getStudyType(), -1);
    if (element.hasPopulation())
        composeReference(t, "EffectEvidenceSynthesis", "population", element.getPopulation(), -1);
    if (element.hasExposure())
        composeReference(t, "EffectEvidenceSynthesis", "exposure", element.getExposure(), -1);
    if (element.hasExposureAlternative())
        composeReference(t, "EffectEvidenceSynthesis", "exposureAlternative", element.getExposureAlternative(), -1);
    if (element.hasOutcome())
        composeReference(t, "EffectEvidenceSynthesis", "outcome", element.getOutcome(), -1);
    if (element.hasSampleSize())
        composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(t, "EffectEvidenceSynthesis", "sampleSize", element.getSampleSize(), -1);
    for (int i = 0; i < element.getResultsByExposure().size(); i++) composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(t, "EffectEvidenceSynthesis", "resultsByExposure", element.getResultsByExposure().get(i), i);
    for (int i = 0; i < element.getEffectEstimate().size(); i++) composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(t, "EffectEvidenceSynthesis", "effectEstimate", element.getEffectEstimate().get(i), i);
    for (int i = 0; i < element.getCertainty().size(); i++) composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(t, "EffectEvidenceSynthesis", "certainty", element.getCertainty().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 53 with RelatedArtifact

use of org.hl7.fhir.r4.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.

the class LibraryRenderer method render.

public boolean render(XhtmlNode x, ResourceWrapper lib) throws FHIRFormatError, DefinitionException, IOException {
    PropertyWrapper authors = lib.getChildByName("author");
    PropertyWrapper editors = lib.getChildByName("editor");
    PropertyWrapper reviewers = lib.getChildByName("reviewer");
    PropertyWrapper endorsers = lib.getChildByName("endorser");
    if ((authors != null && authors.hasValues()) || (editors != null && editors.hasValues()) || (reviewers != null && reviewers.hasValues()) || (endorsers != null && endorsers.hasValues())) {
        boolean email = hasCT(authors, "email") || hasCT(editors, "email") || hasCT(reviewers, "email") || hasCT(endorsers, "email");
        boolean phone = hasCT(authors, "phone") || hasCT(editors, "phone") || hasCT(reviewers, "phone") || hasCT(endorsers, "phone");
        boolean url = hasCT(authors, "url") || hasCT(editors, "url") || hasCT(reviewers, "url") || hasCT(endorsers, "url");
        x.h2().tx("Participants");
        XhtmlNode t = x.table("grid");
        if (authors != null) {
            for (BaseWrapper cd : authors.getValues()) {
                participantRow(t, "Author", cd, email, phone, url);
            }
        }
        if (authors != null) {
            for (BaseWrapper cd : editors.getValues()) {
                participantRow(t, "Editor", cd, email, phone, url);
            }
        }
        if (authors != null) {
            for (BaseWrapper cd : reviewers.getValues()) {
                participantRow(t, "Reviewer", cd, email, phone, url);
            }
        }
        if (authors != null) {
            for (BaseWrapper cd : endorsers.getValues()) {
                participantRow(t, "Endorser", cd, email, phone, url);
            }
        }
    }
    PropertyWrapper artifacts = lib.getChildByName("relatedArtifact");
    if (artifacts != null && artifacts.hasValues()) {
        x.h2().tx("Related Artifacts");
        XhtmlNode t = x.table("grid");
        boolean label = false;
        boolean display = false;
        boolean citation = false;
        for (BaseWrapper ra : artifacts.getValues()) {
            label = label || ra.has("label");
            display = display || ra.has("display");
            citation = citation || ra.has("citation");
        }
        for (BaseWrapper ra : artifacts.getValues()) {
            renderArtifact(t, ra, lib, label, display, citation);
        }
    }
    PropertyWrapper parameters = lib.getChildByName("parameter");
    if (parameters != null && parameters.hasValues()) {
        x.h2().tx("Parameters");
        XhtmlNode t = x.table("grid");
        boolean doco = false;
        for (BaseWrapper p : parameters.getValues()) {
            doco = doco || p.has("documentation");
        }
        for (BaseWrapper p : parameters.getValues()) {
            renderParameter(t, p, doco);
        }
    }
    PropertyWrapper dataRequirements = lib.getChildByName("dataRequirement");
    if (dataRequirements != null && dataRequirements.hasValues()) {
        x.h2().tx("Data Requirements");
        for (BaseWrapper p : dataRequirements.getValues()) {
            renderDataRequirement(x, (DataRequirement) p.getBase());
        }
    }
    PropertyWrapper contents = lib.getChildByName("content");
    if (contents != null) {
        x.h2().tx("Contents");
        boolean isCql = false;
        int counter = 0;
        for (BaseWrapper p : contents.getValues()) {
            Attachment att = (Attachment) p.getBase();
            renderAttachment(x, att, isCql, counter, lib.getId());
            isCql = isCql || (att.hasContentType() && att.getContentType().startsWith("text/cql"));
            counter++;
        }
    }
    return false;
}
Also used : PropertyWrapper(org.hl7.fhir.r4b.renderers.utils.BaseWrappers.PropertyWrapper) BaseWrapper(org.hl7.fhir.r4b.renderers.utils.BaseWrappers.BaseWrapper) Attachment(org.hl7.fhir.r4b.model.Attachment) ContactPoint(org.hl7.fhir.r4b.model.ContactPoint) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 54 with RelatedArtifact

use of org.hl7.fhir.r4.model.RelatedArtifact in project CRD by HL7-DaVinci.

the class QuestionnairePackageOperation method addLibraryDependencies.

/*
    * Recursively add all of the libraries dependencies related by the "depends-on" type.
    */
private void addLibraryDependencies(Library library, List<String> bundleContents, Bundle questionnaireBundle) {
    List<RelatedArtifact> relatedArtifacts = library.getRelatedArtifact();
    for (RelatedArtifact relatedArtifact : relatedArtifacts) {
        // only add the depends-on artifacts
        if (relatedArtifact.getType() == RelatedArtifactType.DEPENDSON) {
            String relatedArtifactReferenceString = relatedArtifact.getResource();
            String[] referenceParts = relatedArtifactReferenceString.split("/");
            String id = referenceParts[1];
            Resource referencedLibraryResource = null;
            // look in the map and retrieve it instead of looking it up on disk if found
            if (resources.containsKey(id)) {
                referencedLibraryResource = resources.get(id);
            } else {
                referencedLibraryResource = fileStore.getFhirResourceByIdAsFhirResource("R4", "Library", id, baseUrl);
                resources.put(id, referencedLibraryResource);
            }
            // only add the library if not already in the bundle
            if (!bundleContents.contains(referencedLibraryResource.getId())) {
                BundleEntryComponent referencedLibraryBundleEntry = new BundleEntryComponent();
                referencedLibraryBundleEntry.setResource(referencedLibraryResource);
                questionnaireBundle.addEntry(referencedLibraryBundleEntry);
                bundleContents.add(referencedLibraryResource.getId());
                // recurse through the libraries...
                addLibraryDependencies((Library) referencedLibraryResource, bundleContents, questionnaireBundle);
            }
        }
    }
    // grab all of the ValueSets in the DataRequirement
    List<DataRequirement> dataRequirements = library.getDataRequirement();
    for (DataRequirement dataRequirement : dataRequirements) {
        List<DataRequirement.DataRequirementCodeFilterComponent> codeFilters = dataRequirement.getCodeFilter();
        for (DataRequirement.DataRequirementCodeFilterComponent codeFilter : codeFilters) {
            String valueSetUrl = codeFilter.getValueSet();
            Resource valueSetResource = null;
            // look in the map and retrieve it instead of looking it up on disk if found
            if (resources.containsKey(valueSetUrl)) {
                valueSetResource = resources.get(valueSetUrl);
            } else {
                valueSetResource = fileStore.getFhirResourceByUrlAsFhirResource("R4", "ValueSet", valueSetUrl, baseUrl);
                resources.put(valueSetUrl, valueSetResource);
            }
            addResourceToBundle(valueSetResource, bundleContents, questionnaireBundle);
        }
    }
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) Resource(org.hl7.fhir.r4.model.Resource) DataRequirement(org.hl7.fhir.r4.model.DataRequirement) RelatedArtifact(org.hl7.fhir.r4.model.RelatedArtifact)

Aggregations

RelatedArtifact (org.hl7.fhir.r4.model.RelatedArtifact)13 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)13 ArrayList (java.util.ArrayList)7 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)7 RelatedArtifact (org.hl7.fhir.dstu3.model.RelatedArtifact)6 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)6 Attachment (org.hl7.fhir.r4.model.Attachment)5 IParser (ca.uhn.fhir.parser.IParser)4 Extension (org.hl7.fhir.r4.model.Extension)4 Library (org.hl7.fhir.r4.model.Library)4 RelatedArtifact (org.hl7.fhir.r5.model.RelatedArtifact)4 Attachment (org.hl7.fhir.dstu3.model.Attachment)3 Reference (org.hl7.fhir.r4.model.Reference)3 FhirContext (ca.uhn.fhir.context.FhirContext)2 IdDt (ca.uhn.fhir.model.primitive.IdDt)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 FhirServerConfig (com.ibm.cohort.fhir.client.config.FhirServerConfig)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 File (java.io.File)2 FileWriter (java.io.FileWriter)2