Error uploading encounter csv file

I’m trying to import encounters using the csv upload feature from the admin app but the import is failing with this error.

I’m using Bahmni version 0.87 and the error file can be downloaded from here

Thanks for any help, -Bailly

Hi @rubailly, If you look at the Encounter sample csv in Bahmni WIKI, Registration Number is supposed to be Patient Identifier. But in the file that you are trying to import it has uuid. Please correct it and try it. Patient Identifier/Patient ID ex: GAN00102

Here is the link to the new error file after changing the Patient Identifier. It looks like the problem isn’t the Patient Identifier as it normally throws the “No matching patients found with ID” error when it can’t find the patient. In this case, the patient is being found but I can’t figure out where the null pointer exception in the log file is coming from.

Hi @rubailly,

Please follow steps to setup Visit Location Mapping in Bahmni WIKI to fix this issue. In short, from Bahmni Release-0.83 Visit, Location mapping is mandatory. As you don’t have this mapping right now, the visits are not identified. If you see the exception that you have pasted Visit Identifier is returning null.

But that assumes you already have a visit/visits in the database that you’d like the encounter(s) to be attached to. What if you wanted the visit(s) to be created from the import? From this explanation on the Wiki, it says that “If visit dates are not provided the encounter date would be used to create a visit for just one day”.

In my case, there are no visits in the database, so there is no visit to map to a location. I wanted the visit to be created from the encounter import.

I also tried the import by creating one visit in the database for the patient so that it get’s a location_id mapped to it as you suggested but the import is still failing with a null pointer exception (…here is the error file) -But I agree the issue has something to do with visits configuration.

To retrieve existing visits, visitLocationUuid will be retrieved first using loginLocationUuid. But as there is no mapping that step itself is failed even before creating new visits. Please look at the code where the exception is raised.

Is the issue resolved?

No. That line in the code is actually where the problem is. I didn’t try debugging but if you pass in a hard coded visit location like String visitLocationUuid = bahmniVisitLocationService.getVisitLocationUuid("c5854fd7-3f12-11e4-adec-0800271c1b75");

it will still fail with the same exception. But if you comment out that line and use the hard coded visit location uuid (…the method will look like this), the encounter and visit will be created without any problem.

One problem I found was that the “bahmniVisitLocationService” instance couldn’t be created as the import of “BahmniVisitLocationService” was failing due to a wrong package name.

Do we need to have a ticket raised for this? …I made the fix and created a pull request here.

2 Likes

Did you tr setting up Visit Location mapping? Can you try and let me know if you still see the issue.

One of team member will look at the pull request and merge. Thank you for the pull request.

Yes, I did try setting up the Visit Location mapping but it didn’t work! I’m still getting the null pointer exception. And if you check this documentation on the wiki, visits are not mandatory when importing encounters, they can be automatically created.

I am facing the same issue as well. Is there any solution or work around for this ?

Hi All, We have identified this as an issue in the product. Thank you for sharing your inputs and investigations, a fix will be scheduled and released for the same.

@vmalini: Can you please provide the Mingle Defect Card Link, so that people can track when its fixed.

1 Like

Please find the defect card with details on https://bahmni.mingle.thoughtworks.com/projects/bahmni_emr/cards/3278

1 Like