3.0.4 • Published 5 days ago

@openfn/language-openmrs v3.0.4

Weekly downloads
-
License
LGPLv3
Repository
github
Last release
5 days ago

Language OpenMRS

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

OpenMRS Data Model Explorer

Documentation

Configuration

View all the required and optional properties for state.configuration in the official configuration-schema definition.

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

get('/ws/rest/v1/patient', { q: 'mohammed' }, state => {
  console.log(JSON.stringify(state, null, 2));
  return state;
});

Create new patient

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

Development

Clone the adaptors monorepo. Follow the Getting Started guide inside to get set up.

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

Build the project using pnpm build.

To just build the docs run pnpm build docs

3.0.4

5 days ago

3.0.3

5 days ago

3.0.2

1 month ago

3.0.1

1 month ago

3.0.0

1 month ago

2.0.3

11 months ago

2.0.5

10 months ago

2.0.4

10 months ago

2.0.7

8 months ago

2.0.6

9 months ago

2.0.8

8 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago

2.0.2

11 months ago

2.0.1

11 months ago

0.10.4

1 year ago

0.10.5

1 year ago

0.10.2

1 year ago

0.10.3

1 year ago

0.10.1

1 year ago

0.10.0

1 year ago

0.9.2

3 years ago

0.9.1

3 years ago