ccr4j


Java library for Continuity of Care Record

This is the ccr4j project, which provides a Java API to help applications work with ContinuityOfCareRecord XML documents.

It uses Ant to build and Ivy for dependency management. The XML bindings are done with XMLBeans, which also generates the Java object model for the CCR.

Example usage: 1. Add XMLBeans to your dependencies. Use maven, or download it from http://xmlbeans.apache.org/ 1. Download the ccr4j library and add to your dependencies. 1. Get some sample CCR's from the Google health project. I used http://googlehealthsamples.googlecode.com/svn/trunk/CCR_samples/CompleteProfile.xml

Full code example: ``` import com.google.code.ccr4j.CodeType; import com.google.code.ccr4j.CodedDescriptionType; import com.google.code.ccr4j.ContinuityOfCareRecordDocument; import com.google.code.ccr4j.ContinuityOfCareRecordDocument.ContinuityOfCareRecord; import com.google.code.ccr4j.ContinuityOfCareRecordDocument.ContinuityOfCareRecord.Body.Problems; import com.google.code.ccr4j.ProblemType;

import org.apache.xmlbeans.XmlException;

import java.io.IOException; import java.io.StringWriter; import java.io.Writer;

public class CCRExample {

private void run() throws IOException, XmlException { // Parse from XML ContinuityOfCareRecord ccr = ContinuityOfCareRecordDocument.Factory.parse( getClass().getResource("CompleteProfile.xml")).getContinuityOfCareRecord(); Problems problems = ccr.getBody().getProblems(); System.out.println("Problems = " + problems.xmlText());

// Modify
ProblemType addedProblem = problems.addNewProblem();
addedProblem.setDescription(CodedDescriptionType.Factory.newInstance());
CodeType codeType = addedProblem.getDescription().addNewCode();
codeType.setCodingSystem("ICD9");
codeType.setValue("100.00");

// Serialize back to XML
Writer stringWriter = new StringWriter();
ccr.save(stringWriter);
System.out.println("Serialized = " + stringWriter);

}

public static void main(String[] args) throws Exception { new CCRExample().run(); } }

```

Project Information

Labels:
ccr health healthcare xmlbeans