Skip to content

Commit

Permalink
Merge pull request #750 from OpenFn/release/openmrs
Browse files Browse the repository at this point in the history
Release openmrs 4.0
  • Loading branch information
josephjclark authored Sep 12, 2024
2 parents 152deb0 + 24c984e commit d84f1fa
Show file tree
Hide file tree
Showing 9 changed files with 908 additions and 336 deletions.
28 changes: 28 additions & 0 deletions packages/openmrs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# @openfn/language-openmrs

## 4.0.0

### Major Changes

- Remove `createEncounter` and `createPatient` functions
- Add pagination support on request helper function

### Minor Changes

- c8dbd21: Add cursor and dateFns helper functions

### Migration Guide

The `createEncounter` and `createPatient` functions have been removed from the
OpenMRS adaptor. Use the `create` function with the appropriate resource type.

To create a new encounter, you can use the following code:

```js
create('encounter', $.encounter);
```

To create a new patient, you can use the following code:

```js
create('patient', $.patient);
```

## 3.1.4

### Patch Changes
Expand Down
213 changes: 96 additions & 117 deletions packages/openmrs/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
"docs": {
"description": "Gets patient matching a uuid",
"tags": [
{
"title": "example",
"description": "getPatient(\"123\")"
},
{
"title": "function",
"description": null,
Expand Down Expand Up @@ -61,63 +57,6 @@
},
"valid": true
},
{
"name": "createEncounter",
"params": [
"data",
"callback"
],
"docs": {
"description": "Creates an encounter",
"tags": [
{
"title": "example",
"description": "createEncounter({\n encounterDatetime: '2023-05-25T06:08:25.000+0000',\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\n encounterType: 'dd528487-82a5-4082-9c72-ed246bd49591',\n location: 'ba685651-ed3b-4e63-9b35-78893060758a',\n encounterProviders: [],\n visit: {\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\n visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed',\n startDatetime: '2023-05-25T06:08:25.000+0000',\n stopDatetime: '2023-05-25T06:09:25.000+0000',\n },\n})",
"caption": "Create an encounter"
},
{
"title": "function",
"description": null,
"name": null
},
{
"title": "public",
"description": null,
"type": null
},
{
"title": "param",
"description": "Data parameters of the encounter",
"type": {
"type": "NameExpression",
"name": "object"
},
"name": "data"
},
{
"title": "param",
"description": "Optional callback to handle the response",
"type": {
"type": "OptionalType",
"expression": {
"type": "NameExpression",
"name": "function"
}
},
"name": "callback"
},
{
"title": "returns",
"description": null,
"type": {
"type": "NameExpression",
"name": "Operation"
}
}
]
},
"valid": true
},
{
"name": "get",
"params": [
Expand Down Expand Up @@ -362,62 +301,6 @@
},
"valid": true
},
{
"name": "createPatient",
"params": [
"data",
"callback"
],
"docs": {
"description": "Creates a new patient",
"tags": [
{
"title": "example",
"description": "createPatient({\n identifiers: [\n {\n identifier: '4023287',\n identifierType: '05a29f94-c0ed-11e2-94be-8c13b969e334',\n preferred: true,\n },\n ],\n person: {\n gender: 'M',\n age: 42,\n birthdate: '1970-01-01T00:00:00.000+0100',\n birthdateEstimated: false,\n names: [\n {\n givenName: 'Doe',\n familyName: 'John',\n },\n ],\n },\n})"
},
{
"title": "function",
"description": null,
"name": null
},
{
"title": "public",
"description": null,
"type": null
},
{
"title": "param",
"description": "Object parameters of the patient",
"type": {
"type": "NameExpression",
"name": "object"
},
"name": "data"
},
{
"title": "param",
"description": "Optional callback to handle the response",
"type": {
"type": "OptionalType",
"expression": {
"type": "NameExpression",
"name": "function"
}
},
"name": "callback"
},
{
"title": "returns",
"description": null,
"type": {
"type": "NameExpression",
"name": "Operation"
}
}
]
},
"valid": true
},
{
"name": "getEncounter",
"params": [
Expand Down Expand Up @@ -592,6 +475,16 @@
"title": "example",
"description": "create(\"person\", {\n names: [\n {\n givenName: \"Mohit\",\n familyName: \"Kumar\",\n },\n ],\n gender: \"M\",\n birthdate: \"1997-09-02\",\n addresses: [\n {\n address1: \"30, Vivekananda Layout, Munnekolal,Marathahalli\",\n cityVillage: \"Bengaluru\",\n country: \"India\",\n postalCode: \"560037\",\n },\n ],\n});",
"caption": "Create a person"
},
{
"title": "example",
"description": "create(\"encounter\", {\n encounterDatetime: '2023-05-25T06:08:25.000+0000',\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\n encounterType: 'dd528487-82a5-4082-9c72-ed246bd49591',\n location: 'ba685651-ed3b-4e63-9b35-78893060758a',\n encounterProviders: [],\n visit: {\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\n visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed',\n startDatetime: '2023-05-25T06:08:25.000+0000',\n stopDatetime: '2023-05-25T06:09:25.000+0000',\n },\n})",
"caption": "Create an encounter"
},
{
"title": "example",
"description": "create(\"patient\", {\n identifiers: [\n {\n identifier: '4023287',\n identifierType: '05a29f94-c0ed-11e2-94be-8c13b969e334',\n preferred: true,\n },\n ],\n person: {\n gender: 'M',\n age: 42,\n birthdate: '1970-01-01T00:00:00.000+0100',\n birthdateEstimated: false,\n names: [\n {\n givenName: 'Doe',\n familyName: 'John',\n },\n ],\n },\n})",
"caption": "Create a patient"
}
]
},
Expand Down Expand Up @@ -1294,6 +1187,92 @@
]
},
"valid": true
},
{
"name": "cursor",
"params": [
"value",
"options"
],
"docs": {
"description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones\nare not yet supported.\nYou can provide a formatter to customise the final cursor value, which is useful for normalising\ndifferent inputs. The custom formatter runs after natural language date conversion.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
"tags": [
{
"title": "public",
"description": null,
"type": null
},
{
"title": "function",
"description": null,
"name": null
},
{
"title": "example",
"description": "cursor($.cursor, { defaultValue: 'today' })",
"caption": "Use a cursor from state if present, or else use the default value"
},
{
"title": "example",
"description": "cursor(22)",
"caption": "Use a pagination cursor"
},
{
"title": "param",
"description": "the cursor value. Usually an ISO date, natural language date, or page number",
"type": {
"type": "NameExpression",
"name": "any"
},
"name": "value"
},
{
"title": "param",
"description": "options to control the cursor.",
"type": {
"type": "NameExpression",
"name": "object"
},
"name": "options"
},
{
"title": "param",
"description": "set the cursor key. Will persist through the whole run.",
"type": {
"type": "NameExpression",
"name": "string"
},
"name": "options.key"
},
{
"title": "param",
"description": "the value to use if value is falsy",
"type": {
"type": "NameExpression",
"name": "any"
},
"name": "options.defaultValue"
},
{
"title": "param",
"description": "custom formatter for the final cursor value",
"type": {
"type": "NameExpression",
"name": "Function"
},
"name": "options.format"
},
{
"title": "returns",
"description": null,
"type": {
"type": "NameExpression",
"name": "Operation"
}
}
]
},
"valid": false
}
]
}
15 changes: 7 additions & 8 deletions packages/openmrs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-openmrs",
"version": "3.1.4",
"version": "4.0.0",
"description": "OpenMRS Language Pack for OpenFn",
"homepage": "https://docs.openfn.org",
"repository": {
Expand All @@ -25,18 +25,17 @@
"configuration-schema.json"
],
"dependencies": {
"@openfn/language-common": "2.0.1"
"@openfn/language-common": "workspace:*"
},
"devDependencies": {
"@openfn/simple-ast": "^0.4.1",
"assertion-error": "^1.0.1",
"chai": "^3.4.0",
"assertion-error": "^1.1.0",
"chai": "^5.1.1",
"deep-eql": "^0.1.3",
"esno": "^0.16.3",
"mocha": "^10.1.0",
"mocha": "^10.7.3",
"nock": "^12.0.3",
"rimraf": "^3.0.2",
"sinon": "^1.17.2"
"rimraf": "^3.0.2"
},
"type": "module",
"exports": {
Expand All @@ -48,4 +47,4 @@
"./package.json": "./package.json"
},
"types": "types/index.d.ts"
}
}
Loading

0 comments on commit d84f1fa

Please sign in to comment.