From abf1d5f6733b3dcc36537225e1221efca53163df Mon Sep 17 00:00:00 2001 From: Chris Schuler Date: Tue, 22 Oct 2019 15:14:41 -0600 Subject: [PATCH 1/2] Finished measure conversion logic for 30_50 convertor --- .../convertors/VersionConvertor_30_50.java | 97 ++++++++++++++++--- 1 file changed, 82 insertions(+), 15 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java index 3f4d0a7c7..f91a6e907 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java @@ -24,14 +24,12 @@ package org.hl7.fhir.convertors; import java.util.ArrayList; import java.util.List; -import org.hl7.fhir.dstu3.model.ContactDetail; +import ca.uhn.fhir.context.FhirContext; +import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.Contributor.ContributorType; import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus; import org.hl7.fhir.dstu3.model.ExpansionProfile.DesignationIncludeDesignationComponent; import org.hl7.fhir.dstu3.model.ExpansionProfile.SystemVersionProcessingMode; -import org.hl7.fhir.dstu3.model.MarkdownType; -import org.hl7.fhir.dstu3.model.Measure; -import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.model.BooleanType; @@ -39,7 +37,6 @@ import org.hl7.fhir.r5.model.CanonicalType; import org.hl7.fhir.r5.model.Questionnaire; import org.hl7.fhir.r5.model.CodeableConcept; import org.hl7.fhir.r5.model.Enumeration; -import org.hl7.fhir.r5.model.Expression.ExpressionLanguage; import org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent; import org.hl7.fhir.r5.model.Identifier; import org.hl7.fhir.r5.model.Reference; @@ -22259,17 +22256,25 @@ public class VersionConvertor_30_50 { tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { if (t.getType() == ContributorType.AUTHOR) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); + if (t.hasContact()) + for (ContactDetail c : t.getContact()) + tgt.addAuthor(convertContactDetail(c)); + else tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); if (t.getType() == ContributorType.EDITOR) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c)); + if (t.hasContact()) + for (ContactDetail c : t.getContact()) + tgt.addEditor(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) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c)); + if (t.hasContact()) + for (ContactDetail c : t.getContact()) + tgt.addReviewer(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) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c)); + if (t.hasContact()) + for (ContactDetail c : t.getContact()) + tgt.addEndorser(convertContactDetail(c).setName(t.hasName() ? t.getName() : null)); + else tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); } // NEW for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) @@ -22282,8 +22287,6 @@ public class VersionConvertor_30_50 { tgt.setScoring(convertCodeableConcept(src.getScoring())); if (src.hasCompositeScoring()) tgt.setCompositeScoring(convertCodeableConcept(src.getCompositeScoring())); - for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getType()) - tgt.addType(convertCodeableConcept(c)); if (src.hasRiskAdjustment()) tgt.setRiskAdjustment(src.getRiskAdjustment()); if (src.hasRateAggregation()) @@ -22400,6 +22403,70 @@ public class VersionConvertor_30_50 { tgt.setLastReviewDate(src.getLastReviewDate()); if (src.hasEffectivePeriod()) tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + if (src.hasAuthor()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.AUTHOR); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + if (src.hasEditor()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.EDITOR); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + if (src.hasReviewer()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.REVIEWER); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + if (src.hasEndorser()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.ENDORSER); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + // NEW + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType r : src.getLibrary()) + tgt.addLibrary(convertCanonicalToReference(r)); + if (src.hasDisclaimer()) + tgt.setDisclaimer(src.getDisclaimer()); + if (src.hasScoring()) + tgt.setScoring(convertCodeableConcept(src.getScoring())); + if (src.hasCompositeScoring()) + tgt.setCompositeScoring(convertCodeableConcept(src.getCompositeScoring())); + if (src.hasRiskAdjustment()) + tgt.setRiskAdjustment(src.getRiskAdjustment()); + if (src.hasRateAggregation()) + tgt.setRateAggregation(src.getRateAggregation()); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + if (src.hasClinicalRecommendationStatement()) + tgt.setClinicalRecommendationStatement(src.getClinicalRecommendationStatement()); + if (src.hasImprovementNotation()) + for (org.hl7.fhir.r5.model.Coding cc : src.getImprovementNotation().getCoding()) { + if (cc.hasCode() && cc.getCode().equals("increase")) + tgt.setImprovementNotation(cc.getCode()); + else if (cc.hasCode() && cc.getCode().equals("decrease")) + tgt.setImprovementNotation(cc.getCode()); + } + for (org.hl7.fhir.r5.model.MarkdownType m : src.getDefinition()) + tgt.addDefinition(m.getValue()); + if (src.hasGuidance()) + tgt.setGuidance(src.getGuidance()); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupComponent g : src.getGroup()) + tgt.addGroup(convertMeasureGroup(g)); return tgt; } From e94b099a4b304974b637337664e9ede02ed80034 Mon Sep 17 00:00:00 2001 From: Chris Schuler Date: Tue, 22 Oct 2019 15:19:18 -0600 Subject: [PATCH 2/2] Removed unnecessary import used for testing --- .../java/org/hl7/fhir/convertors/VersionConvertor_30_50.java | 1 - 1 file changed, 1 deletion(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java index 401f6d9cc..2c5b06e90 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java @@ -24,7 +24,6 @@ package org.hl7.fhir.convertors; import java.util.ArrayList; import java.util.List; -import ca.uhn.fhir.context.FhirContext; import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.Contributor.ContributorType; import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;