How to start with a fresh / clean database for Bahmni?

@gsluthra and @vsingh, I guess my first question is whether this page actually is the preferred way for installing Bahmni, and how it relates to the bahmni-installer RPM package, which I don’t see referenced anywhere.

We have been using the bahmni-installer RPM as an alternative approach to running the script referenced on that page. And this bahmni-installer RPM has similar, but not exactly the same, behaviors. So that I think is confusing this topic a bit, since there are various moving pieces.

Are we taking the wrong approach by using the bahmni-installer? Sorry if this doesn’t directly answer your question, but I feel like this is an important clarifying point to address.

Thanks, Mike

@cioan reminided me that we took this approach of using the Bahmni installer based on this wiki page: https://bahmni.atlassian.net/wiki/display/BAH/Install+Bahmni+on+Centos+using+Ansible

And, this page clearly says that this is in progress, and to use the other page we are discussing above, so I guess that answers my question :slight_smile:

As a group that is working on our own automated deployment scripts that include Bahmni, we took this approach with the hope of not having to rewrite everything to use the bahmni-installer a few months down the line. Would still be interested in your thoughts on this decision and whether you are still headed in this direction.

Mike

Gurpreet will have more details. The way forward is rpm based installers for Bahmni, in next release i.e. 0.81 we will completely move to it. We had only OpenMRS part of installation working hence we had kept the old way of installation. In next release all parts would have been migrated to run this way.

Clearly we need to get better are communicating these.

Hello guys, Trying to get a fresh db but i am unable to connect to openERP db…

username and password not validated

@puneet1984 Please refer to this document on connecting to databases: https://bahmni.atlassian.net/wiki/display/BAH/Connecting+to+various+databases

Hi Vsingh, I’m trying to clean all patient data of my Bahmni installation, and this is what I have now:

I couldn’t run the deletePatientData.rb because I couldn’t install pg gem. It was an ruby version isue, I tryed to upgrade ruby but now it can’t find the path to ruby (I’m not too good about ruby :blush:)

Then I went for executing the sql scripts and the deletePatientDataForOpenMRS.sql worked like a charm! All my patients are gone.

But when executing the deletePatientDataForOpenElis.sql it didn’t work. It finished with the following errors messages:

Output from uploaded SQL commands …

psql:/tmp/.webmin/664285_425_1_exec_file.cgi:31: ERROR: relation “result_signature” does not exist psql:/tmp/.webmin/664285_425_1_exec_file.cgi:33: ERROR: relation “person” does not exist LINE 1: delete from person where not exists (select p.person_id from… ^ psql:/tmp/.webmin/664285_425_1_exec_file.cgi:35: ERROR: relation “event_records_offset_marker” does not exist

Can you help me with some instructions on how to solve this?

Regards,

German

Hi German Acevedo,

According to the output you pasted, looks like you don’t have proper OpenElis database. How did you install Bahmni ? Is OpenElis up and running in your system ? Can you check if table “result_signature” and “person” exists in your database.

Thanks, Sravanthi

Here is a link explaining how to connect to OpenELIS database. Maybe the script is connecting with a user that doesn’t have rights to see the tables. Please check.

https://bahmni.atlassian.net/wiki/display/BAH/Connecting+to+various+databases

Hi Sravanthi, I installed Bahmni following the instructions on https://bahmni.atlassian.net/wiki/display/BAH/Install+Bahmni+on+CentOS The install ended without any errors, and OpenElis, Bahmni, OpenMRS and OpenERP are all working fine. In my server I have webmin as control panel, and I log into it as root. This are screenshots of what I see about the requested tables:

As Gurpreet already mentioned, Can you please try using “clinlims” user.

german2209, just to clarify you are passing the .sql script to postgres, correct? openElis uses postgres, not mysql.

btw, which ruby version does the “deletePatientData.rb” script require? I tried with ruby 1.8.7 on CentOS 6 but it doesn’t work (sintax error).

Hi Sravanthi, I tryed again with user clinlims, this time through phpPgAdmin, but again it didn’t worked, this is the result after running the deletePatientDataForOpenElis.sql:

Error de SQL:

ERROR: syntax error at or near “table” LINE 1: SELECT COUNT(*) AS total FROM (truncate table result_signatu… ^

En la declaración:

SELECT COUNT(*) AS total FROM (truncate table result_signature, referral_result, referral, result_inventory, result, worksheet_analyte, note, report_external_export, report_external_import, analysis_qaevent, analysis_storages, analysis_users, analysis, sample_qaevent, sample_requester, sample_human, sample_newborn, sample_animal, sample_environmental, sample_item, sample_organization, sample_projects, sample, observation_history, patient, patient_identity, patient_occupation, person_address, patient_patient_type, patient_relations, organization_contact;

delete from person where not exists (select p.person_id from provider p where p.person_id = person.id);

truncate table event_records_offset_marker) AS sub

Hi Nostalgicamigo, yes I’m using phpPgAdmin to run the script.

Hi German Acevedo,

Can you try the below command from command prompt to delete the data from OpenElis. It worked for me.

psql -Uclinlims clinlims < deletePatientDataForOpenElis.sql

Make sure you have the deletePatientDataForOpenElis.sql file in the folder where you are executing the command.

Hello I am able to clear openMRS and openERP data … but i am unable to reset the registration counter… Please suggest what to do…need to fix it urgently

To reset the Patient ID counter, please refer to this document: https://bahmni.atlassian.net/wiki/display/BAH/Patient+Identifier

Guys, there’s a BIG issue that starts to happen when the script to remove the demo data is used: the results of an Order (input through OpenELIS) are not view-able anymore on the patient dashboard in Bahmni. The orders are there, but not the results values, even though they’re validated in OpenELIS.

Does it happen to you guys too? Try to make an Order for any patient, go to OpenELIS, collect, give results & validate it, and then see if those results show in the patient dashboard.

(I opened a discussion here: https://talk.openmrs.org/t/results-of-openelis-test-in-bahmni )

Reiterating on this topic… We have improved the fresh installation of bahmni. Also we are now providing a script to delete all the patient or transactional data that is packaged with the default instance of bahmni.

Need Metadata from Demo Instance but not Patient Data During installation if the implementation_name is not overridden, it will be set to “default”. Which means default_config of bahmni and default demo database will be installed. this database will be a replica of demo database. So to delete the patient data and other related data like observations, orders etc… One can use the script mentioned in the documentation following the instructions pointed in the same page. This will keep the meta data and delete all the transactional data. Please refer the instructions mentioned in our documentation

To start fresh with clean database (without patients and metadata aswell),

  1. During installation, override the value of implementation_name with value other than default. Lets say xyz (in /etc/bahmni_installer/setup.yml)

  2. Put the xyz_config in /etc/bahmni_installer/deployment_artifacts/ (xyz_config is the config folder (name should match the implementation_name in step 1) with the structure similar to https://github.com/Bahmni/default-config )

  3. Run the installation command. (bahmni -i {inventory_file} install) Refer documentation for installation

This will install bahmni with fresh databases without any patient or meta data. You have to manually choose to import or add the data from scratch.

We are in the process of making this better and easier. We will update the documentation soon… :slight_smile:

Does the openmrs_clean_dump.sql still need to be executed manually or is it part of the installation process? Thanks.

Installation will take care unless you have dump file that has to be used during the installation.