Skip to content
/ hl7cda2 Public

An extensible library to manage HL7 CDA2 documents.

License

Notifications You must be signed in to change notification settings

giosil/hl7cda2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HL7CDA2

An extensible library to manage HL7 CDA2 documents.

Examples

Serialize a Clinical Document

ClinicalDocument cda = buildClinicalDocument();

ICDASerializer ser = new CDASerializer_IT();
    
String xml = ser.toXML(cda);

Deserialize a Clinical Document

ICDADeserializer dser = new CDADeserializer();

dser.load(xml);

ClinicalDocument cda = dser.getClinicalDocument();

Render a Clinical Document

ICDARenderer ren = new CDARenderer_IT();

Map<String, Object> opt = new HashMap<String, Object>();
opt.put("style",     "body{ color: #202020; margin: 4 8 4 8; }");
opt.put("table",     "width: 100%;");
opt.put("th",        "background-color: #a8d7f7;");
opt.put("td",        "background-color: #cfeafc;");
opt.put("title",     "color: #000080;");
opt.put("paragraph", "font-style: italic;");

ren.setOptions(opt);
    
String html = ren.toHTML(cda);

Transform a Clinical Document

ICDARenderer ren = new CDARenderer_IT();
    
String html = ren.transform(xml, "CDAit.xsl");

Validate a Clinical Document

ICDAValidator val = new CDAValidator();

ValidationResult result = val.validate(xml);

System.out.println(result.isSuccess());
System.out.println(result.getErrors());
System.out.println(result.getFatals());

XAdES signature

ICDASigner sig = new CDASignerXAdES();

byte[] signed = sig.sign(xml);

System.out.println(new String(signed));

CAdES signature

ICDASigner sig = new CDASignerCAdES();

byte[] pkcs7 = sig.sign(xml);

Build

  • git clone https://github.com/giosil/hl7cda2.git
  • mvn clean install
  • mvn dependency:copy-dependencies - To get libraries in target/dependency folder.
  • mvn cobertura:cobertura - To run the unit tests and generate a Cobertura report.
  • mvn checkstyle:checkstyle - To check source code respect the rules defined in checkstyle.xml.

Contributors