{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">WARNING</td><td>[Practitioner.meta.profile[0]]</td><td><pre>StructureDefinition reference \"http://hl7.org/fhir/StructureDefinition/ocp-practitioner\" could not be resolved</pre></td>\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t</div>"
},
"issue": [
{
"severity": "warning",
"code": "processing",
"diagnostics": "StructureDefinition reference \"http://hl7.org/fhir/StructureDefinition/ocp-practitioner\" could not be resolved",
"location": [
"Practitioner.meta.profile[0]"
]
}
]
}The profile is stored as a StructureDefinition locally. Can the validator be configured to look at locally stored structure definitions? Thanks in advance.
- Anthony
IParser xmlParser = FhirContext.forR4().newXmlParser();
xmlParser.setParserErrorHandler(new StrictErrorHandler());
List<StructureDefinition> definitions = new ArrayList<>();
try {
StructureDefinition sd = xmlParser.parseResource(StructureDefinition.class, new FileReader(<##YOUR_FILE_PATH##>));
definitions.add(sd);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
public class MyValidationSupport implements IValidationSupport {
public MyValidationSupport() {
//Definitions list gotten from code above
definitionsMap = new HashMap<>();
definitions.forEach(def -> definitionsMap.put(def.getUrl(), def));
}
@Override
public ValueSet.ValueSetExpansionComponent expandValueSet(FhirContext theContext, ValueSet.ConceptSetComponent theInclude) {
return null;
}
@Override
public List<IBaseResource> fetchAllConformanceResources(FhirContext theContext) {
return null;
}
@Override
public List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext) {
return definitions;
}
@Override
public CodeSystem fetchCodeSystem(FhirContext theContext, String theSystem) {
return null;
}
@Override
public <T extends IBaseResource> T fetchResource(FhirContext theContext, Class<T> theClass, String theUri) {
return (T) definitionsMap.get(theUri);
}
@Override
public StructureDefinition fetchStructureDefinition(FhirContext theCtx, String theUrl) {
return definitionsMap.get(theUrl);
}
@Override
public boolean isCodeSystemSupported(FhirContext theContext, String theSystem) {
return false;
}
@Override
public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) {
return null;
}
}
ctx = FhirContext.forR4();
validator = ctx.newValidator();
instanceValidator = new FhirInstanceValidator();
IValidationSupport valSupport = new MyValidationSupport();
ValidationSupportChain support = new ValidationSupportChain(valSupport, new DefaultProfileValidationSupport());
instanceValidator.setValidationSupport(support);
validator.registerValidatorModule(instanceValidator);
MyPractitioner mP = new MyPractitioner();
Meta meta = new Meta().addProfile("http://acme.org/my-structure-definition");
dvP.setMeta(met1);
StructureDefinition reference "http://hl7.org/fhir/StructureDefinition/ocp-practitioner" could not be resolved
--
You received this message because you are subscribed to a topic in the Google Groups "HAPI FHIR" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hapi-fhir/0hUGgBO2Xbo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hapi-fhir+...@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/4e42b62f-c03f-44f9-8432-413b1cc85a25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/644063be-1252-4fbd-b47f-719148847397%40googlegroups.com.
{"resourceType": "Practitioner","meta": {"profile": []},"identifier": [{"system": "http://hl7.org/fhir/sid/us-npi","value": "7722720916"}],"active": true,"name": [{"family": "","given": [""]}],"telecom": [{"system": "phone","value": "410-529-1250","rank": 1},{"system": "email","value": "firstname...@valleymedicalcenter.com","rank": 2}],"address": [{"line": ["4072 Healthcare Avenue","Suite 300"],"city": "Toledo","state": "OH","postalCode": "41076","country": "US"}]}
I've a feeling the url hl7.org is causing DefaultValidationSupport classes to try to validate the profile, as it supports that domain.