Skip to content

Instantly share code, notes, and snippets.

View nribeka's full-sized avatar

Nyoman Ribeka nribeka

  • OpenMRS
  • Indianapolis
View GitHub Profile
@nribeka
nribeka / pbcopyfy
Created March 26, 2019 12:41 — forked from garywoodfine/pbcopyfy
Simple Script to configure pbcopy like functionality on ubuntu
#!/bin/sh
# Copyright (C) 2009-2017 Three Nine Consulting
# Always good practice to update packages. However ask user if they would like to do so
# For explanation on how this works and why check out https://garywoodfine.com/use-pbcopy-on-ubuntu/
read -p "Do you want to update your package repositories before proceeding ? " -n 1 -r
echo #adding new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt update
sudo apt upgrade -y
@nribeka
nribeka / DataDownloader.java
Created July 2, 2013 20:16
Downloading the cohort data ...
public class DataDownloader {
public void donwloadStaticCohort() throws Exception {
Context context = ContextFactory.createContext();
context.openSession();
if (!context.isAuthenticated())
context.authenticate("admin", "test", "http://localhost:8081/openmrs-standalone");
int patientCounter = 0;
int cohortMemberCounter = 0;
@nribeka
nribeka / Schedule.sql
Created March 24, 2013 16:53
MOH Scheduler
INSERT INTO `amrsreports_queued_report` VALUES (60,'MOH 361A',2,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (61,'MOH 361A',3,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (62,'MOH 361A',4,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (63,'MOH 361A',5,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (64,'MOH 361A',6,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (65,'MOH 361A',7,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (66,'MOH 361A',8,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (67,'MOH 361A',9,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (68,'MOH 361A',10,NOW(),NOW(),'NEW',UUID());
INSERT INTO `amrsreports_queued_report` VALUES (69,'MOH 361A',11,NOW(),NOW(),'NEW',UUID());
@nribeka
nribeka / Moh361ACohortDefinitionEvaluator.java
Created March 21, 2013 20:19
Adding person attribute history :)
List<Location> locationList = (List<Location>) context.getParameterValue("locationList");
for (Location location : locationList) {
String personAttributeQuery =
"union " +
"select person_id" +
" from person_attribute" +
" where (voided = 0 and person_attribute_type_id = 7 and value = " + location.getLocationId() + ")" +
" or (voided = 1 and person_attribute_type_id = 7 and void_reason = 'New value: " + location.getLocationId() + "')";
sql = sql + personAttributeQuery;
}
@nribeka
nribeka / value.json
Created February 19, 2013 17:27
The default values for the form :)
var values =
{
"value": {
"patient": {
"givenName": "Testarius",
"middleName": "Paul",
"familyName": "Kungu",
"birth": "1992-Oct-15",
"birthEstimated": true,
"gender": "Male"
@nribeka
nribeka / display.json
Created February 19, 2013 17:22
This is the display part :)
var display =
{
"form": [
{
"type": "fieldset",
"title": "Patient Demographic",
"items": [
"patient.givenName",
"patient.familyName", "patient.birth", "patient.birthEstimated",
"patient.age",
@nribeka
nribeka / schema.json
Created February 19, 2013 17:19
Schema for the form :)
var schema =
{
"schema": {
"patient": {
"type": "object",
"title": "Patient Demographic",
"properties": {
"birth": {
"type": "string",
"title": "Birth",
<!DOCTYPE html>
<!--
Copyright 2012 Muzima Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@nribeka
nribeka / HttpProcessor.java
Created January 28, 2013 19:31
Processor part for the ODK Connector module!
/**
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
@nribeka
nribeka / CompositionCohort.java
Created November 12, 2012 20:15
Composition Cohort Definition
CompositionCohortDefinition compositionCohortDefinition = new CompositionCohortDefinition();
compositionCohortDefinition.addSearch("firstCohortDefinition", firstCohortDefinition, null);
compositionCohortDefinition.addSearch("secondCohortDefinition", secondCohortDefinition, null);
compositionCohortDefinition.setCompositionString("firstCohortDefinition AND secondCohortDefinition");