Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release openmrs 4.0 #750

Merged
merged 28 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eb77994
Add cursor, dateFns and pagination
mtuchi Sep 6, 2024
91c7972
add changeset
mtuchi Sep 6, 2024
4ea2965
add cursor and dateFns
mtuchi Sep 6, 2024
c8dbd21
add changeset
mtuchi Sep 9, 2024
780abc5
update packages
mtuchi Sep 9, 2024
c3ef47f
remove the example without caption
mtuchi Sep 9, 2024
ec55e95
remove pagination code
mtuchi Sep 9, 2024
8823610
add autoFetchRequest helper function
mtuchi Sep 9, 2024
20e077d
add unit test
mtuchi Sep 9, 2024
6044dd7
update changeset
mtuchi Sep 9, 2024
05625f9
improve log
mtuchi Sep 9, 2024
3f16170
Merge pull request #743 from OpenFn/openmrs-cursor
josephjclark Sep 11, 2024
2b0dcdc
minor improvements
mtuchi Sep 11, 2024
890bf21
remove autoFetchRequest
mtuchi Sep 11, 2024
796bc5a
remove createEncounter and createPatient
mtuchi Sep 11, 2024
f9c6400
update changeset
mtuchi Sep 11, 2024
cc8e5c4
update docs
mtuchi Sep 11, 2024
bf6887c
add if..else in allResponse assignment
mtuchi Sep 11, 2024
58e7fb1
assert body.results.length === 1
mtuchi Sep 11, 2024
a169631
update changeset
mtuchi Sep 11, 2024
6d9f292
rename test to index.test.js
mtuchi Sep 11, 2024
23902db
Merge branch 'openmrs-improvements' into 747-cleanup
mtuchi Sep 11, 2024
57d8b55
Merge pull request #741 from OpenFn/openmrs-improvements
josephjclark Sep 11, 2024
8b2effc
update changeset
mtuchi Sep 11, 2024
cff65e6
fix changelog
josephjclark Sep 11, 2024
2c03c75
Merge pull request #749 from OpenFn/747-cleanup
josephjclark Sep 11, 2024
15698f9
update changelog and bump version
mtuchi Sep 12, 2024
24c984e
openrms: update changelog
josephjclark Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading