Search in sources :

Example 36 with ContactDetail

use of org.hl7.fhir.r4b.model.ContactDetail in project kindling by HL7.

the class CodeListToValueSetParser method generateConceptMapV3.

private void generateConceptMapV3(String v3map, ValueSet vs, CodeSystem cs) throws Exception {
    if (!v3map.startsWith("http://terminology.hl7.org/ValueSet/v3-"))
        v3map = "http://terminology.hl7.org/ValueSet/v3-" + v3map;
    ConceptMap cm = new ConceptMap();
    cm.setVersion(version);
    cm.setId("cm-" + vs.getId() + "-v3");
    cm.setUserData("path", cm.getId() + ".html");
    cm.setUserData("generate", true);
    cm.setUrl("http://hl7.org/fhir/ConceptMap/" + cm.getId());
    cm.setName("v3." + vs.getName());
    cm.setTitle("v3 map for " + vs.present());
    cm.setPublisher("HL7 (FHIR Project)");
    for (ContactDetail cc : vs.getContact()) {
        ContactDetail cd = cm.addContact();
        cd.setName(cc.getName());
        for (ContactPoint ccs : cc.getTelecom()) cd.addTelecom(ccs.copy());
    }
    cm.setCopyright(vs.getCopyright());
    // until we publish DSTU, then .review
    cm.setStatus(vs.getStatus());
    cm.setDate(vs.getDate());
    cm.setSource(Factory.newCanonical(vs.getUrl()));
    cm.setTarget(Factory.newCanonical(v3map));
    if (cs != null)
        processV3ConceptDefs(cm, cs.getUrl(), cs.getConcept());
    for (ConceptSetComponent cc : vs.getCompose().getInclude()) for (ConceptReferenceComponent c : cc.getConcept()) {
        processV3Map(cm, cc.getSystem(), c.getCode(), c.getUserString("v2"));
    }
    maps.see(cm, packageInfo);
}
Also used : ContactDetail(org.hl7.fhir.r5.model.ContactDetail) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) ConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent) ConceptMap(org.hl7.fhir.r5.model.ConceptMap) ConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent)

Example 37 with ContactDetail

use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.

the class Questionnaire10_40 method convertQuestionnaire.

public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src, BaseAdvisor_10_40 advisor) {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire();
    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_40.convertIdentifier(t));
    if (src.hasVersionElement())
        tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
    if (src.hasStatus())
        tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
    if (src.hasDate())
        tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement()));
    if (src.hasPublisherElement())
        tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement()));
    for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(ContactPoint10_40.convertContactPoint(t1));
    org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup();
    root.setTitle(src.getTitle());
    for (org.hl7.fhir.r4.model.Coding t : src.getCode()) {
        root.addConcept(Coding10_40.convertCoding(t));
    }
    for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
    for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP)
        root.addGroup(convertQuestionnaireGroupComponent(t));
    else
        root.addQuestion(convertQuestionnaireQuestionComponent(t));
    return tgt;
}
Also used : ContactDetail(org.hl7.fhir.r4.model.ContactDetail)

Example 38 with ContactDetail

use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.

the class OpenApiGenerator method generate.

public void generate(String license, String url) {
    dest.info().title(source.present()).description(source.getDescription()).license(license, url).version(source.getVersion());
    for (ContactDetail cd : source.getContact()) {
        dest.info().contact(cd.getName(), email(cd.getTelecom()), url(cd.getTelecom()));
    }
    if (source.hasPublisher())
        dest.info().contact(source.getPublisher(), null, null);
    if (source.hasImplementation()) {
        dest.server(source.getImplementation().getUrl()).description(source.getImplementation().getDescription());
    }
    dest.externalDocs().url(source.getUrl()).description("FHIR CapabilityStatement");
    for (CapabilityStatementRestComponent csr : source.getRest()) {
        if (csr.getMode() == org.hl7.fhir.r4b.model.CapabilityStatement.RestfulCapabilityMode.SERVER) {
            generatePaths(csr);
        }
    }
    writeBaseParameters(dest.components());
}
Also used : ContactDetail(org.hl7.fhir.r4b.model.ContactDetail) CapabilityStatementRestComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestComponent)

Example 39 with ContactDetail

use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.

the class PlanDefinition30_50 method convertPlanDefinition.

public static org.hl7.fhir.r5.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r5.model.PlanDefinition tgt = new org.hl7.fhir.r5.model.PlanDefinition();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    if (src.hasUrl())
        tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    if (src.hasVersion())
        tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
    if (src.hasName())
        tgt.setNameElement(String30_50.convertString(src.getNameElement()));
    if (src.hasTitle())
        tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
    if (src.hasType())
        tgt.setType(CodeableConcept30_50.convertCodeableConcept(src.getType()));
    if (src.hasStatus())
        tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
    if (src.hasExperimental())
        tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
    if (src.hasDate())
        tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
    if (src.hasPublisher())
        tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
    if (src.hasDescription())
        tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
    if (src.hasPurpose())
        tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
    if (src.hasUsage())
        tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
    if (src.hasApprovalDate())
        tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
    if (src.hasLastReviewDate())
        tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
    if (src.hasEffectivePeriod())
        tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(CodeableConcept30_50.convertCodeableConcept(t));
    for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) {
        if (t.getType() == ContributorType.AUTHOR)
            for (ContactDetail c : t.getContact()) tgt.addAuthor(ContactDetail30_50.convertContactDetail(c));
        if (t.getType() == ContributorType.EDITOR)
            for (ContactDetail c : t.getContact()) tgt.addEditor(ContactDetail30_50.convertContactDetail(c));
        if (t.getType() == ContributorType.REVIEWER)
            for (ContactDetail c : t.getContact()) tgt.addReviewer(ContactDetail30_50.convertContactDetail(c));
        if (t.getType() == ContributorType.ENDORSER)
            for (ContactDetail c : t.getContact()) tgt.addEndorser(ContactDetail30_50.convertContactDetail(c));
    }
    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(ContactDetail30_50.convertContactDetail(t));
    if (src.hasCopyright())
        tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
    for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
    for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(Reference30_50.convertReferenceToCanonical(t));
    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) tgt.addGoal(convertPlanDefinitionGoalComponent(t));
    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t));
    return tgt;
}
Also used : ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail) ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail)

Example 40 with ContactDetail

use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.

the class Measure30_50 method convertMeasure.

public static org.hl7.fhir.r5.model.Measure convertMeasure(org.hl7.fhir.dstu3.model.Measure src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r5.model.Measure tgt = new org.hl7.fhir.r5.model.Measure();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    if (src.hasUrl())
        tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    if (src.hasVersion())
        tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
    if (src.hasName())
        tgt.setNameElement(String30_50.convertString(src.getNameElement()));
    if (src.hasTitle())
        tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
    if (src.hasStatus())
        tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
    if (src.hasExperimental())
        tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
    if (src.hasType())
        for (org.hl7.fhir.dstu3.model.CodeableConcept concept : src.getType()) tgt.addType(CodeableConcept30_50.convertCodeableConcept(concept));
    if (src.hasDate())
        tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
    if (src.hasPublisher())
        tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(ContactDetail30_50.convertContactDetail(t));
    if (src.hasDescription())
        tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
    if (src.hasPurpose())
        tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
    if (src.hasUsage())
        tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
    if (src.hasCopyright())
        tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
    if (src.hasApprovalDate())
        tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
    if (src.hasLastReviewDate())
        tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
    if (src.hasEffectivePeriod())
        tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
    for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) {
        if (t.getType() == ContributorType.AUTHOR)
            if (t.hasContact())
                for (ContactDetail c : t.getContact()) tgt.addAuthor(ContactDetail30_50.convertContactDetail(c));
            else
                tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName()));
        if (t.getType() == ContributorType.EDITOR)
            if (t.hasContact())
                for (ContactDetail c : t.getContact()) tgt.addEditor(ContactDetail30_50.convertContactDetail(c).setName(t.hasName() ? t.getName() : null));
            else
                tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName()));
        if (t.getType() == ContributorType.REVIEWER)
            if (t.hasContact())
                for (ContactDetail c : t.getContact()) tgt.addReviewer(ContactDetail30_50.convertContactDetail(c).setName(t.hasName() ? t.getName() : null));
            else
                tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName()));
        if (t.getType() == ContributorType.ENDORSER)
            if (t.hasContact())
                for (ContactDetail c : t.getContact()) tgt.addEndorser(ContactDetail30_50.convertContactDetail(c).setName(t.hasName() ? t.getName() : null));
            else
                tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName()));
    }
    for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
    for (org.hl7.fhir.dstu3.model.Reference r : src.getLibrary()) tgt.addLibrary(r.getReference());
    if (src.hasDisclaimer())
        tgt.setDisclaimerElement(MarkDown30_50.convertMarkdown(src.getDisclaimerElement()));
    if (src.hasScoring())
        tgt.setScoring(CodeableConcept30_50.convertCodeableConcept(src.getScoring()));
    if (src.hasCompositeScoring())
        tgt.setCompositeScoring(CodeableConcept30_50.convertCodeableConcept(src.getCompositeScoring()));
    if (src.hasRiskAdjustment())
        tgt.setRiskAdjustmentElement(String30_50.convertString(src.getRiskAdjustmentElement()));
    if (src.hasRateAggregation())
        tgt.setRateAggregationElement(String30_50.convertString(src.getRateAggregationElement()));
    if (src.hasRationale())
        tgt.setRationaleElement(MarkDown30_50.convertMarkdown(src.getRationaleElement()));
    if (src.hasClinicalRecommendationStatement())
        tgt.setClinicalRecommendationStatementElement(MarkDown30_50.convertMarkdown(src.getClinicalRecommendationStatementElement()));
    if (src.hasImprovementNotation()) {
        if (src.getImprovementNotation().toLowerCase().contains("increase") || src.getImprovementNotation().toLowerCase().contains("higher"))
            tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode("increase").setSystem("http://terminology.hl7.org/CodeSystem/measure-improvement-notation")).setText(src.getImprovementNotation()));
        else if (src.getImprovementNotation().toLowerCase().contains("decrease") || src.getImprovementNotation().toLowerCase().contains("lower"))
            tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode("decrease").setSystem("http://terminology.hl7.org/CodeSystem/measure-improvement-notation")).setText(src.getImprovementNotation()));
        else
            tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().setText(src.getImprovementNotation()));
    }
    for (org.hl7.fhir.dstu3.model.MarkdownType m : src.getDefinition()) tgt.addDefinition(m.getValue());
    if (src.hasGuidance())
        tgt.setGuidanceElement(MarkDown30_50.convertMarkdown(src.getGuidanceElement()));
    for (org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent g : src.getGroup()) tgt.addGroup(convertMeasureGroup(g));
    return tgt;
}
Also used : Contributor(org.hl7.fhir.dstu3.model.Contributor) ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail) ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail)

Aggregations

ContactDetail (org.hl7.fhir.dstu3.model.ContactDetail)15 ContactDetail (org.hl7.fhir.r5.model.ContactDetail)15 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)9 ContactDetail (org.hl7.fhir.r4b.model.ContactDetail)7 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)7 CodeType (org.hl7.fhir.r5.model.CodeType)6 NotImplementedException (org.apache.commons.lang3.NotImplementedException)5 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)5 HashSet (java.util.HashSet)4 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)4 ContactPoint (org.hl7.fhir.r4b.model.ContactPoint)4 Gson (com.google.gson.Gson)3 GsonBuilder (com.google.gson.GsonBuilder)3 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 FileOutputStream (java.io.FileOutputStream)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 HashMap (java.util.HashMap)3 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)3 ContactPoint (org.hl7.fhir.dstu3.model.ContactPoint)3