More support for R4B

This commit is contained in:
Grahame Grieve 2021-12-22 07:31:09 +11:00
parent 3a33cb2174
commit ef0afae743
6 changed files with 55 additions and 33 deletions

View File

@ -1,7 +1,11 @@
## Validator
* Allow both -output and -output-style parameters (output-style applies to output now)
* Allow both -output and -output-style parameters (output-style applies to output now) + add csv output style
* Implement the ```-level``` parameter
* Add support for R4B validation
* fix bug in deep profiles (profiles that don't start at the root)
## Other code changes
* Regenerate R5 code for 5.0.0-snapshot1 & many consequential changes
* Add version support for R4B and R5 (R4B code generation still to be done)

View File

@ -0,0 +1,32 @@
About the version conversion routines
The version conversion routines are maintained as part of
the development of the standard, but always under considerable
time pressure. Implementers should regard these as 'scaffolds' for
an actual reliable conversion routine.
The FHIR project maintains and tests conversions on the following
resources, from old versions to R5:
* CodeSystem
* ValueSet
* ConceptMap
* StructureDefinition
* StructureMap
* ImplementationGuide
* CapabilityStatement
* OperationDefinition
* NamingSystem
These can be relied on and are subject to extensive testing.
In addition to this, some of the conversions have test cases
for particular resources and particular version combinations.
Where test cases exist, they will continue to pass and be
maintained.
So:
* test the conversion routines before using them in production
* contribute test cases to ensure that your use cases continue to be reliable
Test cases are welcome - make them as PRs to the core library, or even better,
to the FHIR test cases library

View File

@ -51,6 +51,8 @@ public class TerminologyClientFactory {
return new TerminologyClientR2(checkEndsWith("/r2", url), userAgent);
case R4:
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent);
case R4B:
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent);
case R5:
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent); // r4 for now, since the terminology is currently the same
case STU3:

View File

@ -6,6 +6,12 @@ import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.utilities.VersionUtilities;
/**
* This doesn't do anythign at this time
*
* @author graha
*
*/
public class StructureDefinitionHacker {
private String version;
@ -16,33 +22,8 @@ public class StructureDefinitionHacker {
}
public Resource fixSD(StructureDefinition sd) {
if (VersionUtilities.isR4BVer(version) && sd.getUrl().equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")) {
// the definition of this one is wrong in R4B
return fixR4BFhirType(sd);
}
return sd;
}
private Resource fixR4BFhirType(StructureDefinition sd) {
for (ElementDefinition ed : sd.getDifferential().getElement()) {
if (ed.getPath().equals("Extension.value[x]")) {
fixEDType(ed, "url", "uri");
}
}
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.getPath().equals("Extension.value[x]")) {
fixEDType(ed, "url", "uri");
}
}
return sd;
}
private void fixEDType(ElementDefinition ed, String orig, String repl) {
for (TypeRefComponent t : ed.getType()) {
if (orig.equals(t.getCode())) {
t.setCode(repl);
}
}
}
}

View File

@ -46,6 +46,7 @@ public enum FhirPublication {
DSTU2016May,
STU3,
R4,
R4B,
R5;
public static FhirPublication fromCode(String v) {
@ -57,12 +58,10 @@ public enum FhirPublication {
return FhirPublication.STU3;
if (VersionUtilities.isR4Ver(v))
return FhirPublication.R4;
if (VersionUtilities.isR4BVer(v))
return FhirPublication.R4B;
if (VersionUtilities.isR5Ver(v))
return FhirPublication.R5;
if ("3.5.0".equals(v))
return FhirPublication.R4;
if ("3.5".equals(v))
return FhirPublication.R4;
return null;
}
@ -72,7 +71,9 @@ public enum FhirPublication {
case DSTU2: return "1.0.2";
case DSTU2016May: return "1.4.0";
case STU3: return "3.0.1";
case R4: return Constants.VERSION;
case R4: return "4.0.1";
case R4B: return "4.3.0";
case R5: return "5.0.0";
default:
return "??";
}

View File

@ -142,10 +142,12 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
if (!ve.containsKey(version)) {
if (version.startsWith("5.0"))
ve.put(version, new ValidationEngine("hl7.fhir.r5.core#4.5.0", ValidationEngineTests.DEF_TX, txLog, FhirPublication.R5, true, "4.5.0", "fhir/test-cases"));
else if (version.startsWith("3.0"))
ve.put(version, new ValidationEngine("hl7.fhir.r3.core#3.0.2", ValidationEngineTests.DEF_TX, txLog, FhirPublication.STU3, true, "3.0.2", "fhir/test-cases"));
else if (version.startsWith("4.3"))
ve.put(version, new ValidationEngine("hl7.fhir.r4b.core#4.3.0", ValidationEngineTests.DEF_TX, txLog, FhirPublication.R4B, true, "4.3.0", "fhir/test-cases"));
else if (version.startsWith("4.0"))
ve.put(version, new ValidationEngine("hl7.fhir.r4.core#4.0.1", ValidationEngineTests.DEF_TX, txLog, FhirPublication.R4, true, "4.0.1", "fhir/test-cases"));
else if (version.startsWith("3.0"))
ve.put(version, new ValidationEngine("hl7.fhir.r3.core#3.0.2", ValidationEngineTests.DEF_TX, txLog, FhirPublication.STU3, true, "3.0.2", "fhir/test-cases"));
else if (version.startsWith("1.0"))
ve.put(version, new ValidationEngine("hl7.fhir.r2.core#1.0.2", ValidationEngineTests.DEF_TX, txLog, FhirPublication.DSTU2, true, "1.0.2", "fhir/test-cases"));
else if (version.startsWith("1.4"))