Ignore notGiven extension + refactor

This commit is contained in:
dotasek 2022-11-30 10:09:04 -05:00
parent 69db452501
commit 196862b6b2
10 changed files with 39 additions and 54 deletions

View File

@ -26,8 +26,9 @@ public class BaseAdvisor_10_40 extends BaseAdvisor40<org.hl7.fhir.dstu2.model.Ex
@Override
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) {
List<String> paths = Arrays.asList(path.split(","));
return (paths.get(paths.size() - 1).equals("Conformance")) && (conformanceIgnoredUrls.contains(url));
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
return (lastPath.equals("Conformance")) && (conformanceIgnoredUrls.contains(url));
}
@Override

View File

@ -24,8 +24,9 @@ public class BaseAdvisor_10_50 extends BaseAdvisor50<org.hl7.fhir.dstu2.model.Ex
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) {
List<String> paths = Arrays.asList(path.split(","));
return (paths.get(paths.size() - 1).equals("Conformance")) && (conformanceIgnoredUrls.contains(url));
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
return (lastPath.equals("Conformance")) && (conformanceIgnoredUrls.contains(url));
}
public boolean ignoreType(@Nonnull String path,

View File

@ -27,8 +27,9 @@ public class BaseAdvisor_14_40 extends BaseAdvisor40<org.hl7.fhir.dstu2016may.mo
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) {
List<String> paths = Arrays.asList(path.split(","));
if ((paths.get(paths.size() - 1).equals("Conformance")) && (conformanceIgnoredUrls.contains(url))) {
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
if ((lastPath.equals("Conformance")) && (conformanceIgnoredUrls.contains(url))) {
return true;
} else {
return this.ignoredUrls.contains(url);

View File

@ -23,7 +23,8 @@ public class BaseAdvisor_14_50 extends BaseAdvisor50<org.hl7.fhir.dstu2016may.mo
@Override
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) throws FHIRException {
List<String> paths = Arrays.asList(path.split(","));
return (paths.get(paths.size() - 1).equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
return (lastPath.equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
}
}

View File

@ -13,6 +13,8 @@ public class BaseAdvisor_30_40 extends BaseAdvisor40<org.hl7.fhir.dstu3.model.Ex
final List<String> capabilityStatementIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown");
final List<String> immunizationIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.notGiven");
public BaseAdvisor_30_40() {
}
@ -23,7 +25,13 @@ public class BaseAdvisor_30_40 extends BaseAdvisor40<org.hl7.fhir.dstu3.model.Ex
@Override
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) throws FHIRException {
List<String> paths = Arrays.asList(path.split(","));
return (paths.get(paths.size() - 1).equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
if (lastPath.equals("CapabilityStatement")) {
return capabilityStatementIgnoredUrls.contains(url);
} else if (lastPath.equals("Immunization")) {
return immunizationIgnoredUrls.contains(url);
}
return false;
}
}

View File

@ -25,14 +25,15 @@ public class BaseAdvisor_30_50 extends BaseAdvisor50<org.hl7.fhir.dstu3.model.Ex
@Override
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) throws FHIRException {
List<String> paths = Arrays.asList(path.split(","));
if ((paths.get(paths.size() - 1).equals("ValueSet")) && (valueSetIgnoredUrls.contains(url))) {
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
if ((lastPath.equals("ValueSet")) && (valueSetIgnoredUrls.contains(url))) {
return true;
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
return true;
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
return true;
} else
return (paths.get(paths.size() - 1).equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
return (lastPath.equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
}
}

View File

@ -30,12 +30,13 @@ public class BaseAdvisor_40_50 extends BaseAdvisor50<org.hl7.fhir.r4.model.Exten
@Override
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) throws FHIRException {
List<String> paths = Arrays.asList(path.split(","));
if ((paths.get(paths.size() - 1).equals("TestScript")) && (TestScriptIgnoredUrls.contains(url))) {
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
if ((lastPath.equals("TestScript")) && (TestScriptIgnoredUrls.contains(url))) {
return true;
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
return true;
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
return true;
} else
return false;

View File

@ -23,12 +23,13 @@ public class BaseAdvisor_43_50 extends BaseAdvisor50<org.hl7.fhir.r4b.model.Exte
@Override
public boolean ignoreExtension(@Nonnull String path,
@Nonnull String url) throws FHIRException {
List<String> paths = Arrays.asList(path.split(","));
if ((paths.get(paths.size() - 1).equals("TestScript")) && (TestScriptIgnoredUrls.contains(url))) {
final List<String> paths = Arrays.asList(path.split(","));
final String lastPath = paths.get(paths.size() - 1);
if ((lastPath.equals("TestScript")) && (TestScriptIgnoredUrls.contains(url))) {
return true;
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
return true;
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
return true;
} else
return false;

View File

@ -22,7 +22,7 @@ public class Immunization30_40Test {
Arguments.of("not-done no notGiven extension", "/immunization_40_not-done.json", "/immunization_30_completed_notGiven.json"),
Arguments.of("completed no notGiven extension", "/immunization_40_completed.json", "/immunization_30_completed_given.json"),
Arguments.of("entered-in-error no notGiven extension", "/immunization_40_entered-in-error.json", "/immunization_30_entered-in-error_given.json"),
Arguments.of("entered-in-error notGiven extension", "/immunization_40_entered-in-error_notGiven-extension.json", "/immunization_30_entered-in-error_notGiven-extension.json")
Arguments.of("entered-in-error notGiven extension", "/immunization_40_entered-in-error_notGiven-extension.json", "/immunization_30_entered-in-error_notGiven.json")
);
}
@ParameterizedTest(name = "Test r4 -> dstu3 immunization conversions: {0}")

View File

@ -1,30 +0,0 @@
{
"resourceType": "Immunization",
"id": "notGiven",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">dummyDiv</div>"
},
"status": "entered-in-error",
"notGiven": true,
"extension":[
{
"url":"http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.notGiven",
"valueBoolean":true
}
],
"vaccineCode": {
"coding": [
{
"system": "http://hl7.org/fhir/sid/cvx",
"code": "01",
"display": "DTP"
}
]
},
"patient": {
"reference": "Patient/example"
},
"date": "2013-01-10",
"primarySource": true
}