Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this be used for parsing C-CDA document to C# Objects Model? #13

Open
Lijo-CheeranJoseph opened this issue Jul 26, 2018 · 10 comments
Open

Comments

@Lijo-CheeranJoseph
Copy link

Hi,

I am new to HL7 documents. Can this be used for parsing C-CDA (Consoldiated CDA )document to C# Objects Model? Any examples for this?

@SuvidhaKapse
Copy link

Hello,
I downloaded source code (MohawkMEDIC/everest) from github but its not working. can you suggest me how to used this code.

can i import ccd.xml data to mysql Database?

@justin-fyfe
Copy link

Examples for using Everest can be found here: https://github.com/MohawkMEDIC/everest/wiki/CDA-Tutorial .
IRT MySQL, it depends on your use case, if you're actually trying to update a clinical data store with information based on the contents of a CCD you'll need to parse it with Everest and then extract the relevant sections / entries you want and map them to your tables. If you're looking to just store / regurgitate the CDA then you can just store as XML in the database.

@SuvidhaKapse
Copy link

Thank you.
https://github.com/MohawkMEDIC/everest/wiki/CDA-Tutorial helps to create xml data.
I tried code and also implemented code to create xml file.
but i want to import CCD xml data to mysql not whole xml file.

Is it possible?

@SuvidhaKapse
Copy link

I am trying to run this project MohawkMEDIC/everest/everest.sln
after installing Inno Setup 6 and i also have GPMR wizard.

but console app directly exits Environment.Exit(0); .

How to run this console app.
I am sharing my screen shot .

image

@justin-fyfe
Copy link

Hi,

GPMR is telling you that it has nothing to do. You need to instruct it whether you want to compile MIF files to C#, Java, HTML, etc.

Unless you are trying to compile MIF files to C# or Java you do not need to run GPMR. GPMR is really just for rendering HL7 standards (MIF files). This has already been done in the default distribution.

I suggest getting a copy of the Everest developers guide: http://www.lulu.com/ca/en/shop/justin-fyfe/advanced-everest-developers-handbook/hardcover/product-21300345.html which shows how to create a project, load and create CDAs and use the formatting/validation.

An older version of the book is available for free: http://te.marc-hi.ca/projects/EV/downloads/HL7v3%20Application%20Programming%20Interface.pdf , however this covers a very old version of Everest. The concepts still apply. Basically, the steps to parse a CDA are the same as any HL7v3 message:

  1. Create a formatter
  2. Assign a graph aide for the data types (in CCDA that is R1 data types)
  3. Open the CDA XML with any stream
  4. Use the Everest API to do whatever business process you like with the CDA

In code it is something like this:

// Create the formatter and setup the graph aides
var formatter = new XmlIts1Formatter();

// Add CDA data types
formatter.GraphAides.Add(new DatatypeFormatter() { CompatibilityMode = DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture });

// Disable validation
formatter.ValidateConformance = false;

// Open stream or data source
using(var s = File.OpenRead("path-to-cda.xml")) {
      var result = formatter.Parse(s, typeof(ClinicalDocument));
      var instance = result.Structure as ClinicalDocument;

     // do whatever you like with the CDA
}

@SuvidhaKapse
Copy link

Thank you ...

@SuvidhaKapse
Copy link

we are getting following error message
Can't find valid cast to from 'MARC.Everest.DataTypes.IVL`1[MARC.Everest.DataTypes.TS]' to 'MARC.Everest.DataTypes.TS'

This we get during run time if we remove typeof from the formatter.parse

if we keep then the program do not run... this is the error that we get even before we run the program
Error 1 The best overloaded method match for 'MARC.Everest.Formatters.XML.ITS1.XmlIts1Formatter.Parse(System.IO.Stream, System.Reflection.Assembly)' has some invalid arguments

Error 2 Argument '2': cannot convert from 'System.Type' to 'System.Reflection.Assembly'

@SuvidhaKapse
Copy link

I am unable to solve that error. i also have http://te.marc-hi.ca/projects/EV/downloads/HL7v3%20Application%20Programming%20Interface.pdf this book.

can you suggest me how i can solve that error.

@justin-fyfe
Copy link

justin-fyfe commented Oct 25, 2019

Hi,

The error you're describing is stating the nature of the issue:

'MARC.Everest.DataTypes.IVL`1[MARC.Everest.DataTypes.TS]' to 'MARC.Everest.DataTypes.TS'

Means that your CCDA is trying to place an IVL where a TS is supposed to be. You can probably set the formatter compatibility mode settings to allow flavor and type imposing. The details from the graph result will tell you where this error exists via the result.Details array returned from the Parse() method.

The other error:

'MARC.Everest.Formatters.XML.ITS1.XmlIts1Formatter.Parse(System.IO.Stream, System.Reflection.Assembly)'

Is a compile error. The function signature looks like it is looking for an Assembly reference rather than a type. The easiest solution is to just pass the assembly in which the ClinicalDocument class exists with : typeof(ClinicalDocument).Assembly.

@JoeMark91
Copy link

Hi,

Please help:

I am getting this error: Can't find valid conversion to from 'MARC.Everest.DataTypes.EN' to 'MARC.Everest.DataTypes.ON'

that is when parser the ccda in this line of code:
var parseResult = formatter.Parse(xr, typeof(ClinicalDocument));

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants