Skip to content

Instantly share code, notes, and snippets.

View djazayeri's full-sized avatar

Darius Jazayeri djazayeri

View GitHub Profile
WARN - WebModuleUtil.startModule(286) |2014-11-24 13:29:31,888| Unable to refresh the WebApplicationContext for module: referenceapplication
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0' defined in URL [jar:file:/tmp/tomcat7-tomcat7-tmp/1416850176698.openmrs-lib-cache/allergyui/allergyui.jar!/webModuleApplicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'HL7MessageController1_8': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceController org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.HL7MessageController1_8.mainResourceController; nested exception is org.springframework.beans.factory.NoSuchBeanD
assertThat(updated.getNames(), containsInAnyOrder(
allOf(
hasProperty("name", is("History of present illness")),
hasProperty("locale", is(Locale.ENGLISH)),
hasProperty("localePreferred", is(true)),
hasProperty("conceptNameType", is(ConceptNameType.FULLY_SPECIFIED))),
allOf(
hasProperty("name", is("HPI")),
hasProperty("locale", is(Locale.ENGLISH)),
hasProperty("localePreferred", is(false)),
@djazayeri
djazayeri / gist:d3dc89988486fe6f988d
Created March 17, 2015 23:43
Example of using OpenMRS REST to create a patient and an encounter (in OpenMRS 2.1)
// go to http://demo.openmrs.org, log in as admin/Admin123, open the JavaScript console, and do the following:
var URL_BASE = "http://demo.openmrs.org/openmrs/ws/rest/v1/";
var resources = {};
function andLog(data) { console.log(data); }
function andSaveAs(variable) { return function(data) { resources[variable] = data; console.log(variable + " => " + JSON.stringify(data)); } }
function andSaveFirstResultAs(variable) { return function(data) { data = data.results[0]; resources[variable] = data; console.log(variable + " => " + JSON.stringify(data)); } }
function random() { return Math.floor(Math.random() * 10000); }
function post(resource, data, success) {
$.ajax({ type: "POST", url: URL_BASE + resource, contentType: "application/json", data: JSON.stringify(data), success: success });
@djazayeri
djazayeri / gist:690a5b36845993af8993
Created May 12, 2015 23:23
OrderEntryConfigResource1_10
@Resource(name = RestConstants.VERSION_1 + "/orderentryconfig", supportedClass = Object.class, supportedOpenmrsVersions = {"1.10.*", "1.11.*"})
public class OrderEntryConfigResource1_10 implements Listable {
@Override
public SimpleObject getAll(RequestContext context) throws ResponseException {
OrderService orderService = Context.getOrderService();
SimpleObject ret = new SimpleObject();
// try/catch each of these to avoid failing in the case where one of these is not configured
try {
@djazayeri
djazayeri / ad-hoc-cohort-query.js
Created December 16, 2015 14:53
Ad hoc reportingrest cohort query
var startAndEndDateParameters = "<parameters>" +
" <org.openmrs.module.reporting.evaluation.parameter.Parameter>\n" +
" <name>startDate</name>\n" +
" <label></label>\n" +
" <type>java.util.Date</type>\n" +
" <required>true</required>\n" +
" </org.openmrs.module.reporting.evaluation.parameter.Parameter>\n" +
" <org.openmrs.module.reporting.evaluation.parameter.Parameter>\n" +
" <name>endDate</name>\n" +
" <label></label>\n" +
{
"id": "54f912cd-1f58-4379-a92c-4fcc0aa1e894",
"patients": "",
"observations": "",
"encounters": "",
"atlasVersion": "2.1",
"data": {
"version": "2.3",
"modules": [
{
<bean class="org.openmrs.ui.framework.StandardModuleUiConfiguration">
<property name="moduleId" value="${project.parent.artifactId}"/>
<property name="forOpenmrsVersion">1.*</property>
<property name="developmentResourceFolders">
<list>
<value>web-1.9</value>
<value>omod</value>
</list>
</property>
</bean>
{"error":{"message":"Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection","code":"org.springframework.orm.hibernate3.HibernateTransactionManager:597","detail":"org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection\n\tat org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:597)\n\tat org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)\n\tat org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)\n\tat org.openmrs.module.atomfeed.transaction.support.AtomFeedSpringTransactionManager.executeWithTransaction(AtomFeedSpringTransactionManager.java:37)\n\tat org.openmrs.module.atomfeed.advice.PatientAdvice.after
-- these three lines are in my osx shell
vagrant init bento/centos-6.7
vagrant up
vagrant ssh
-- from here it's in the centos vm
sudo su
yum install https://bahmni-repo.twhosted.com/rpm/bahmni/bahmni-installer-0.80-139.noarch.rpm
yum install unzip
wget https://bahmni-repo.twhosted.com/endtb/release-1.0/mysql_dump.sql
@djazayeri
djazayeri / a few lines up this also printed out in red
Created March 18, 2016 17:39
failure for endtb 1.0 with newer db dump
TASK: [bahmni-web | Check if bahmni-web rpm needs an update] ******************
<localhost> REMOTE_MODULE command yum list installed bahmni-web
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458322206.16-84569702859029 && echo $HOME/.ansible/tmp/ansible-tmp-1458322206.16-84569702859029']
<localhost> PUT /tmp/tmpv5eMMc TO /root/.ansible/tmp/ansible-tmp-1458322206.16-84569702859029/command
<localhost> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=ctcjhexfztakavtkimdxfycvgssgyovq] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-ctcjhexfztakavtkimdxfycvgssgyovq; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1458322206.16-84569702859029/command; rm -rf /root/.ansible/tmp/ansible-tmp-1458322206.16-84569702859029/ >/dev/null 2>&1'"'"''
failed: [localhost] => {"changed": true, "cmd": ["yum", "list", "installed", "bahmni-web"], "delta": "0:00:02.111244", "end": "2016-03-18 23:00:08.458928", "rc": 1, "start": "2016-03-18 2