Skip to the page
Docs menu

Docs Use cases

Vessel export

Tally breakbulk logs for a vessel: scan each load at the port, place loads in rows, then assign them to the vessel's holds or deck, with a total for the whole vessel.

Used in steps 1–3: Create, Scan, Sync. For port operators, stevedores and exporters loading logs as breakbulk. By the end, your voyage record has a tally for each load and hold and a total for the vessel.

The phone always scans into a load. Logs are scanned into loads at the port; your system places the loads in rows in the port yard; when a load goes aboard, your system assigns it to a hold or to the deck. Rows, holds and the deck are groups your system creates and moves loads between (parent_id): nobody scans into a hold. A parent's summary includes its children, so a hold and the vessel carry their loads' totals. Nesting goes at most 4 deep (Nesting). A load's tally arrives as it is scanned, and a load can move to another parent at any time.

This page tallies logs. Lumber and panels in bundles: Lumber and panels, What is available.

1. Create#

When your backend opens the voyage, it creates the vessel group:

TypeScript
const timbereye = new Timbereye() // reads TIMBEREYE_SECRET_KEY
const vessel = await timbereye.groups.create({ kind: "vessel", externalRef: "voy_0912", name: "MV Example" })
curl
curl https://api.timbereye.com/v1/groups \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "vessel", "external_ref": "voy_0912", "name": "MV Example" }'
CLI
timbereye groups create --kind vessel --external-ref voy_0912 --name "MV Example" --json
JSON
{
    "id": "grp_2Vs8Hk",
    "object": "group",
    "kind": "vessel",
    "name": "MV Example",
    "external_ref": "voy_0912",
    "parent_id": null
}

Then one group per hold (and one for the deck, if loads go there), under the vessel, and keep each id on your own record. Hold 1:

TypeScript
const hold = await timbereye.groups.create({
    kind: "vessel_hold",
    externalRef: "voy_0912-h1",
    name: "Hold 1",
    parentId: "grp_2Vs8Hk",
})
curl
curl https://api.timbereye.com/v1/groups \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "vessel_hold", "external_ref": "voy_0912-h1", "name": "Hold 1", "parent_id": "grp_2Vs8Hk" }'
CLI
timbereye groups create --kind vessel_hold --external-ref voy_0912-h1 --name "Hold 1" \
  --parent grp_2Vs8Hk --json
JSON
{
    "id": "grp_6Ht1Qa",
    "object": "group",
    "kind": "vessel_hold",
    "name": "Hold 1",
    "external_ref": "voy_0912-h1",
    "parent_id": "grp_2Vs8Hk"
}

Rows at the port are groups too, if your system tracks them (kind: "yard_row"). Each load is a group your backend creates when the load is planned, or a clerk opens from the phone by load number with POST /groups/open:

TypeScript
const load = await timbereye.groups.create({
    kind: "load",
    externalRef: "load_3307",
    name: "Load 3307",
    defaults: { species: "PINE_TAEDA", length: { valueM: 5.8 } },
})
curl
curl https://api.timbereye.com/v1/groups \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "load", "external_ref": "load_3307", "name": "Load 3307",
        "defaults": { "species": "PINE_TAEDA", "length": { "value_m": 5.8 } } }'
CLI
timbereye groups create --kind load --external-ref load_3307 --name "Load 3307" \
  --species PINE_TAEDA --length 5.8m --json
JSON
{
    "id": "grp_9Ld3Wp",
    "object": "group",
    "kind": "load",
    "name": "Load 3307",
    "external_ref": "load_3307",
    "parent_id": null
}

2. Scan#

The tally clerk scans each load at the port with the Timbereye app or your own app. A log scanned into the wrong load moves with timbereye.groups.items.add(rightLoadId, { itemIds }). Each sitting uploads and is refined on the server. The clerk can also add photos of the load and its draft-survey weight in the app (Photos and weights).

Where the load goes next is your system's logic. Placing it in a row, and later assigning it to a hold or the deck as it goes aboard, is a change of its parent:

TypeScript
await timbereye.groups.update("grp_9Ld3Wp", { parentId: "grp_6Ht1Qa" })
curl
curl -X PATCH https://api.timbereye.com/v1/groups/grp_9Ld3Wp \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "parent_id": "grp_6Ht1Qa" }'
CLI
timbereye groups update grp_9Ld3Wp --parent grp_6Ht1Qa --json
JSON
{ "id": "grp_9Ld3Wp", "object": "group", "kind": "load", "parent_id": "grp_6Ht1Qa" }

3. Sync#

Each load sends its own group.measured when a sitting's logs are refined, and again with a higher revision whenever its tally changes (a later sitting, a log moved in or out). A load's group.measured does not roll up to its hold or the vessel. Each group's tally counts only the logs directly in it, never those in child groups, so a hold's or the vessel's own group.measured counts nothing here. On each load's event, write the load, then re-read its hold and the vessel for their totals:

TypeScript
if (event.type === "group.measured" && event.data.object.kind === "load") {
    const tally = event.data.object
    await db.loads.update(tally.externalRef, {
        pieces: tally.pieces,
        m3: tally.volume?.m3,
        revision: tally.revision,
    })
    const load = await timbereye.groups.retrieve(tally.groupId)
    if (load.parentId) {
        const hold = await timbereye.groups.retrieve(load.parentId)
        const vessel = await timbereye.groups.retrieve(hold.parentId!)
        await db.holds.update(hold.externalRef, { logs: hold.summary.items, m3: hold.summary.volume?.m3 })
        await db.voyages.update(vessel.externalRef, {
            logs: vessel.summary.items,
            m3: vessel.summary.volume?.m3,
        })
    }
}

Your voyage record afterwards:

JSON
{ "id": "voy_0912", "logs": 1412, "m3": 448.2 }

Example figures. The API calls a log an item, so counts are under summary.items. A load that is not in a hold has no parent to re-read; write the load only. See Stay in sync.

What you get back#

  • A tally per load (each revision), the total of each hold and of the deck, and the vessel total: logs, refined counts, volume (JAS).
  • With a weight from a draft survey (timbereye.groups.setWeight), net kg and density as a cross-check. See Photos and weights.
  • Every log with its measurements and photos: Read logs, volume and photos.

Not supported#

  • No hold-level or vessel-level event carrying the whole vessel's total: re-read the vessel group as above.
  • No breakdown by species or grade in the summary. List a load's logs (timbereye.groups.items.list(id, { species })) and total them yourself.
  • No stowage plan, mate's receipt or bill of lading. Volume under JAS only.