Need to export data in CCR format from Java - java

I'm working in a project which needs to export EHR information in CCR format. I must use Java. The problem that I'm facing is that I can't find an easy way to do it.
The better way to do what I'm doing would be to export as CDA using something like CDAPI but it's overly expensive (30k/year) and complicated. However it shows an example of what I'd like. Something like:
CCR ccr = new CCR();
...
out.print(ccr.toString()); // Returns XML
But it's as if this doesn't exist.
There's CCR4J but it can only read XML files and make Java objects. Not the other way around.
There's Google Health (now discontinued) which might have what I'm looking for, but I can't even figure out how to use it.
There's CCR Binder which has some convenience methods for creating CCR XML from code built on top of Google Health API, but I can't figure out how to use that either.
I could also just read the ASTM CCR Spec and implement something on my own which at this point begins to look like the faster option.
Now I would really like to stay away from Google Health. Seems to be an overkill for my task as is exporting do CDA. Any comments and suggestions are appreciated.
Just for the benefit of people searching for the same info. Here's the CCR Spec.

Sorry for this (very) late answer, but i stumbled uppon this post, cause it's still ranked high in Google if you search for java and CCR. To prevent others from giving up to quick I have to correct you:
With CCR4J you CAN create CCRs from Java Objects (since 2008) and it works like a charm! Not just parsing it from a given file.
Perhaps you just didn't got how to use the library back in time?
So here's a little Example (no valid CCR!) for the next one, who stumble over this post trying to create a CCR with this library:
//New XML-Document
ContinuityOfCareRecordDocument newDoc = ContinuityOfCareRecordDocument.Factory.newInstance();
//New CCR
ContinuityOfCareRecord newCCR = ContinuityOfCareRecord.Factory.newInstance();
//Add Object ID
newCCR.setCCRDocumentObjectID("asdasdbdffdjg343204dsss3490");
//Add new Language
newCCR.addNewLanguage().setText("English");
//Add new Body
newCCR.addNewBody();
//Add new Problem with Code
newCCR.getBody().addNewProblems().addNewProblem().addNewDescription().addNewCode().setCodingSystem("ICD");
newCCR.getBody().getProblems().getProblemArray(0).getDescription().getCodeArray(0).setValue("1225-55558");
//Add CCR to document and save
newDoc.setContinuityOfCareRecord(newCCR);
newDoc.save(new File("My-Generated-CCR.xml"));

I ended up doing something like this:
Video: Quick and Dirty CCR
To summarize: Use JAXB to make the classes them marshall them using JAXB marshaller.

Related

deeplearning4j generate response to input

I have recently been trying to learn DL4J but have run into some issues. They have an example of a neural network generating Shakespeare-like text based off and input character but I can't seem to find anything that wold indicate a possible way of creating a response to an input statement.
I would like to use an input string such as "Hello" and have it be able to generate a response of varying length depended on the input. I would like to know if this is possible using LSTM and have a point in the right direction as I have no idea where to even start.
We have plenty of documentation this actually. This gives you a layout of what an RNN looks like:
http://deeplearning4j.org/usingrnns
The model you would be looking at is character level, in general what you want is question answering though. You may want to look at an architecture like this: https://cs.umd.edu/~miyyer/pubs/2014_qb_rnn.pdf
If you are completely new to NLP, I would look at this class:
https://www.youtube.com/playlist?list=PLhVhwi0Pz282aSA2uZX4jR3SkF3BKyMOK
It covers question answering as well.

Possible alternatives or solution to reading and writing large objects with Gson java

I'm attempting to read and write an object through gson. Early in the project this was completely viable and doing great, but as I wrote more data for that object I eventually ran across something along the lines of this:
I can't seem to grab the full stacktrack seeing as it overflows my console within milliseconds, but I've pastebinned everything my console could grab: http://pastebin.com/v36d5qua
If there is a solution to this, or possibly just a better api for this purpose I would really appreciate some advice.
Current usage: http://pastebin.com/2Yk2v0Tm
GsonUtil.save(player, Player.class, new File("./resources/players/"+player.getId()+".json"));
P.S I'm new to java & this site in general, if I have misleading tags, title etc please let me know.
Don't use gson. It's slow, it's buggy, it's inconvenient to use. Just use org.json - http://theoryapp.com/parse-json-in-java/

call lucene method with php

i have problem calling lucene method in php.
im beginner in java.
n im searching in google 4 solving, but no found.
im trying write this java code to php using php java bridge.
http://www.lucenetutorial.com/lucene-in-5-minutes.html
i found this line that i dont get it how to make it to php:
IndexReader reader = DirectoryReader.open(index);
DirectoryReader has no 'new' for initial a object, that's what i dont get it to write in php.
but, if the java code like below,
Query q = new QueryParser(Version.LUCENE_43, "content", analyzer).parse(querystr);
i write like this:
$query = new Query\QueryParser($version->LUCENE_43,'content',$analyzer);
$query->parse($strquery);
n no error.
so, how to create this java code
IndexReader reader = DirectoryReader.open(index);
to php ??
really need help,
thanks a lot in advance.
You should be able to use Zend's Zend_Search_Lucene module rather than using the PHP-Java bridge directly. Check it out it may be much more easier.
Can you reference to where you read that it'd be slower? What measurements were taken and how was this done? I am not really sure that, whatever these performance implications, they'd have a noticeable impact on our application.
Also since you're using Symfony there are ready libraries that provide integration for Symfony and Symfony2. I really suggest using Zend Search Lucene especially if you don't have JAVA experience since basing your application on more than one technology is already complex enough.
Another useful thing that may come in handy is a Lucene/Sorl query builder. I know that I am not answering your exact technical question however being a PHP programmer and having experience with Sorl/Lucene I just wanted to point out the issues above so that you can take the appropriate decision.

Create an item and bag handler for a text-based RPG

For practice, I'm creating a text-based RPG using Java. I'm currently using .properties files to handle character info. I understand that YAML might be a better option, but I'm not quite sure how to implement it. Using properties, it would be easy to create an inventory handler (slot1, slot2, etc.), but creating items and reading the slots for item IDs is a little beyond me.
Could I get some assistance?
To further elaborate, I'd like to create a system with three types of items: items to be used on the environment, items to be held in hand (like weapons or shields), and items to be worn.
Don't try parsing YAML yourself(unless you want to practice parsing, or to write a parsing library). Instead, use a YAML library - you can find some for Java at the official YAML website(I don't want to recommend any because I've never done YAML in Java).
Anyways, unless the serialized data needs to be read and edited by hand frequently, I suggest you use JSON. YAML's biggest advantage is it's readability and editability(yea, JSON and XML can be read and edited by humans as well, but not as neatly and elegantly as YAML). If you don't need that advantage, JSON is better because it has excellent, renowned libraries - like GSON(From a quick glance, YAML's libraries don't seem nearly as good...)
Whatever you do - don't go with XML.

Small modification to an XML document using StAX

I'm currently trying to read in an XML file, make some minor changes (alter the value of some attributes), and write it back out again.
I have intended to use a StAX parser (javax.xml.stream.XMLStreamReader) to read in each event, see if it was one I wanted to change, and then pass it straight on to the StAX writer (javax.xml.stream.XMLStreamReader) if no changes were required.
Unfortunately, that doesn't look to be so simple - The writer has no way to take an event type and a parser object, only methods like writeAttribute and writeStartElement. Obviously I could write a big switch statement with a case for every possible type of element which can occur in an XML document, and just write it back out again, but it seems like a lot of trouble for something which seems like it should be simple.
Is there something I'm missing that makes it easy to write out a very similar XML document to the one you read in with StAX?
After a bit of mucking around, the answer seems to be to use the Event reader/writer versions rather than the Stream versions.
(i.e. javax.xml.stream.XMLEventReader and javax.xml.stream.XMLEventWriter)
See also http://www.devx.com/tips/Tip/37795, which is what finally got me moving.
StAX works pretty well and is very fast. I used it in a project to parse XML files which are up to 20MB. I don't have a thorough analysis, but it was definitely faster than SAX.
As for your question: The difference between streaming and event-handling, AFAIK is control. With the streaming API you can walk through your document step by step and get the contents you want. Whereas the event-based API you can only handle what you are interested in.
I know this is rather old question, but if anyone else is looking for something like this, there is another alternative: Woodstox Stax2 extension API has method:
XMLStreamWriter2.copyEventFromReader(XMLStreamReader2 r, boolean preserveEventData)
which copies the currently pointed-to event from stream reader using stream writer. This is not only simple but very efficient. I have used it for similar modifications with success.
(how to get XMLStreamWriter2 etc? All Woodstox-provided instances implement these extended versions -- plus there are wrappers in case someone wants to use "basic" Stax variants, as well)

Categories