Skip to content

Commit

Permalink
Latest changes from next-staging (#76)
Browse files Browse the repository at this point in the history
* Cleanup workflow codes (#73)

* remove unused code

* temporary add collections in job code (#74)

For offline support until we migrate to collections

* Changes accepted by Lightning; updated current project state

* user [email protected] initiated a sync from Lightning

* Changes accepted by Lightning; updated current project state

---------

Co-authored-by: aleksa-krolls <[email protected]>
Co-authored-by: openfn[bot] <openfn[bot]@users.noreply.github.com>
Co-authored-by: mtuchi <[email protected]>
  • Loading branch information
4 people authored Dec 17, 2024
1 parent 35c831d commit ca20594
Show file tree
Hide file tree
Showing 12 changed files with 45,877 additions and 448 deletions.
12 changes: 6 additions & 6 deletions openfn-69066751-5f2c-459c-b42e-feba1c802383-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ workflows:
jobs:
Fetch-Metadata:
name: Fetch Metadata
adaptor: '@openfn/language-http@latest'
adaptor: '@openfn/language-http@6.5.1'
credential: null
body:
path: workflows/wf1/1-fetch-metadata.js

Get-Teis-and-Locations:
name: Get Teis and Locations
adaptor: '@openfn/language-dhis2@latest'
adaptor: '@openfn/language-dhis2@5.0.1'
credential: [email protected]
body:
path: workflows/wf1/2-get-teis-and-locations.js

Create-Patients:
name: Create Patients
adaptor: '@openfn/language-openmrs@latest'
adaptor: '@openfn/language-openmrs@4.1.3'
credential: [email protected]
body:
path: workflows/wf1/3-create-patients.js
Expand Down Expand Up @@ -139,7 +139,7 @@ workflows:
jobs:
Get-Patients:
name: Get Patients
adaptor: '@openfn/language-openmrs@latest'
adaptor: '@openfn/language-openmrs@4.1.3'
credential: [email protected]
body:
path: workflows/wf2/1-get-patients.js
Expand All @@ -153,7 +153,7 @@ workflows:

Get-Encounters:
name: Get Encounters
adaptor: '@openfn/language-http@latest'
adaptor: '@openfn/language-http@6.5.1'
credential: '[email protected](raw)'
body:
path: workflows/wf2/3-get-encounters.js
Expand All @@ -174,7 +174,7 @@ workflows:

Mappings:
name: Mappings
adaptor: '@openfn/language-http@latest'
adaptor: '@openfn/language-http@6.5.1'
credential: null
body:
path: workflows/wf2/2-mappings.js
Expand Down
329 changes: 169 additions & 160 deletions openfn-69066751-5f2c-459c-b42e-feba1c802383-state.json

Large diffs are not rendered by default.

22,700 changes: 22,691 additions & 9 deletions workflows/wf1/1-fetch-metadata.js

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions workflows/wf1/2-get-teis-and-locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ get(
const teis = state.data.instances.filter(
tei => tei.updatedAt >= state.cursor
);
//for testing
//.filter(tei => tei.createdAt > state.cursor) //for prod
//.slice(0, 1); //to limit 1 for testing

console.log(
'# of TEIs found before filter ::',
Expand Down
9 changes: 2 additions & 7 deletions workflows/wf2/1-get-patients.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
//Here we define the date cursor
//$.cursor at beggining of the project 2023-05-20T06:01:24.000+0000
cursor($.lastRunDateTime || $.manualCursor || '2023-05-20T06:01:24.000+0000');
// Update the lastRunDateTime for the next run

cursor('today', {
key: 'lastRunDateTime',
format: c => dateFns.format(new Date(c), "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"),
});

searchPatient({ q: 'IQ', v: 'full', limit: '100' });
//searchPatient({ q: 'Katrina', v: 'full', limit: '100' });
//Query all patients (q=all) not supported on demo OpenMRS; needs to be configured
//...so we query all Patients with name "Patient" instead

fn(state => {
const { cursor, data, lastRunDateTime } = state;
console.log('Filtering patients since:', cursor);
console.log('Filtering patients since cursor:', cursor);

const patients = data.results.filter(({ auditInfo }) => {
const lastModified = auditInfo?.dateChanged || auditInfo?.dateCreated;
Expand Down
Loading

0 comments on commit ca20594

Please sign in to comment.