Skip to content

Commit

Permalink
small tweaks to be less eachy
Browse files Browse the repository at this point in the history
  • Loading branch information
taylordowns2000 committed Jul 18, 2024
1 parent 71e5ba2 commit ceeac3a
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions services/job_chat/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
A job SHOULD NOT use async/await or promises.
A job SHOULD NOT use `alterState`, instead it should use `fn` for data transformation.
An Operation is a factory function which returns a function that takes state and returns state, like this:
```
const myOperation = (arg) => (state) => { /* do something with arg and state */ return state; }
Expand All @@ -54,9 +56,13 @@
Example job code with the HTTP adaptor:
```
get('/patients');
each('$.data.patients[*]', (item, index) => {
item.id = `item-${index}`;
});
fn(state => {
const patients = state.data.map(p => {
return { ...p, enrolled: true }
});
return { ...state, data: { patients } };
})
post('/patients', dataValue('patients'));
```
Example job code with the Salesforce adaptor:
Expand All @@ -72,16 +78,13 @@
```
Example job code with the ODK adaptor:
```
each(
'$.data.data[*]',
create(
'ODK_Submission__c',
fields(
field('Site_School_ID_Number__c', dataValue('school')),
field('Date_Completed__c', dataValue('date')),
field('comments__c', dataValue('comments')),
field('ODK_Key__c', dataValue('*meta-instance-id*'))
)
create(
'ODK_Submission__c',
fields(
field('Site_School_ID_Number__c', dataValue('school')),
field('Date_Completed__c', dataValue('date')),
field('comments__c', dataValue('comments')),
field('ODK_Key__c', dataValue('*meta-instance-id*'))
)
);
```
Expand Down

0 comments on commit ceeac3a

Please sign in to comment.