OpenFn / wcs-wildmeat

Wildlife Conservation Society ConSocSci Project
1 stars 0 forks source link

tbl_wildmeat_market.sample_id is returning undefined in the database #30

Closed daissatou2 closed 2 years ago

daissatou2 commented 2 years ago

Describe the bug

tbl_wildmeat_market.sample_id is returning undefined in the database. See image below.

image

To Reproduce

  1. Here is a link to a failed run on OpenFn.org wihch is indicative of the bug: https://www.openfn.org/projects/p5yaxp/messages/061364bd-1000-72eb-bdbb-52facc55a1e8

expression.js

Link to the job itself in Github: https://github.com/OpenFn/wcs-wildmeat/blob/master/jobs/2.c.market.js

state.json

Postgres DB: See LP Wildmeat Postgres Transitional DB (WCS) https://www.openfn.org/projects/p5yaxp/messages/061364bd-1000-72eb-bdbb-52facc55a1e8

Expected behavior

There should be no undefined in the sample_id

To test/resolve

  1. After the desired output is working locally (from the CLI), please [push commits to master || open a pull request].
  2. [Please test the change on OpenFn.org by re-running this run (https://www.openfn.org/projects/p5yaxp/runs/06164212-25aa-7bb4-bb5a-b43a2ef4c4f4) and confirming success.]
lakhassane commented 2 years ago

@daissatou2 here the mappings for sample_id is as this: sample_id:${id}${xform_id_string}${sale['vendor/sales/othe_species']}${sale['vendor/sales/quantity']}${sale['vendor/sales/price']}, However, there is no path for othe_species and quantity. Should we just remove them from the mapping for sample_id?

lakhassane commented 2 years ago

@daissatou2 I made a change to just ignore undefined path. So we won't see undefined anymore. but I feel like the issue should be address in the message sent instead because now the sample_id generation is a bit random. We can chat about it whenever