Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

OpenFn/language-openmrs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

⚠️ MOVED TO OpenFn/adaptors! ⚠️

N.B.: New versions are available at: https://github.com/OpenFn/adaptors/tree/main/packages/openmrs

Language OpenMRS (Archived) Build Status

Language Pack for building expressions and operations for working with the OpenMRS API.

OpenMRS Data Model Explorer

Documentation

Sample configuration

{
  "instanceUrl": "http://openmrs.com/instance/url",
  "username": "admin@openmrs",
  "password": "supersecretopenmrspassword"
}

Get a patient by some criteria

// getPatient({ uuid: '516af9aa-0402-4e11-ad79-e394fdec0c91' });
// getPatient({ uuid: dataValue('patientId')(state) });
getPatient({
  uuid: (state) => state.data[0].uuid,
});

Example of searching for patients based on their EMR Id

getPatients(
  {
    identifier: state => state.data.emrId,
    v: 'full',
  },
  {
    exactlyOne: true,
  }
);

Create an Encounter

createEncounter({
  encounterDatetime: dataValue('visit_date'), //dynamically fill with source app data
  patient: dataValue('uuid'), 
  encounterType: dataValue('visit_type'),
  location: dataValue('location.uuid'),
  encounterProviders: [
    {
      provider: dataValue('provider_name'),
      encounterRole: '240b26f9-dd88-4172-823d-4a8bfeb7841f', //hardcoded value
    },
  ],
});

Make a request to any OpenMRS endpoint

req({ method: 'GET', url: '/ws/rest/v1/concept' }, (state) => {
  console.log(JSON.stringify(state, null, 2));
  return state;
});

Create new patient

patient(
  fields(
    field("gender", "M"),
    field("names", function(state) {
      return [{
        "patient_id": dataValue("form.patientId")(state),
        "creator": dataValue("form.user")(state)
      }]
    })
  )
)

Development

Clone the repo, run npm install.

Run tests using npm run test or npm run test:watch

Build the project using make.

About

Language Pack for building expressions and operations for working with the OpenMRS API.

Resources

License

GPL-3.0, LGPL-3.0 licenses found

Licenses found

GPL-3.0
LICENSE
LGPL-3.0
LICENSE.LESSER

Stars

Watchers

Forks

Packages

No packages published