Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Model Driven Health Tools » Containment in FHIR(MDHT FHIR does not save/load)
Containment in FHIR [message #1742784] Wed, 07 September 2016 14:51 Go to next message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 52
Registered: July 2016
Member
I attempted to create a FHIR resource programmatically and save it to XML. EMF threw an error complaining that one of the FHIR data types was not contained.
I have encountered this kind of error in the past on other projects. I fixed it by editing the ecore model. I am not sure what to do in this case. What?

Here's my implementation:
StructureDefinition sd = FhirResourceFactory.eINSTANCE.createStructureDefinition();
Uri uri = FhirDatatypeFactory.eINSTANCE.createUri();
uri.setValue("StructureDefinition/CDSiPatient");
sd.setUrl(uri);


Here's how I saved it:
FhirResourcePackage.eINSTANCE.eClass();
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml", new XMLResourceFactoryImpl());
Resource resource = resourceSet.createResource(URI.createURI(fileName));
resource.getContents().add(eObject);
try {
   resource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
  e.printStackTrace();
}


Here is the error:
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object 'org.eclipse.mdht.uml.fhir.core.datatype.impl.UriImpl@6b587673 (value: StructureDefinition/CDSiPatient)' is not contained in a resource.
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSave(XMLSaveImpl.java:301)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:265)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:389)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:999)
	at first.RxEMF.Save.save(Save.java:48)
	at first.RxEMF.PatientProfiler.run(PatientProfiler.java:32)
	at first.RxEMF.PatientProfiler.main(PatientProfiler.java:37)
Caused by: org.eclipse.emf.ecore.xmi.DanglingHREFException: The object 'org.eclipse.mdht.uml.fhir.core.datatype.impl.UriImpl@6b587673 (value: StructureDefinition/CDSiPatient)' is not contained in a resource.

Re: Containment in FHIR [message #1742811 is a reply to message #1742784] Wed, 07 September 2016 18:36 Go to previous messageGo to next message
Dave Carlson is currently offline Dave CarlsonFriend
Messages: 402
Registered: July 2009
Senior Member
The Java ECore implementation for FHIR that you are using, assuming it is from the MDHT git repo, is a very early test to generate Java runtime libraries from UML FHIR specification models that were imported from the HL7 spec. I created this proof-of-concept about a year ago using a FHIR DSTU-2 UML model. It was never tested as a library for read/writing FHIR instances, and some additional utility libraries must be written to enable that (e.g. to read/write FHIR Reference datatypes from ECore references).

At this time, we have no organizational support and developer resources to update and complete development of the MDHT Java runtime library for FHIR. All resources are focused on completing the UML representation of FHIR, and using those UML models to support MDMI mapping efforts. And limited development to complete a first release of FHIR profile design tooling.

If you will be at the HL7 meeting in Baltimore, we'd be happy to meet and discuss how to move this work forward. Sean Muir will also be attending.

Thanks,
Dave Carlson
Re: Containment in FHIR [message #1742882 is a reply to message #1742811] Thu, 08 September 2016 12:22 Go to previous message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 52
Registered: July 2016
Member
The MDHT code base I am using is indeed from the git repo. I was concerned as to whether the FHIR code was ready for prime time. You seem to have answered my question.

I shall be at the FHIR connectathon for sure. As to whether I'll be able to attend the WGM proper...that depends on funding. We'll see.

I would like to use MDHT in my current project, which is to put up FHIR based access to the nation's immunization information systems. I can get around the variances between MDHT and Furore well enough, but the MDHT containment issue is another matter. I might have to forego MDHT for the moment. Alas, I like EMF and would prefer an EMF based implementation.

Quote:
Insufferable difficulties meet me at every turn.
--W. S. Gilbert
Previous Topic:MDHT and FHIR Profiles
Next Topic:Validation based on severity level
Goto Forum:
  


Current Time: Tue Sep 25 05:55:46 GMT 2018

Powered by FUDForum. Page generated in 0.02400 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top