Import Patient data from csv file - Recommended Criteria

I have a relatively easy question, I suppose I’m supposed to be knowing this but I don’t :smile:

I have a CSV file with Patient data, however, these Patients have some added Person attributes. The header(columns) looks like:

‘GivenName’, ‘MiddleName’, ‘FamilyName’, ‘District’, ‘County’, ‘sub_county’, ‘Parish’, ‘village’, ‘Birthdate’, ‘Gender’, ‘Telephone Number’, ‘Treatment Supporter Telephone Number’, ‘First Encounter Date’, ‘ART Start Date’

Do we have a module or tool available for importing Patient data from such a file on the fly?

cc: @ssmusoke, @dkayiwa, @mksd

2 Likes

it’s easier writing one yourself since your dataset schema is specific to yourself. Try picking it up from https://wiki.openmrs.org/display/docs/Data+Import+Tool+Module or someother openmrs wiki resource

1 Like

If you have workbench installed, you can right click on the patient table to open a table import wizard. There you can select the table columns corresponding to the columns in csv to be imported.

I’ve used used this feature in some other project.

Hope it helps :grinning:

2 Likes

I did some improvements on the Spreadsheet Import module a while back. Here it is, let me know if you are interested because I will have to give you more instructions.

1 Like

@k.joseph do you mean creating another data import tool from scratch ??

writing any simple script that interprets your csv schema and loads for you the data into your database

I’m doing data import from CSV for PIH Mexico. I’m using Initializer, for which I have some outstanding pull requests which allow it to import patients, encounters, and observations. I will also be implementing support for program enrollment soon.

I’m doing some old-fashioned data wrangling in R to transform the old CSVs to fit the format expected by Initializer.

The formats expected by Initializer (or “Iniz” as we affectionately call it) are likely to change between now and when they get merged, but if this is just a one-time import task, you could tie your work to a particular commit, as these data importers are already working.

To use Iniz, you’ll need to check it out and watch it, including it in your POM as a snapshot version. It’s not yet in the OpenMRS Maven repository. And anyway you’ll want this working version, assuming you’re wanting to implement this within the next month or so.

3 Likes

Thanks to all given solutions but my usecase was urgent so I made one myself. Thanks @k.joseph for the advice

1 Like

feel free to share your script and csv template.

@willa do you plan to merge your changes with the main repository? :slight_smile:

Do you think I should merge those? I can surely submit the PR.

Oh yes! They are valuable changes. :smile:

I came to realize these changes were very specific to the use case I was catering to at the time. Given the use case can be a recurring issue but what I did deviated from the main module promise. I have yet to summarize all the changes I did but before I can even submit the PR, I think I should at least articulate those changes and see if they make sense to everyone interested in this module.

In your commits i saw generic improvements like supporting platform 2.x