I’m working with a team developing a Telemedicine application and we are looking at integrating the application with OpenEMR. Our intention is to save data that is gathered during the encounter into OpenEMR. We will also most likely need to interface to scheduling data in OpenEMR.
I was hoping to find a web service programming interface within OpenEMR that would allow us to interface to it via a standard interface, but I haven’t been able to find anything-at least not for saving encounter data. Is there something that maybe I’ve overlooked?
Lacking an existing interface, my thinking would be to develop a web service based API that sits within OpenEMR and accesses the database directly (presumably, using PHP and MySQL). Before I start into that, I thought I should check to see whether there is any similar work already in the project that I could pattern after, and/or whether such work would be likely to be incorporated into the base if I were to submit it.
Not sure what your are trying to do here exactly. OpenEMR is a web based application, so if you are doing telemedicine (which is no different from 'in-person" medicine except for the video remoteness, then you should not need to interface, just access OpenEMR and enter the encounter as it happens.
If you are trying to send data from a different EMR data collection system to OpenEMR see the data import options/example in contrib/utils/import_mi2xml.php. We wrote this as tool to use offline EMR data collection. A cron job monitors the reciept of XML files from an outside source and imports them into OpenEMR using this script we wrote. It’s in the development tip for ver 4.0
The import might serve our needs, at least for getting encounter data into the EMR. I was looking for something a little more interactive, so we could both submit and extract data in real-time. I’ll check out the import and see how we can use that. Is there a corresponding export so that we can retrieve data in a structured format as well?
You describe telemedicine as being the same as in-person medicine except for video remoteness, but we’re doing more than that. We are gathering a lot of different data from both the patient and the provider before, during and after the encounter, and we want to be able to store that data (or at least pointers to it) in the EMR. We also want to use practice management scheduling data as a launching point for our application.
Probably the best way to think about what we are trying to achieve relative to OpenEMR is to think of it as a different user interface that could sit in front of OpenEMR, utilizing the encounter, scheduling, and some of the patient and provider data. We still expect the bulk of the practice management and medical records maintenance would occur via the OpenEMR user interface, but when it comes to the encounter, we’ve developed a pretty significant interactive user experience for both the provider and for the remote patient. We’d like to have that tied in with OpenEMR as cleanly as possible and that’s where a web based API would be useful.
An API can enable a whole ecosystem of applications and extensions to develop around a core application, which would seem ideal for OpenEMR and its community. If it doesn’t exist now, it seems like a great direction to go in the future. Of course, that’s easier said than done.
It spits “Unable to load XML file!” out at me. I’ve tried a bunch of other variations of the above with ‘-f’ moved or removed, giving the full path and other changes, but it either does nothing, opens the help or prints “Unable to load XML file!”.
Can Tony or anyone else from MI^2 provide some suggestions?
I suspect that the input file name should not have - in front of it or it will try and open the file named “-data.xml” which is not what you intend, I’m sure.
-Tony
I found a problem in my XML file, I recently added a health card field and left the / out of the closing tag (and didn’t check it afterwards, oops). It now runs without an error but the data doesn’t show up in OpenEMR. I’m going to add some echoes in a few places and see if I can figure it out. If I can’t find the problem I’ll be back.
Alright, I found the line that fails and have been trying to figure out why. The code is based on lines 100-102 of import_mi2xml:
$query = “SELECT pid FROM `patient_data` WHERE pubpid LIKE ‘$healthcard’”;
echo "Query saved, "; // prints
$res = sqlStatement($query);
echo "res assigned, "; // doesn’t reach this line
$patient = sqlFetchArray($res);
echo “patient set\n”;
I’ve tested the query in phyMyAdmin; it finds one match. Something goes wrong on the “$res = sqlStatement($query);” line and it doesn’t echo the next line.
I moved the parser to the library directory, so it no longer dies on the sqlStatement call. Now I’ve run into another problem, when it’s supposed to be fetching an array it returns nothing.
…
Healthcard #: 123456789
Query saved, res assigned (Resource id #38), row set
Row:
Row doesn’t exist
The SQL query returns pid = 2 in phpMyAdmin. Apparently that corresponds to Resouce id #38 (I am not familiar with how resource id works). When it tries to fetch that array it returns nothing.