Skip to content

Instantly share code, notes, and snippets.

@mks-d
mks-d / identifier_source.md
Last active Mar 10, 2021
identifier_source.csv
View identifier_source.md
Uuid Void/Retire Identifier type Name Description Prefix Suffix First identifier base Min length Max length Base character set _version:1 _order:6000
90563743-a6c8-4c23-8244-f50361f2a997 df255fa5-eb77-414d-89e5-5f068ba63a54 Location Prefixed Identifier Source Location Prefixed Identifier Source provider:idgen.locationBasedPrefixProvider 100000 6 0123456789ACDEFGHJKLMNPRTUVWXY
@mks-d
mks-d / EncounterDateTagTest.java
Created Nov 16, 2020
api-tests/src/test/java/org/openmrs/module/htmlformentry/EncounterDateTagTest.java
View EncounterDateTagTest.java
package org.openmrs.module.htmlformentry;
import static java.util.Calendar.MILLISECOND;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.TimeZone;
import org.junit.Assert;
@mks-d
mks-d / prp.latestServicePlan.widget.json
Created Oct 31, 2019
Sample PRP 'latest obs' Widget with (obs and obs group)
View prp.latestServicePlan.widget.json
{
"id": "prp.latestServicePlan.widget",
"instanceOf": "coreapps.template.dashboardWidget",
"order": 1,
"config": {
"widget": "latestobsforconceptlist",
"icon": "icon-user-md",
"label": "Sample PRP Widget",
"concepts": "0144f175-3231-4d12-8d97-ec8b4d348cab, e322170f-2417-45eb-86ab-5f8eb0170510"
},
@mks-d
mks-d / tech_tip_20190321.md
Last active Nov 17, 2019
Recursively search & replace with GNU sed on macOS
View tech_tip_20190321.md

While working on one of our Java projects on macOS it was required to do a search and replace in all Java files containing a string sequence. In our case it was required to change every JavaDoc "@since 2.3.0" into "@since 2.1.5, 2.3.0".

sed is the tool for this, and since BSD's implementation differs from GNU sed, we opted to stick to GNU sed which is available on Homebrew:

brew install gnu-sed

Then the magic combining find and sed:

find src/ -name '*.java' | xargs gsed -i -e "s/@since 2.3.0/@since 2.1.5, 2.3.0/g"
@mks-d
mks-d / tech_tip_20181213.md
Last active Dec 17, 2018
OpenMRS Initializer provides the 'locations' domain - Example use
View tech_tip_20181213.md

Strangely we could do for so long without a dedicated OpenMRS Initializer domain for locations. Until now we were simply bringing in locations metadata through OpenMRS MDS packages. MDS packages are always a convenient fallback mechanism when the desired OpenMRS Initializer domain is not (yet) available.

It was on our to do list for some time to finally address the case of locations. It is now done, please check the README about it here.

Let us look at a sample use on a Bahmni distribution of one of our clients that supports a small community health clinic in Haiti. Starting from an existing default Bahmni setup we want to end up with just two locations:

  • Clinic
  • Community

'Clinic' is the login location for providers at the clinic itself, whereas 'Community' is an ad-hoc location for providers performing community surveys while offline using Bahmni Connect. We had to deal with the

@mks-d
mks-d / tech_tip_20181201.md
Last active Dec 17, 2018
Unlocking a hanging Bahmni report marked as 'Processing'
View tech_tip_20181201.md

One of our Bahmni instances was not able to trigger any Bahmni Reports because - somehow - a report that could never be completed was stuck as 'Processing'. That piece of information could be seen in the 'Reports Queue' under 'My Reports':

Imgur

It was clear that this report was not really processing and that the information was lingering, yet blocking the scheduling of any new report with an error 500:

The server encountered an internal error that prevented it from fulfilling this request.

Restarting Bahmni Reports didn't do anything to it:

@mks-d
mks-d / head.html
Created Nov 11, 2018
Jenkins: Custom OCD3 login page (with Mekom colors)
View head.html
<style>
html {
font: Helvetica;
color: #3f3f40;
}
div .simple-page {
text-align: center;
}
View haiti_fr_diagnoses_corrected.md
Original Corrected
Syndrome d'Obrinsky/Prune belly Aplasie congénitale de la musculature abdominale (Syndrome d'Obrinsky)
Rosacee Acné rosacée
Déficience de le marche Difficulté à la marche, non classée ailleurs
@mks-d
mks-d / openmrs_fetch_icd10_diagnoses.sql
Last active Oct 29, 2018
MySQL query to fetch OpenMRS ICD-10 diagnoses for Haiti
View openmrs_fetch_icd10_diagnoses.sql
SELECT
data.uuid,
GROUP_CONCAT(DISTINCT data.name SEPARATOR '; ') AS name,
data.set_name,
GROUP_CONCAT(DISTINCT data.code SEPARATOR '; ') AS 'Mapping'
FROM
(
SELECT
c.uuid,
(
@mks-d
mks-d / bahrain_ah.csv
Last active Sep 8, 2018
Bahrain address hierarchy: 'Governorate', 'Place', 'Block'
View bahrain_ah.csv
Southern Aáli 746
Southern Aáli 748
Southern Al Door 965
Southern Algainah 961
Southern Al Hajyat 929
Southern Al Hajyat 931
Southern Al Hajyat 935
Southern Al Hajyat 939
Southern Al Hunaniya 901
Southern Al Hunaniya 903