Skip to main content

godata@3.2.0

Adaptor

Adaptor.execute

Kind: static class of Adaptor

new exports.execute(operations)

Execute a sequence of operations. Wraps language-common/execute, and prepends initial state for http.

ParamTypeDescription
operationsOperationsOperations to be performed.

Example

execute(
create('foo'),
delete('bar')
)(state)

Adaptor.listContacts(id, callback) ⇒ Operation

Fetch the list of contacts within a particular outbreak using its ID.

Kind: static method of Adaptor
Access: public

ParamTypeDescription
idstringOutbreak id
callbackfunction(Optional) Callback function

Example

listContacts("343d-dc3e", // Outbreak Id
state => {
console.log(state);
return state;
});

Adaptor.getContact(id, query, callback) ⇒ Operation

Get one or multiple contacts within an outbreak from a query filter

Kind: static method of Adaptor
Access: public

ParamTypeDescription
idstringOutbreak id
queryobjectAn object with a query filter parameter
callbackfunction(Optional) Callback function

Example

getContact("343d-dc3e", {"where":{"firstName": "Luca"}}, state => {
console.log(state.data);
return state;
});

Adaptor.upsertContact(id, externalId, goDataContact, callback) ⇒ Operation

Upsert contact to godata using an external id to match a specific record.

Kind: static method of Adaptor
Access: public

ParamTypeDescription
idstringOutbreak id
externalIdstringExternal Id to match
goDataContactobjectan object with some case data.
callbackfunction(Optional) Callback function

Example

upsertContact("4dce-3eedce3-rd33", 'visualId',
{
firstName: 'Luca',
gender: 'male',
'age:years': '20'
...
}
)

Adaptor.listOutbreaks(callback) ⇒ Operation

Fetch the list of outbreaks

Kind: static method of Adaptor
Access: public

ParamTypeDescription
callbackfunction(Optional) Callback function

Example

listOutbreaks(state => {
console.log(state.data);
return state;
});

Adaptor.getOutbreak(query, callback) ⇒ Operation

Get one or multiple outbreaks from a query filter

Kind: static method of Adaptor
Access: public

ParamTypeDescription
queryobjectAn object with a query filter parameter
callbackfunction(Optional) Callback function

Example

getOutbreak({"where":{"name": "Outbreak demo"}}, state => {
console.log(state.data);
return state;
});

Adaptor.upsertOutbreak(outbreak, callback) ⇒ Operation

Upsert outbreak to godata

Kind: static method of Adaptor
Access: public

ParamTypeDescription
outbreakobjectan object with an externalId and some outbreak data.
callbackfunction(Optional) Callback function

Example

upsertOutbreak({externalId: "3dec33-ede3", data: {...}})

Adaptor.listCases(id, callback) ⇒ Operation

Fetch the list of cases within a particular outbreak using its ID.

Kind: static method of Adaptor
Access: public

ParamTypeDescription
idstringOutbreak id
callbackfunction(Optional) Callback function

Example

listCases("343d-dc3e", state => {
console.log(state);
return state;
});

Adaptor.getCase(id, query, callback) ⇒ Operation

Get one or multiple cases within an outbreak from a query filter

Kind: static method of Adaptor
Access: public

ParamTypeDescription
idstringOutbreak id
queryobjectAn object with a query filter parameter
callbackfunction(Optional) Callback function

Example

getCase(
'3b55-cdf4',
{ 'where.relationship': { active: true }, where: { firstName: 'Luca'} },
state => {
console.log(state);
return state;
}
);

Adaptor.upsertCase(id, externalId, goDataCase, callback) ⇒ Operation

Upsert case to godata using an external id to mach a specific record

Kind: static method of Adaptor
Access: public

ParamTypeDescription
idstringOutbreak id
externalIdstringExternal Id to match
goDataCaseobjectan object with some case data.
callbackfunction(Optional) Callback function

Example

upsertCase("4dce-3eedce3-rd33", 'visualId',
data: state => {
const patient = state.data.body;
return {
firstName: patient.Patient_name.split(' ')[0],
lastName: patient.Patient_name.split(' ')[1],
visualId: patient.Case_ID,
'age:years': patient.Age_in_year,
gender: patient.Sex,
};
})

Adaptor.listLocations(callback) ⇒ Operation

Fetch the list of locations

Kind: static method of Adaptor
Access: public

ParamTypeDescription
callbackfunction(Optional) Callback function

Example

listLocations(state => {
console.log(state.data);
return state;
});

Adaptor.getLocation(query, callback) ⇒ Operation

Get one or multiple locations from a query filter

Kind: static method of Adaptor
Access: public

ParamTypeDescription
queryobjectAn object with a query filter parameter
callbackfunction(Optional) Callback function

Example

getLocation({"where":{"name": "30 DE OCTUBRE"}}, state => {
console.log(state.data);
return state;
});

Adaptor.upsertLocation(externalId, goDataLocation, callback) ⇒ Operation

Upsert location to godata

Kind: static method of Adaptor
Access: public

ParamTypeDescription
externalIdstringExternal Id to match
goDataLocationobjectan object with some location data.
callbackfunction(Optional) Callback function

Example

upsertLocation('name', {...})

Adaptor.listReferenceData(callback) ⇒ Operation

Fetch the list of reference data

Kind: static method of Adaptor
Access: public

ParamTypeDescription
callbackfunction(Optional) Callback function

Example

listReferenceData(state => {
console.log(state.data);
return state;
});

Adaptor.getReferenceData(query, callback) ⇒ Operation

Get one or multiple reference data from a query filter

Kind: static method of Adaptor
Access: public

ParamTypeDescription
queryobjectAn object with a query filter parameter
callbackfunction(Optional) Callback function

Example

getReferenceData({"where":{"categoryId": "LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME"}}, state => {
console.log(state.data);
return state;
});

Adaptor.upsertReferenceData(externalId, goDataReferenceData, callback) ⇒ Operation

Upsert reference data to godata

Kind: static method of Adaptor
Access: public

ParamTypeDescription
externalIdstringExternal Id to match
goDataReferenceDataobjectan object with some reference data.
callbackfunction(Optional) Callback function

Example

upsertReferenceData('id', {...})