Location (Multiple levels if necessary)
SubjectName
ProgramName (If present)
ProgramEncounterName (If present)
ConceptName (Multiple concepts can be chosen. Also, a concept can have multiple images)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Ticket 2492 | |
-- So there is an encounter called annual visit base line, where there is a question called "Going to school" with answers as 'Yes' or 'Dropped out' | |
-- Earlier we didn't schedule any visits for students who were selected dropped out, but now they came back saying they want to schedule annual visit endline even when the adolescent has selected dropped out as answer | |
set role adsr; | |
select * from concept where uuid = '9705f6ad-50e1-4179-aa60-922014d7cc3c'; -- Going to school | |
select * from concept where uuid = 'fb1080b4-d1ec-4c87-a10d-3838ba9abc5b'; -- Dropped out | |
select * from encounter_type where id = 1343; -- Annual Visit - Baseline | |
select * from encounter_type where id = 1349; -- Annual Visit - Endline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The objective of this session is to look at performance, | |
reset role; | |
select * from individual where observations->>'24dabc3a-6562-4521-bd42-5fff11ea5c46' = '294'; | |
set role ihmp; | |
select * from individual where observations->>'24dabc3a-6562-4521-bd42-5fff11ea5c46' = '294';-- column does not exist | |
-- Pitfall. Use the schema name everywhere (For avni-server, you don't have to do this for public schemas because of application.properties) | |
select * from public.individual where observations->>'24dabc3a-6562-4521-bd42-5fff11ea5c46' = '294';-- column does not exist | |
reset role; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Improving /getSyncDetails | |
-- Current scenario - POST /getSyncDetails call is responsible for about 15% of our workload in our server. Average response times are at 4.17 seconds with 95% at 9.75 seconds. Throughput can go upto 10-15 rpm during peak (which is pretty bad given the response times). | |
-- We have already stopped checking values for programEnrolment, programEncounter and encounter to make response times better. This is resulting in extra calls to these endpoints. | |
-- One way to handle this can be to have a view that provides the latest update date time for each kind of entity to be synced. We should expect about 100,000 rows in this new table for all organisations together. Retrieving data will be a small number of queries, and will be fast because of indexing (not done in this gist). | |
-- This sql provides a POC of such a solution that might work | |
reset role; | |
drop table if exists sync_statistics; | |
create table sync_statistics as |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This script lets you follow the first session of the Avni Sessions series. It is accompanied by the presentation at https://docs.google.com/presentation/d/1j6CH9xsBJ2QKt4B3JhJeklBrL5Ju1dPNYjsMVufZ1yk/edit?usp=sharing | |
------------------------------------ | |
-- MULTITENANCY IN AVNI - START | |
------------------------------------ | |
-- Multitenancy. We use Postgres Row-level multitenancy (https://www.postgresql.org/docs/current/ddl-rowsecurity.html) to prevent organisations from using each other's data. In Avni, we have a multi-level inheritance style structure that is enabled through a hierarchy of organisations. This hierarchy has two mechanisms. | |
-- Multitenancy mechanism 1 - Extending an organisation. We have parent and child organisations that share metadata (not data). Lets see this with an example - Calcutta Kids | |
set role calcutta_kids; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su | |
vi /etc/systemd/system/multi-user.target.wants/openmrs.service | |
# Change user and group from bahmni to root | |
systemctl daemon-reload | |
# Unlink /var/run so that systemctl runs | |
unlink /var/run/openmrs | |
# By now, we should be able to run openmrs using systemctl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### This gist provides the details of fixing bahmni-reports once you have installed Bahmni. | |
The reports database requires a bunch of tables required by the scheduler. Even if you don't run the scheduler, the database is required for bahmni-reports to run. | |
### Symptoms | |
Go to reports, and click on a report. It take a lot of time, and ends up throwing an exception | |
Missing database exception on /var/log/bahmni-reports | |
### Solution | |
Create the database and the required tables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ensure counseling questions show up inline wherever possible. | |
Ensure all counseling uses the "Placeholder for counselling form element" concept | |
For program encounters, check if the questions need to be asked every time. If not, add a rule to ask just once. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018-05-30 16:55:26.602 INFO 37343 --- [nio-8021-exec-6] o.o.f.security.AuthenticationFilter : Processing GET /userInfo?catchmentId=1 User: null, Organisation: Ashwini | |
2018-05-30 16:55:26.607 INFO 37343 --- [nio-8021-exec-6] o.o.f.security.AuthenticationFilter : Processed GET /userInfo?catchmentId=1 User: null, Organisation: Ashwini | |
2018-05-30 16:55:26.685 INFO 37343 --- [nio-8021-exec-7] o.o.f.security.AuthenticationFilter : Processing POST /individuals?null User: null, Organisation: Ashwini | |
2018-05-30 16:55:26.706 INFO 37343 --- [nio-8021-exec-7] org.openchs.web.IndividualController : Saving individual with UUID a1769544-4e7f-4ff7-9d26-9a3f9b4c7b3a | |
2018-05-30 16:55:26.826 INFO 37343 --- [nio-8021-exec-7] org.openchs.web.IndividualController : Saved individual with UUID a1769544-4e7f-4ff7-9d26-9a3f9b4c7b3a | |
2018-05-30 16:55:26.840 INFO 37343 --- [nio-8021-exec-7] o.o.f.security.AuthenticationFilter : Processed POST /individuals?null User: null, Organisation: Ashwini | |
2018-05-3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
service bahmni-lab stop | |
service openmrs stop | |
psql -Upostgres -c "drop database clinlims;" | |
cd /opt/bahmni-lab/migrations && scripts/initDB.sh bahmni-base.dump | |
cd /opt/bahmni-lab/migrations/liquibase/ && /opt/bahmni-lab/migrations/scripts/migrateDb.sh | |
service bahmni-lab start |