Skip to main content

openspp@2.0.2

addToGroup(group_id, individual_id, role)
createGroup(data, callback)
createIndividual(data, callback)
enroll(spp_id, program_id)
getArea(spp_id, callback)
getEnrolledPrograms(spp_id, callback)
getGroup(spp_id, callback)
getGroupMembers(spp_id, [options], callback)
getIndividual(spp_id, callback)
getProgram(program_id, callback)
getPrograms([options], callback)
getServicePoint(spp_id, callback)
removeFromGroup(group_id, individual_id)
searchArea(domain, [options], callback)
searchGroup(domain, [options], callback)
searchIndividual(domain, [options], callback)
searchServicePoint(domain, [options], callback)
unenroll(spp_id, program_id)
updateGroup(group_id, data)
updateIndividual(individual_id, data)

This adaptor exports the following from common:

dataPath()
dataValue()
dateFns
each()
field()
fields()
fn()
fnIf()
http
lastReferenceValue()
merge()
sourceValue()

Functions

addToGroup

addToGroup(group_id, individual_id, role) ⇒ Operation

add individual to group in OpenSPP

ParamTypeDescription
group_idstringgroup registrant id
individual_idstringindividual registrant id
rolestringindividual role in group

Example: create a new head for group

addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4", "Head")

Example: create a new ordinary member for group

addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4")

Example: create a new member with new role for group

addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4", "new-role-name")

createGroup

createGroup(data, callback) ⇒ Operation

create new group for OpenSPP

ParamTypeDescription
dataobjectregistrant create data
callbackfunctionAn optional callback function

Example

createGroup({ name: "Group 1" })

createIndividual

createIndividual(data, callback) ⇒ Operation

create new individual for OpenSPP

ParamTypeDescription
dataobjectregistrant create data
callbackfunctionAn optional callback function

Example

createIndividual({ name: "Individual 1" })

enroll

enroll(spp_id, program_id)

enroll registrant to program in OpenSPP

ParamTypeDescription
spp_idstringspp_id of group / individual wanted to enroll
program_idstringprogram_id of program

Example

enroll("IND_Q4VGGZPF", "PROG_2023_00000001")

getArea

getArea(spp_id, callback) ⇒ Operation

get area by id in OpenSPP

ParamTypeDescription
spp_idstringspp_id of area
callbackfunctionAn optional callback function

Example

getArea("LOC_7M92NLDH")

getEnrolledPrograms

getEnrolledPrograms(spp_id, callback) ⇒ Operation

get programs list for specific registrant from OpenSPP

ParamTypeDescription
spp_idstringspp_id of group / individual wanted to search
callbackfunctionAn optional callback function

Example

getEnrolledPrograms("IND_Q4VGGZPF")

getGroup

getGroup(spp_id, callback) ⇒ Operation

get group information from OpenSPP

ParamTypeDescription
spp_idstringThe spp_id of the group
callbackfunctionAn optional callback function

Example

getGroup("GRP_Q4VGGZPF")

getGroupMembers

getGroupMembers(spp_id, [options], callback) ⇒ Operation

get group members information from OpenSPP

ParamTypeDefaultDescription
spp_idstringThe name of the group
[options]object{}Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records
callbackfunctionAn optional callback function

Example

getGroupMembers("GRP_Q4VGGZPF")

getIndividual

getIndividual(spp_id, callback) ⇒ Operation

get individual information from OpenSPP

ParamTypeDescription
spp_idstringThe spp_id of the individual
callbackfunctionAn optional callback function

Example

getIndividual("IND_Q4VGGZPF")

getProgram

getProgram(program_id, callback) ⇒ Operation

get program information from OpenSPP

ParamTypeDescription
program_idstringsearching domain
callbackfunctionAn optional callback function

Example

getProgram("PROG_2023_00000001")

getPrograms

getPrograms([options], callback) ⇒ Operation

get programs list from OpenSPP

ParamTypeDefaultDescription
[options]number{}offset from start
callbackfunctionAn optional callback function

Example

getPrograms(100)

getServicePoint

getServicePoint(spp_id, callback) ⇒ Operation

get service points information from OpenSPP

ParamTypeDescription
spp_idstringThe spp_id of the agent
callbackfunctionAn optional callback function

Example

getServicePoint("SVP_8P4KP4RT")

removeFromGroup

removeFromGroup(group_id, individual_id) ⇒ Operation

remove individual from group in OpenSPP

ParamTypeDescription
group_idstringgroup registrant id
individual_idstringindividual registrant id

Example

removeFromGroup("GRP_B2BRHJN2", "IND_8DUQL4M4")

searchArea

searchArea(domain, [options], callback) ⇒ Operation

searching for service point in OpenSPP

ParamTypeDefaultDescription
domainArraysearching domain
[options]object{}Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records
callbackfunctionAn optional callback function

Example: search without offset

searchArea([["code", "=", "10732"]])

Example: search with offset

searchArea([["kind", "=", 1]], { offset: 10 }})

searchGroup

searchGroup(domain, [options], callback) ⇒ Operation

get groups from OpenSPP

ParamTypeDefaultDescription
domainArraysearching domain
[options]object{}Searching options, eg: limit for limiting number of records returning, order for ordering search, offset for skipping records
callbackfunctionAn optional callback function

Example: search group by domain

searchGroup([["spp_id", "=", "GRP_Q4VGGZPF"]])

Example: search group by domain with offset

searchGroup([["spp_id", "ilike", "GRP"]], { offset: 100 }})

Example: search group by complex domain for more accuracy

searchGroup([["address", "!=", false], ["phone", "!=", false]])

searchIndividual

searchIndividual(domain, [options], callback) ⇒ Operation

get individuals from OpenSPP

ParamTypeDefaultDescription
domainArraysearching domain
[options]object{}Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records
callbackfunctionAn optional callback function

Example: search individual by domain

searchIndividual([["spp_id", "=", "IND_Q4VGGZPF"]])

Example: search individual by domain with offset

searchIndividual([["spp_id", "ilike", "IND"]], { offset: 100 })

Example: search individual by complex domain for more accuracy

searchIndividual([["address", "!=", false], ["birthdate", "=", false]])

searchServicePoint

searchServicePoint(domain, [options], callback) ⇒ Operation

searching for service point in OpenSPP

ParamTypeDefaultDescription
domainArraysearching domain
[options]object{}Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records
callbackfunctionAn optional callback function

Example: search without offset

searchServicePoint([["name", "ilike", "agent 1"]])

Example: search with offset

searchServicePoint([["name", "ilike", "agent 1"]], { offset: 100 })

unenroll

unenroll(spp_id, program_id)

unenroll registrant from program in OpenSPP

ParamTypeDescription
spp_idstringspp_id of group / individual wanted to unenroll
program_idstringprogram_id of program

Example

unenroll("IND_Q4VGGZPF", "PROG_2023_00000001")

updateGroup

updateGroup(group_id, data) ⇒ Operation

update group for OpenSPP

ParamTypeDescription
group_idstringgroup registrant id
dataobjectregistrant update data

Example

updateGroup("GRP_B2BRHJN2", { name: "Group 1" })

updateIndividual

updateIndividual(individual_id, data) ⇒ Operation

update individual for OpenSPP

ParamTypeDescription
individual_idstringindividual registrant id
dataobjectregistrant update data

Example

updateIndividual("IND_8DUQL4M4", { name: "Individual 1" })