Use or import 3rd party form

Hi, using v5.0.1

I need to import patient data, captured in a form, from an external source. I want to use as much native openemr functionality as possible, so I’m looking for suggestions as to good ways to do this? Please ignore security type stuff, handled.

I’ve done a fair amount of searching, not coming up with anything I feel sure of - e.g. editing interface/usergroup/user_admin.php …

openEMR has many ready-made forms, so I was hoping I could find a simple way to:-

  1. either create a table (new form) in the database
  2. edit an existing form by changing field names and adding more fields

Then just insert a new row in that table, for each patient. There could be 0, 1 or 2 types of form per patient, only 1 instance of each.

BUT the form(s) data must be able to be viewed and edited by the clinician during the patient’s visit.

Recommendations please?

Not too clear about the nature of data but have you thought about extending patient layout from Admin -> Layouts -> Demographics? Adding new entry will create corresponding fields in patient_data table that you can initialize and then let users edit.
You can put these fields into new tab named after that external source. So users always can relate to where that data came from.

@mdsupport
Wow, that looks pretty awesome, but i’m not that technical so, a few questions …

Context first though: This small clinic only does thermal imaging. The forms that are completed elsewhere, contain relevant medical history data, such as current and past medications, maternal & lactation history etc. All relevant to the patient AND to the type of scan requested.

Lets say I simply create a new table in the emr dbase, call it breast_form, linked to a patient id.
Then I save the form data - one for each patient - in the table rows - this would be my preferred approach.

Now let me use (& rename) the ‘Misc’ group for the breast_form data. It looks simple enough to customise & add fields etc.
What I can’t see, is how to link a field in the group (say usertext1) to the relevant field in that patient’s breast_form in the dbase (say breast_form.current-medications) ?

I assume there is a piece of code that I could edit, be great if you could locate that for me? Plus any advice on what to lookout for - theres always a catch :slight_smile:

Based on your explanation, you need to use the procedure orders and encounters. You do not need any coding or tables.

When clinic gets the referral, you can populate patient data in demographics or take a shortcut and setup basic demographics and save the scanned / electronic referral details in documents. ICDs provided in referral should be issues for the patient. Also record appointments with reason.

When patient actually shows up, create encounter and enter a procedure order. Be sure to configure the tests you perform so staff gets a menu of tests and related observations they should record.

When test results are available, they can enter related observations or just save in a linked document.

Only time consuming part is configuring the menu of tests and related observation values as list of options or free text. Imagine “Breast Scan” like lab test for blood with measurements of different categories, their ranges, normal values and additional notes.

Use coding funds to make the output more professional and hopefully contribute to the project.

I’ve not explained it well enough, the forms are captured electronically by a separate system, and are automatically sent to emr through SSH. For security that system is in the public domain, and emr will be behind a VPN. So I’m looking for the best way to automatically populate the database with this transferred electronic data.

I really like using the Misc group for this, from a usability perspective, and have no problem with getting a php developer to write/adapt code to interface with the public system and store the data.

I’d just like to know where the code lives so we can learn from it, or even use it.

Hope that makes better sense…

Ah. It kind of simplifies some things. Lot depends on the the type of data in the forms - as hl7, pdf, xml etc. Mapping external data to emr is the next brave new world of FHIR. @sjpadgett brought in infrastructure and may provide more guidelines. You probably are going to be better off if you use encounter rather than patient demographics layout to reflect events in physical world. All your developer will need to do is show latest set of forms in patient summary.

Essentially data is passed through a method of the source system at the moment, so array of php variables that we would expect to use json/ajax to add as a new row in the database. But if there are “emr best practice” ways of doing that, please let me know?

I’m no health expert and really appreciate your input, but this data is mostly patient history prior to the appointment, so it seems more demographic in nature. Also repeat visits would still need to easily view that data. Most importantly, the site owner likes the idea of using the demographics groups :slight_smile:

So we know how to get the data stored in the database, so what I am hoping someone knows - to save us time & hassle - is where can we find the code that populates the demographic groups for a patient being viewed? (i.e. the code that reads the demographic group data from the database, and displays it on the user screen for a patient.)

Thanks

You are in luck there. When you add fields, it creates a column in patient_data table. If you are sure about your approach, use the source column name as layout item id. Then a single loop will fill all data.

Best luck.

Thanks @mdsupport
I think I foolishly got over excited, I tried renaming a couple of fields while editing the groups layout in emr. I wanted to use occupation and ethnicity in my new form, so I renamed them in Employer and Stats groups. This has created a problem which I’m not sure how to fix - emr admin won’t allow me to name them back to what they were - gives a ‘duplicate field id’ error when I save.

The problem is I can’t access old patients and when I create a new patient, I also can’t access that - keeps bringing up an ‘unknown’ tab.

I figured to get some advice on this before I make it worse - I’m tempted to use phpmyadmin to revert the patient_data table, but I’m too much a newbie with openemr.

Help?

Unfortunately that form does not stop you from changing column names in the standard table. Resetting the changes with sql is ok as long as you did not drop a column. Otherwise use backup to selective restore the data in affected columns.

Thanks, I will restore the whole account to be on the safe side.

So just to be clear, I shouldn’t change any existing names in those groups, only add new names? I assume I must use alternate field names like occupation1 in the group I want to use, and mark occupation as unused in the group I’m not using…

Maybe changing col names, and maybe also deleting cols, should be a feature request?

For user defined layouts all operations work without issues since the code underneath uses column name as a generic field. For system layouts such as demographics, there is code behind most of the fields - e.g. how will your feature request that asks for deletion of patient dob field and still not affect patient age calculation? If you do not want use of a field, just mark it unused and it is effectively deleted for users but not for code.

Groups, on other hand, probably have no code. As long as fields within a group are dispersed elsewhere you should be ok.

Good point, understood, thanks.

Just to make sure we’re talking about the same thing, I am looking at the various groups under demographics. From your comments, I think the best approach would be to hide the groups I dont want (such as Choices, Guardian), and use ‘Add Group’ to match precisely to the incoming form data (with unique ids & keys off course).

  1. Do you see any issues with that approach?
  2. How do I hide those unwanted groups when viewing a patient? (I though I had managed that when I was experimenting earlier - change name and select ‘none’ from the drop-down - but that doesn’t seem to work now?
  3. I looked for this in the manual - I must be missing something, can’t find it - perhaps you could link me to the appropraite documentation?

Really appreciate your input here @mdsupport , I am very keen to use existing functionality to avoid customizing.

I think there is no function to hide the group. Best case, if all fields in a group are unused then the engine may suppress that group effectively hiding it. Worst case, since you are going to need groups, disable all unwanted fields where they are and add your custom fields and rename the groups.

Over period that feature has been overworked so there probably is no comprehensive documentation. But as long as you don’t delete system fields, you can play with it without any harm.

Gotcha, thanks. Much appreciated, I’ll get on with it now :slight_smile:

Perhaps the feature request I was scratching for, should be to allow fields to be moved between groups - so that the database table is not changed (at the same time perhaps, add checks to disallow changing names or deleting fields)?