Skip to main content

godata@3.4.0

Functions

getCase(id, query, callback)
getContact(id, query, callback)
getLocation(query, callback)
getOutbreak(query, callback)
getReferenceData(query, callback)
listCases(id, callback)
listContacts(id, callback)
listLocations(callback)
listOutbreaks(callback)
listReferenceData(callback)
upsertCase(id, externalId, goDataCase, callback)
upsertContact(id, externalId, goDataContact, callback)
upsertLocation(externalId, goDataLocation, callback)
upsertOutbreak(outbreak, callback)
upsertReferenceData(externalId, goDataReferenceData, callback)

The following functions are exported from the common adaptor:

alterState()
dataPath()
dataValue()
each()
field()
fields()
lastReferenceValue()
merge()
sourceValue()

getCase

getCase(id, query, callback) ⇒ Operation

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

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;
}
);

getContact

getContact(id, query, callback) ⇒ Operation

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

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;
});

getLocation

getLocation(query, callback) ⇒ Operation

Get one or multiple locations from a query filter

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;
});

getOutbreak

getOutbreak(query, callback) ⇒ Operation

Get one or multiple outbreaks from a query filter

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;
});

getReferenceData

getReferenceData(query, callback) ⇒ Operation

Get one or multiple reference data from a query filter

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;
});

listCases

listCases(id, callback) ⇒ Operation

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

ParamTypeDescription
idstringOutbreak id
callbackfunction(Optional) Callback function

Example

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

listContacts

listContacts(id, callback) ⇒ Operation

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

ParamTypeDescription
idstringOutbreak id
callbackfunction(Optional) Callback function

Example

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

listLocations

listLocations(callback) ⇒ Operation

Fetch the list of locations

ParamTypeDescription
callbackfunction(Optional) Callback function

Example

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

listOutbreaks

listOutbreaks(callback) ⇒ Operation

Fetch the list of outbreaks

ParamTypeDescription
callbackfunction(Optional) Callback function

Example

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

listReferenceData

listReferenceData(callback) ⇒ Operation

Fetch the list of reference data

ParamTypeDescription
callbackfunction(Optional) Callback function

Example

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

upsertCase

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

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

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,
};
})

upsertContact

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

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

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'
...
}
)

upsertLocation

upsertLocation(externalId, goDataLocation, callback) ⇒ Operation

Upsert location to godata

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

Example

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

upsertOutbreak

upsertOutbreak(outbreak, callback) ⇒ Operation

Upsert outbreak to godata

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

Example

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

upsertReferenceData

upsertReferenceData(externalId, goDataReferenceData, callback) ⇒ Operation

Upsert reference data to godata

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

Example

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