Closed aleksa-krolls closed 3 years ago
@taylordowns2000 Here are the specs for the WCS Wildmeat jobs. Some creds need to be shared over LP, so see my slack comments here.
@lakhassane , this job getKoboData.js is what we'll want to use to model the cron
job for WCS consocsci
@aleksa-krolls A bunch of comments on WCS Execution
site_id
for upsert consideration (on table tbl_site
).external_id
/household_id
(on table tbl_household
)household_id
is a string in state.json
and is noted as a integer on database if I understand the output (on table tbl_sample
).sample_id
(on table tbl_sample
).tbl_swm_transaction
does not exist (2nd sheet).@lakhassane Any updates on my question for step 1? Is it possible to query forms from Kobo by filtering on form name
rather than form id
? Ideally any survey with "Rural Consumption" in the form name can be returned in the first job.
@aleksa-krolls I checked the api docs for Kobo, but still the id is
the only filter used. No sign of anything other on that.
@lakhassane and no way to fetch ALL forms if we send a GET request to /assets
and then iterate through this list to find those with the matching name "Rural Consumption"?
@taylordowns2000 any ideas for how to achieve the above mentioned requirement so that users don't have to repeatedly update the OpenFn jobs with relevant Kobo form Ids every time a new survey is created?
@lakhassane The client has asked that we implement any database configuration changes needed. Please proceed with these and track any DB changes made in the mapping doc.
varchar
as needed. swm_transaction
Just noting that I'll handle the DB changes once we get access (IP needs whitelisting) and then Mamadou can roll on the job changes.
On Tue, Sep 1, 2020 at 2:59 AM Aleksa Krolls notifications@github.com wrote:
@lakhassane https://github.com/lakhassane The client has asked that we implement any database configuration changes needed. Please proceed with these and track any DB changes made in the mapping doc https://docs.google.com/spreadsheets/d/15VRibnaglShF3oNNLMbiyGopTJrYbP02aQ04cz4Qt-k/edit#gid=1538544891 .
- No unique constraint on site_id for upsert consideration (on table tbl_site) --> please configure
- No unique constraint on external_id/household_id (on table tbl_household) --> please configure
- household_id is a string in state.json and is noted as a integer on database if I understand the output (on table tbl_sample). --> please change the data type/ configure as varchar as needed.
- No unique constraint on sample_id (on table tbl_sample). --> please configure
- table tbl_swm_transaction does not exist (2nd sheet). --> Use swm_transaction
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OpenFn/wcs-consocsci/issues/3#issuecomment-684493846, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCUBLNLHLGLUKHOXQ6JMB3SDSLUXANCNFSM4QGHLGAA .
-- Taylor Downs | Head of Product Open Function Group https://www.openfn.org/ | How Data Integration Makes ICT4D Work https://youtu.be/GVB9voGp6T4
Overview
WCS Wildmeat team wants to automatically sync Kobo data for its Rural Consumption survey Rural Consumption with a "Transitional Database", which they will later access to load data into an even more structured format. The destination database has a series of tables (i.e.,
tbl_site
,swm_transction
) that we will use as targets for the 'Rural Consumption' Kobo form. Note:Flow: Kobo survey --> Postgres DB
Job 1: Get Kobo data Trigger: Timer-based (every 3 hours)
OpenFn will fetch new 'Rural Consumption' surveys from Kobo Toolbox. To do this, send a GET request to the Kobo API (see api docs) using the openfn_kobo account, and filter by
end
date to request only submissions created since the last fetch.Post every Kobo form submission received in step #1 response back to the OpenFn inbox as an individual Message.
Job 2: Map Kobo data to Postgres _Trigger: Message filter --> use this
state.json
_Credentials: