SMILE-3459 Implemented -l parameter in validator. Added SnapshotGeneratingValidationSupport to R4 support chain.

This commit is contained in:
kylejule 2022-09-01 14:09:18 -06:00
parent 68c343902a
commit adc56dea65
6 changed files with 1072 additions and 9 deletions

View File

@ -27,6 +27,7 @@ import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.FhirValidator;
import ca.uhn.fhir.validation.SingleValidationMessage; import ca.uhn.fhir.validation.SingleValidationMessage;
import ca.uhn.fhir.validation.ValidationOptions;
import ca.uhn.fhir.validation.ValidationResult; import ca.uhn.fhir.validation.ValidationResult;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.helger.commons.io.file.FileHelper; import com.helger.commons.io.file.FileHelper;
@ -37,10 +38,11 @@ import org.apache.commons.cli.ParseException;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.text.WordUtils; import org.apache.commons.lang3.text.WordUtils;
import org.fusesource.jansi.Ansi.Color; import org.fusesource.jansi.Ansi.Color;
import org.hl7.fhir.common.hapi.validation.support.LocalFileValidationSupport;
import org.hl7.fhir.common.hapi.validation.support.SnapshotGeneratingValidationSupport;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator; import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport; import org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport;
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain; import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
import org.hl7.fhir.instance.model.api.IBaseResource;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -136,13 +138,10 @@ public class ValidateCommand extends BaseCommand {
FhirContext ctx = getFhirContext(); FhirContext ctx = getFhirContext();
FhirValidator val = ctx.newValidator(); FhirValidator val = ctx.newValidator();
IBaseResource localProfileResource = null; ValidationOptions options = new ValidationOptions();
if (theCommandLine.hasOption("l")) { if (theCommandLine.hasOption("l")) {
String localProfile = theCommandLine.getOptionValue("l"); String localProfile = theCommandLine.getOptionValue("l");
ourLog.info("Loading profile: {}", localProfile); options.addProfile(localProfile);
String input = loadFile(localProfile);
localProfileResource = ca.uhn.fhir.rest.api.EncodingEnum.detectEncodingNoDefault(input).newParser(ctx).parseResource(input);
} }
if (theCommandLine.hasOption("p")) { if (theCommandLine.hasOption("p")) {
@ -164,7 +163,11 @@ public class ValidateCommand extends BaseCommand {
case R4: { case R4: {
FhirInstanceValidator instanceValidator = new FhirInstanceValidator(ctx); FhirInstanceValidator instanceValidator = new FhirInstanceValidator(ctx);
val.registerValidatorModule(instanceValidator); val.registerValidatorModule(instanceValidator);
ValidationSupportChain validationSupport = new ValidationSupportChain(new DefaultProfileValidationSupport(ctx), new InMemoryTerminologyServerValidationSupport(ctx)); ValidationSupportChain validationSupport = new ValidationSupportChain(
new DefaultProfileValidationSupport(ctx),
new InMemoryTerminologyServerValidationSupport(ctx),
new LocalFileValidationSupport(ctx),
new SnapshotGeneratingValidationSupport(ctx));
if (theCommandLine.hasOption("r")) { if (theCommandLine.hasOption("r")) {
validationSupport.addValidationSupport((IValidationSupport) new LoadingValidationSupportDstu3()); validationSupport.addValidationSupport((IValidationSupport) new LoadingValidationSupportDstu3());
@ -182,7 +185,7 @@ public class ValidateCommand extends BaseCommand {
ValidationResult results; ValidationResult results;
try { try {
results = val.validateWithResult(contents); results = val.validateWithResult(contents, options);
} catch (DataFormatException e) { } catch (DataFormatException e) {
throw new CommandFailureException(Msg.code(1621) + e.getMessage()); throw new CommandFailureException(Msg.code(1621) + e.getMessage());
} }

View File

@ -34,4 +34,18 @@ public class ValidateCommandTest {
"-p", "-p",
"-n", resourcePath}); "-n", resourcePath});
} }
@Test
public void testValidateLocalProfileAndResourceR4() {
String patientJson = ValidateCommandTest.class.getResource("/validate/Patient.json").getFile();
String patientProfile = ValidateCommandTest.class.getResource("/validate/PatientIn-Profil.json").getFile();
ourLog.info(patientJson);
App.main(new String[] {
"validate",
"--fhir-version", "r4",
"--profile",
"--file", patientJson,
"-l", patientProfile});
}
} }

View File

@ -0,0 +1,128 @@
{
"resourceType": "Patient",
"id": "ExamplePatientPatientFull",
"meta": {
"profile": [
"https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient"
]
},
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
},
"system": "https://www.example.org/fhir/sid/patienten",
"value": "42285243",
"assigner": {
"display": "Charit<69> <20> Universit<69>tsmedizin Berlin",
"identifier": {
"system": "https://www.medizininformatik-initiative.de/fhir/core/CodeSystem/core-location-identifier",
"value": "Charit<69>"
}
}
},
{
"use": "official",
"type": {
"coding": [
{
"system": "http://fhir.de/CodeSystem/identifier-type-de-basis",
"code": "GKV"
}
]
},
"system": "http://fhir.de/sid/gkv/kvid-10",
"value": "Z234567890",
"assigner": {
"identifier": {
"use": "official",
"value": "109519005",
"system": "http://fhir.de/sid/arge-ik/iknr"
}
}
},
{
"use": "secondary",
"type": {
"coding": [
{
"system": "http://fhir.de/CodeSystem/identifier-type-de-basis",
"code": "PKV"
}
]
},
"value": "123456",
"assigner": {
"display": "Signal Iduna"
}
}
],
"name": [
{
"use": "official",
"family": "Van-der-Dussen",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/humanname-own-name",
"valueString": "Van-der-Dussen"
}
]
},
"given": [
"Maja",
"Julia"
],
"prefix": [
"Prof. Dr. med."
],
"_prefix": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier",
"valueCode": "AC"
}
]
}
]
},
{
"use": "maiden",
"family": "Haffer"
}
],
"deceasedBoolean": false,
"address": [
{
"type": "both",
"line": [
"Anna-Louisa-Karsch Str. 2"
],
"city": "Berlin",
"_city": {
"extension": [
{
"url": "http://fhir.de/StructureDefinition/destatis/ags",
"valueCoding": {
"system": "http://fhir.de/sid/destatis/ags",
"code": "11000000"
}
}
]
},
"state": "DE-BE",
"postalCode": "10178",
"country": "DE"
}
],
"managingOrganization": {
"reference": "Organization/Charite-Universitaetsmedizin-Berlin"
}
}

View File

@ -0,0 +1,880 @@
{
"resourceType": "StructureDefinition",
"id": "Profile-MII-Patient-PatientIn",
"url": "https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient",
"version": "2.0.0",
"name": "Profile_MII_Patient_PatientIn",
"title": "Profile - MI-I - Patient - PatientIn",
"status": "active",
"description": "Dieses Profil beschreibt eine PatientIn in der Medizininformatik-Initiative.",
"fhirVersion": "4.0.1",
"kind": "resource",
"abstract": false,
"type": "Patient",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
"derivation": "constraint",
"differential": {
"element": [
{
"id": "Patient",
"path": "Patient",
"constraint": [
{
"key": "mii-pat-1",
"severity": "error",
"human": "Falls die Geschlechtsangabe 'other' gewählt wird, muss die amtliche Differenzierung per Extension angegeben werden",
"expression": "gender.exists() and gender='other' implies gender.extension('http://fhir.de/StructureDefinition/gender-amtlich-de').exists()",
"source": "https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient"
}
]
},
{
"id": "Patient.id",
"path": "Patient.id",
"mustSupport": true
},
{
"id": "Patient.meta",
"path": "Patient.meta",
"mustSupport": true
},
{
"id": "Patient.meta.source",
"path": "Patient.meta.source",
"mustSupport": true
},
{
"id": "Patient.meta.profile",
"path": "Patient.meta.profile",
"mustSupport": true
},
{
"id": "Patient.identifier",
"path": "Patient.identifier",
"slicing": {
"discriminator": [
{
"type": "pattern",
"path": "$this"
}
],
"rules": "open"
},
"min": 1,
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV",
"path": "Patient.identifier",
"sliceName": "versichertenId_GKV",
"max": "1",
"type": [
{
"code": "Identifier",
"profile": [
"http://fhir.de/StructureDefinition/identifier-kvid-10"
]
}
],
"patternIdentifier": {
"type": {
"coding": [
{
"system": "http://fhir.de/CodeSystem/identifier-type-de-basis",
"code": "GKV"
}
]
}
},
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.type",
"path": "Patient.identifier.type",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.system",
"path": "Patient.identifier.system",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.value",
"path": "Patient.identifier.value",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.assigner",
"path": "Patient.identifier.assigner",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.assigner.identifier",
"path": "Patient.identifier.assigner.identifier",
"min": 1,
"type": [
{
"code": "Identifier",
"profile": [
"http://fhir.de/StructureDefinition/identifier-iknr"
]
}
],
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.assigner.identifier.type",
"path": "Patient.identifier.assigner.identifier.type",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.assigner.identifier.system",
"path": "Patient.identifier.assigner.identifier.system",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertenId_GKV.assigner.identifier.value",
"path": "Patient.identifier.assigner.identifier.value",
"mustSupport": true
},
{
"id": "Patient.identifier:pid",
"path": "Patient.identifier",
"sliceName": "pid",
"type": [
{
"code": "Identifier",
"profile": [
"http://fhir.de/StructureDefinition/identifier-pid"
]
}
],
"patternIdentifier": {
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
},
"mustSupport": true
},
{
"id": "Patient.identifier:pid.type",
"path": "Patient.identifier.type",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.identifier:pid.system",
"path": "Patient.identifier.system",
"mustSupport": true
},
{
"id": "Patient.identifier:pid.value",
"path": "Patient.identifier.value",
"mustSupport": true
},
{
"id": "Patient.identifier:pid.assigner",
"path": "Patient.identifier.assigner",
"type": [
{
"code": "Reference",
"profile": [
"https://www.medizininformatik-initiative.de/fhir/core/StructureDefinition/MII-Reference"
]
}
],
"mustSupport": true
},
{
"id": "Patient.identifier:pid.assigner.identifier.type",
"path": "Patient.identifier.assigner.identifier.type",
"patternCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "XX"
}
]
},
"mustSupport": true
},
{
"id": "Patient.identifier:pid.assigner.identifier.system",
"path": "Patient.identifier.assigner.identifier.system",
"constraint": [
{
"key": "mii-pat-1",
"severity": "error",
"human": "Entweder IKNR oder MII Core Location Identifier soll verwendet werden",
"expression": "$this = 'http://fhir.de/NamingSystem/arge-ik/iknr' or $this = 'https://www.medizininformatik-initiative.de/fhir/core/CodeSystem/core-location-identifier'",
"source": "https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient"
}
]
},
{
"id": "Patient.identifier:versichertennummer_pkv",
"path": "Patient.identifier",
"sliceName": "versichertennummer_pkv",
"max": "1",
"type": [
{
"code": "Identifier",
"profile": [
"http://fhir.de/StructureDefinition/identifier-pkv"
]
}
],
"patternIdentifier": {
"type": {
"coding": [
{
"system": "http://fhir.de/CodeSystem/identifier-type-de-basis",
"code": "PKV"
}
]
}
},
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.use",
"path": "Patient.identifier.use",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.type",
"path": "Patient.identifier.type",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.value",
"path": "Patient.identifier.value",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.assigner",
"path": "Patient.identifier.assigner",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.assigner.identifier.type",
"path": "Patient.identifier.assigner.identifier.type",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.assigner.identifier.system",
"path": "Patient.identifier.assigner.identifier.system",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.assigner.identifier.value",
"path": "Patient.identifier.assigner.identifier.value",
"mustSupport": true
},
{
"id": "Patient.identifier:versichertennummer_pkv.assigner.display",
"path": "Patient.identifier.assigner.display",
"mustSupport": true
},
{
"id": "Patient.name",
"path": "Patient.name",
"slicing": {
"discriminator": [
{
"type": "pattern",
"path": "$this"
}
],
"rules": "open"
},
"min": 1,
"mustSupport": true
},
{
"id": "Patient.name:name",
"path": "Patient.name",
"sliceName": "name",
"min": 1,
"max": "1",
"type": [
{
"code": "HumanName",
"profile": [
"http://fhir.de/StructureDefinition/humanname-de-basis"
]
}
],
"patternHumanName": {
"use": "official"
},
"mustSupport": true
},
{
"id": "Patient.name:name.use",
"path": "Patient.name.use",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.name:name.family",
"path": "Patient.name.family",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.name:name.family.extension",
"path": "Patient.name.family.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.name:name.family.extension:namenszusatz",
"path": "Patient.name.family.extension",
"sliceName": "namenszusatz",
"mustSupport": true
},
{
"id": "Patient.name:name.family.extension:nachname",
"path": "Patient.name.family.extension",
"sliceName": "nachname",
"mustSupport": true
},
{
"id": "Patient.name:name.family.extension:vorsatzwort",
"path": "Patient.name.family.extension",
"sliceName": "vorsatzwort",
"mustSupport": true
},
{
"id": "Patient.name:name.given",
"path": "Patient.name.given",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.name:name.prefix",
"path": "Patient.name.prefix",
"mustSupport": true
},
{
"id": "Patient.name:name.prefix.extension",
"path": "Patient.name.prefix.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.name:name.prefix.extension:prefix-qualifier",
"path": "Patient.name.prefix.extension",
"sliceName": "prefix-qualifier",
"max": "1",
"mustSupport": true
},
{
"id": "Patient.name:geburtsname",
"path": "Patient.name",
"sliceName": "geburtsname",
"max": "1",
"type": [
{
"code": "HumanName",
"profile": [
"http://fhir.de/StructureDefinition/humanname-de-basis"
]
}
],
"patternHumanName": {
"use": "maiden"
},
"mustSupport": true
},
{
"id": "Patient.name:geburtsname.use",
"path": "Patient.name.use",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.name:geburtsname.family",
"path": "Patient.name.family",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.name:geburtsname.family.extension",
"path": "Patient.name.family.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.name:geburtsname.family.extension:namenszusatz",
"path": "Patient.name.family.extension",
"sliceName": "namenszusatz",
"mustSupport": true
},
{
"id": "Patient.name:geburtsname.family.extension:nachname",
"path": "Patient.name.family.extension",
"sliceName": "nachname",
"mustSupport": true
},
{
"id": "Patient.name:geburtsname.family.extension:vorsatzwort",
"path": "Patient.name.family.extension",
"sliceName": "vorsatzwort",
"mustSupport": true
},
{
"id": "Patient.name:geburtsname.given",
"path": "Patient.name.given",
"max": "0"
},
{
"id": "Patient.name:geburtsname.prefix",
"path": "Patient.name.prefix",
"max": "0"
},
{
"id": "Patient.name:geburtsname.prefix.extension",
"path": "Patient.name.prefix.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.name:geburtsname.prefix.extension:prefix-qualifier",
"path": "Patient.name.prefix.extension",
"sliceName": "prefix-qualifier",
"max": "1",
"mustSupport": true
},
{
"id": "Patient.gender",
"path": "Patient.gender",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.gender.extension",
"path": "Patient.gender.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.gender.extension:other-amtlich",
"path": "Patient.gender.extension",
"sliceName": "other-amtlich",
"max": "1",
"type": [
{
"code": "Extension",
"profile": [
"http://fhir.de/StructureDefinition/gender-amtlich-de"
]
}
],
"mustSupport": true
},
{
"id": "Patient.birthDate",
"path": "Patient.birthDate",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.birthDate.extension",
"path": "Patient.birthDate.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.birthDate.extension:data-absent-reason",
"path": "Patient.birthDate.extension",
"sliceName": "data-absent-reason",
"type": [
{
"code": "Extension",
"profile": [
"http://hl7.org/fhir/StructureDefinition/data-absent-reason"
]
}
],
"mustSupport": true
},
{
"id": "Patient.deceased[x]",
"path": "Patient.deceased[x]",
"mustSupport": true
},
{
"id": "Patient.address",
"path": "Patient.address",
"slicing": {
"discriminator": [
{
"type": "pattern",
"path": "$this"
}
],
"rules": "open"
},
"min": 1,
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift",
"path": "Patient.address",
"sliceName": "Strassenanschrift",
"type": [
{
"code": "Address",
"profile": [
"http://fhir.de/StructureDefinition/address-de-basis"
]
}
],
"patternAddress": {
"type": "both"
},
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.extension",
"path": "Patient.address.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.address:Strassenanschrift.extension:Stadtteil",
"path": "Patient.address.extension",
"sliceName": "Stadtteil",
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.type",
"path": "Patient.address.type",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.line",
"path": "Patient.address.line",
"min": 1,
"max": "3",
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.line.extension",
"path": "Patient.address.line.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.address:Strassenanschrift.line.extension:Strasse",
"path": "Patient.address.line.extension",
"sliceName": "Strasse",
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.line.extension:Hausnummer",
"path": "Patient.address.line.extension",
"sliceName": "Hausnummer",
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.line.extension:Adresszusatz",
"path": "Patient.address.line.extension",
"sliceName": "Adresszusatz",
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.line.extension:Postfach",
"path": "Patient.address.line.extension",
"sliceName": "Postfach",
"max": "0"
},
{
"id": "Patient.address:Strassenanschrift.city",
"path": "Patient.address.city",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.city.extension",
"path": "Patient.address.city.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.address:Strassenanschrift.city.extension:gemeindeschluessel",
"path": "Patient.address.city.extension",
"sliceName": "gemeindeschluessel",
"max": "1",
"type": [
{
"code": "Extension",
"profile": [
"http://fhir.de/StructureDefinition/destatis/ags"
]
}
],
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.postalCode",
"path": "Patient.address.postalCode",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.address:Strassenanschrift.country",
"path": "Patient.address.country",
"min": 1,
"constraint": [
{
"key": "pat-cnt-2or3-char",
"severity": "warning",
"human": "The content of the country element (if present) SHALL be selected EITHER from ValueSet ISO Country Alpha-2 http://hl7.org/fhir/ValueSet/iso3166-1-2 OR MAY be selected from ISO Country Alpha-3 Value Set http://hl7.org/fhir/ValueSet/iso3166-1-3, IF the country is not specified in value Set ISO Country Alpha-2 http://hl7.org/fhir/ValueSet/iso3166-1-2.",
"expression": "country.empty() or (country.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-2') or country.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-3'))",
"source": "https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient"
}
],
"mustSupport": true
},
{
"id": "Patient.address:Postfach",
"path": "Patient.address",
"sliceName": "Postfach",
"type": [
{
"code": "Address",
"profile": [
"http://fhir.de/StructureDefinition/address-de-basis"
]
}
],
"patternAddress": {
"type": "postal"
},
"mustSupport": true
},
{
"id": "Patient.address:Postfach.extension",
"path": "Patient.address.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.address:Postfach.extension:Stadtteil",
"path": "Patient.address.extension",
"sliceName": "Stadtteil",
"mustSupport": true
},
{
"id": "Patient.address:Postfach.type",
"path": "Patient.address.type",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.address:Postfach.line",
"path": "Patient.address.line",
"min": 1,
"max": "3",
"mustSupport": true
},
{
"id": "Patient.address:Postfach.line.extension",
"path": "Patient.address.line.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.address:Postfach.line.extension:Strasse",
"path": "Patient.address.line.extension",
"sliceName": "Strasse",
"max": "0"
},
{
"id": "Patient.address:Postfach.line.extension:Hausnummer",
"path": "Patient.address.line.extension",
"sliceName": "Hausnummer",
"max": "0"
},
{
"id": "Patient.address:Postfach.line.extension:Adresszusatz",
"path": "Patient.address.line.extension",
"sliceName": "Adresszusatz",
"max": "0"
},
{
"id": "Patient.address:Postfach.line.extension:Postfach",
"path": "Patient.address.line.extension",
"sliceName": "Postfach",
"mustSupport": true
},
{
"id": "Patient.address:Postfach.city",
"path": "Patient.address.city",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.address:Postfach.city.extension",
"path": "Patient.address.city.extension",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "url"
}
],
"rules": "open"
}
},
{
"id": "Patient.address:Postfach.city.extension:gemeindeschluessel",
"path": "Patient.address.city.extension",
"sliceName": "gemeindeschluessel",
"max": "1",
"type": [
{
"code": "Extension",
"profile": [
"http://fhir.de/StructureDefinition/destatis/ags"
]
}
],
"mustSupport": true
},
{
"id": "Patient.address:Postfach.postalCode",
"path": "Patient.address.postalCode",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.address:Postfach.country",
"path": "Patient.address.country",
"min": 1,
"constraint": [
{
"key": "pat-cnt-2or3-char",
"severity": "warning",
"human": "The content of the country element (if present) SHALL be selected EITHER from ValueSet ISO Country Alpha-2 http://hl7.org/fhir/ValueSet/iso3166-1-2 OR MAY be selected from ISO Country Alpha-3 Value Set http://hl7.org/fhir/ValueSet/iso3166-1-3, IF the country is not specified in value Set ISO Country Alpha-2 http://hl7.org/fhir/ValueSet/iso3166-1-2.",
"expression": "country.empty() or (country.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-2') or country.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-3'))",
"source": "https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient"
}
],
"mustSupport": true
},
{
"id": "Patient.link",
"path": "Patient.link",
"mustSupport": true
},
{
"id": "Patient.link.other",
"path": "Patient.link.other",
"type": [
{
"code": "Reference",
"profile": [
"https://www.medizininformatik-initiative.de/fhir/core/StructureDefinition/MII-Reference"
]
}
],
"mustSupport": true
},
{
"id": "Patient.link.type",
"path": "Patient.link.type",
"mustSupport": true
}
]
}
}

View File

@ -0,0 +1,39 @@
package org.hl7.fhir.common.hapi.validation.support;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.i18n.Msg;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.jetbrains.annotations.Nullable;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import static org.apache.commons.lang3.StringUtils.defaultString;
public class LocalFileValidationSupport implements IValidationSupport {
final private FhirContext myCtx;
public LocalFileValidationSupport(FhirContext ctx) {
this.myCtx = ctx;
}
@Override
public FhirContext getFhirContext() {
return myCtx;
}
@Nullable
@Override
public IBaseResource fetchStructureDefinition(String theUrl) {
try {
String contents = IOUtils.toString(new InputStreamReader(new FileInputStream(theUrl), "UTF-8"));
return myCtx.newJsonParser().parseResource(contents);
} catch (IOException e) {
return null;
}
}
}

View File

@ -229,7 +229,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
.setBestPracticeWarningLevel(getBestPracticeWarningLevel()) .setBestPracticeWarningLevel(getBestPracticeWarningLevel())
.setErrorForUnknownProfiles(isErrorForUnknownProfiles()) .setErrorForUnknownProfiles(isErrorForUnknownProfiles())
.setExtensionDomains(getExtensionDomains()) .setExtensionDomains(getExtensionDomains())
.setValidatorResourceFetcher(validatorResourceFetcher)
.setValidationPolicyAdvisor(validatorPolicyAdvisor) .setValidationPolicyAdvisor(validatorPolicyAdvisor)
.setNoTerminologyChecks(isNoTerminologyChecks()) .setNoTerminologyChecks(isNoTerminologyChecks())
.setNoExtensibleWarnings(isNoExtensibleWarnings()) .setNoExtensibleWarnings(isNoExtensibleWarnings())