Skip to content

Instantly share code, notes, and snippets.

View corneliouzbett's full-sized avatar
:octocat:
Compiling dreams and ideas...

Kipchumba Bett corneliouzbett

:octocat:
Compiling dreams and ideas...
View GitHub Profile
@corneliouzbett
corneliouzbett / Patient Matching module on platform version v2.4.0 error log.MD
Created April 12, 2021 09:08
Error log while installing patient matching module on openmrs platform version 2.4.0
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing
Offending resource: URL [jar:file:/root/.OpenMRS/amrs/.openmrs-lib-cache/patientmatching/patientmatching.jar!/moduleApplicationContext.xml]
Bean 'transactionManager'
	-> Property 'moduleService'
		-> Bean ''; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: 'bean' or 'parent' is required for <ref> element
Offending resource: URL [jar:file:/root/.OpenMRS/amrs/.openmrs-lib-cache/patientmatching/patientmatching.jar!/moduleApplicationContext.xml]
Property 'sessionFactory'
	-> Bean 'transactionManager'
		-> Property 'moduleService'
@corneliouzbett
corneliouzbett / ErrorUpdatingGroupResource.java
Created March 25, 2021 07:05
Implementation error updating group resource for openmrs platform version 2.1.* (since introduction of cohort membership)
ca.uhn.fhir.rest.server.exceptions.InternalErrorException: Failed to call access method: org.springframework.orm.hibernate4.HibernateSystemException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.openmrs.Cohort.memberships; nested exception is org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.openmrs.Cohort.memberships
at ca.uhn.fhir.rest.server.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:250)
at ca.uhn.fhir.rest.server.method.BaseOutcomeReturningMethodBinding.invokeServer(BaseOutcomeReturningMethodBinding.java:154)
at ca.uhn.fhir.rest.server.method.UpdateMethodBinding.invokeServer(UpdateMethodBinding.java:44)
at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:1052)
at ca.uhn.fhir.rest.server.RestfulServer.doPut(RestfulServer.java:382)
at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1752)
a
@corneliouzbett
corneliouzbett / JsonSplitter.ts
Created September 29, 2020 06:20
Typescript code snippet that splits JSON file array into multiple files
const jsonArr = require('./file.json');
jsonArr.forEach( (item) => { item.writeFileSync('itemsFolder/' + item.id + '.json', JSON.stringify(item) ); } );
{
"resourceType": "Condition",
"id": "92A45BE7A93A4E14A49CB9A51E19C3A4",
"subject": {
"reference": "Patient/dd738d54-1691-11df-97a5-7038c432aabf"
},
"clinicalStatus": "active",
"code": {
"coding": {
"system": "http://snomed.info/sct",
@corneliouzbett
corneliouzbett / install-nvm-zsh.txt
Created July 8, 2019 09:26 — forked from mike-casas/install-nvm-zsh.txt
install nvm on mac with zsh shell
After install zsh
- brew update
- brew install nvm
- mkdir ~/.nvm
after in your ~/.zshrc or in .bash_profile if your use bash shell:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
private void enlistCreateTable(String sql, DDLType ddlType)
throws SQLException {
String tn = ddlType.getDBObjectName(sql);
UcanaccessConnection ac = UcanaccessConnection.getCtxConnection();
String execId = UcanaccessConnection.getCtxExcId();
Connection hsqlConn = ac.getHSQLDBConnection();
Database db = ac.getDbIO();
LoadJet lfa = new LoadJet(hsqlConn, db);
lfa.synchronisationTriggers(tn, true,true);
CreateTableCommand c4io;
private static Table createUniqueTable(Database db, String name,
List<ColumnBuilder> columns,
ResultSetMetaData md,
ImportFilter filter)
throws IOException, SQLException
{
// otherwise, find unique name and create new table
String baseName = name;
int counter = 2;
while(db.getTable(name) != null) {
@corneliouzbett
corneliouzbett / JwtTokenUtil.java
Created April 26, 2019 20:19
Using Json web token (JWT) to create a token
String generateToken(Map<String, Object> claims) {
return Jwts.builder()
.setClaims(claims)
.setExpiration(generateExpirationDate())
.signWith(SignatureAlgorithm.HS512, secret)
.compact();
}
public void cronJobSch() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date now = new Date();
String strDate = sdf.format(now);
System.out.println("Java cron job expression:: " + strDate);
}
public class Scheduler {
@Scheduled(fixedDelay = 1000, initialDelay = 3000)
public void fixedDelaySch() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date now = new Date();
String strDate = sdf.format(now);
System.out.println("Fixed Delay scheduler:: " + strDate);
}
}