Bahmni Test Data Generator
User Configuration Inputs
- Patient Count(PATIENT_COUNT) - Number of patients for new registration with Bahmni
- Create Encounters(S_CREATE_ENCOUNTER) - y/n - Flag to create encounters for the patients registered above
- Encounter Count(ENCOUNTER_COUNT) - Number of patients that needs an encounter
- Upload Data(S_UPLOAD_CSV) - y/n - Flag to upload the created csv files to Bahmni
config.yaml
Glossary
- PATIENT_PROFILE_FILE_NAME - path of the registrations.csv file where the new patient details are available
- ENCOUNTER_PROFILE_FILE_NAME - path of the encounters.csv file where the encounters (previous visit related information of the patients) are available
- REGISTRATION_INDEX_START_POINT - last four ending digits of the unique ID created for the patient
- PATIENT_REGISTRATION_START_DAY - reference date to create a random registration date
- BASEURL - Bahmni URL to upload the created csv files
- USERNAME - admin user
- PASSWORD - admin password
- LOCATION - login location of the admin user
- REG_INITIAL - first four letters of the patient ID
- PATIENT_COUNT - default patients count, value: 10
- S_CREATE_ENCOUNTER - defaulted to y(yes) to create encounters for the above patients
- ENCOUNTER_COUNT - default encounters count for each patient, value: 10
- S_UPLOAD_CSV - defaulted to y(yes) to upload the created csv files to Bahmni database
CSV GeneratorCSV Generator takes user configuration inputs to create the patients(registration.csv), encounters(encounters.csv)and upload them to Bahmni, when the user configuration is not provided, default values are sent to CSV generator from config.yaml
To achieve the creation of real time test data about patients, CSV generator uses Faker service to generate name, address etc.
Once the test data gets created internally, they are stored in output folder successfully as registration.csv and encounters.csv(optional)
CSV Files Snapshot
registration.csv
"Registration Number","Registration Date","First Name","Middle Name","Last Name","Gender","Birth Date","Address.Village","Address.Tehsil","Address.District","Address.State"
"GAN1019","2021-07-13","Brahmabrata","Agarwal","Mehra","M","1935-09-04","Hyderabad","Apt. 680","Hyderabad","Manipur"
"GAN1020","2017-04-04","Sarisha","Nehru","Dubashi","F","1950-07-10","Mumbai","Apt. 807","Mumbai","Rajasthan"encounters.csv
CSV File Upload
- OpenMRS and BahmniCore APIs are used to upload both the registration and encounters csv files
- Successful upload of the CSV files to the Bahmni database is possible only when the correct cookies have been created
- To achieve the cookies setup before the upload, various different API services are called and the required cookie information is obtained and stored in the cookie store.
Note: cookie store - an object created to store and retrieve cookies in run time.
Order of Execution
Get Location Service
/openmrs/ws/rest/v1/location
Provides location and location uuid to the cookie store.
Get User Service
/openmrs/ws/rest/v1/user
Takes ‘user’ and ‘password’ from config.yaml and provides JSESSION ID of the user to the cookie store.
Get Session Service
/openmrs/ws/rest/v1/session
Uses the current cookies from CookieStore and provides Reporting Session ID to the cookies store.
Upload Patient Service
/openmrs/ws/rest/v1/bahmnicore/admin/upload/patient
Uses the current cookies from CookieStore and uploads the registration.csv file using multipart upload method.
Get Upload Status Service
/openmrs/ws/rest/v1/bahmnicore/admin/upload/status
This service helps us to validate the csv file upload has been completed successfully. Only when the status is retrieved as “Completed” the upload encounter service will be called further.
Upload Encounter Service
/openmrs/ws/rest/v1/bahmnicore/admin/upload/encounter
Uses the current cookies from CookieStore and uploads the encounters.csv file using multipart upload method.
Get Upload Status Service
/openmrs/ws/rest/v1/bahmnicore/admin/upload/status
This service helps us to validate the csv file upload has been completed successfully. Only when the status is retrieved as “Completed”, the build will be assigned successful.
Bahmni Wiki · CC BY-SA 4.0
