Bulk Pack
Bulk Pack Processing v2
Field data schem
Ingestion Process by Entity Type
wallet_registration
Wallet registrations need to be stored in the field data schema in the wallet_registrations table, but they also need to be used to upsert (create or update) grower account records in the treetracker API. A wallet registration also needs the grower account id field populated.
Suggested workflow:
Bulk pack transformer calls PUT on grower_account in treetracker API for grower account with identifier that matches wallet
If account exists, update
Only update the name, phone, and email for now
device_configuration
device configuration records are simply inserted in v2, but in v1 they were upserted.
Suggested Workflow
POST device configuration payload to bulk-pack-transformer-1
bulk-pack-transformer-1 returns 200 if already present
POST device configuration payload to field data API
session does not exist in the v1 bulk-pack-transformer.
Suggested Workflow
POST to session path on field data API
field data API returns 200 if already present
POST capture data to bulk-pack-transformer-1
If data exists this API returns 200, else a new record is inserted
This API also propagates the record to field data API, where a queue message is emitted
Orchestration Diagram
Bulk Pack Format v2 :
Improved orchestration architecture
Deprecated proposal for orchestration
Nullable Columns for Field Data Tables
Session
Wallet Registration
phone or email is nullable, but not both
Raw Capture
session_id is nullable for v1 endpoints only
Device Configuration
Insert 'tree' as 'capture' will fail until corresponding device and registration records have been inserted, because there's no session Once device and registration records are inserted, then it is possible to insert a session id using SESSION UUID = device_identifier + planter_identifier In v2 bulk pack endpoint /v1/tree is responsible for ensuring that the session record exists for a v1 tree. This session can then be used as the session for inserting the v1 'tree' record as a v2 'capture' record
process sends tree record to /v1/tree in v2
v2 calculates SESSION UUID = device_identifier + planter_identifier using uuid-string
v2 checks for a session that matches this
Old versions:
greenstand/bulk-pack-processor:1.2.7
greenstand/bulk-pack-transformer:1.6.2