Examples › object database › Object library · stream board (proposal 4)

Object library · stream board (proposal 4)

Mix-first: a waste stream is the page. Its composition as bars and shares, an example object per type, and the objects sampled for that stream as 3D cards with their mass distribution and size scatter. One stream picker drives both .base files on the prototype page.

object databasecharttablepivot3 views of one mixes.json

The .base file and its data

Every tab above is one entry of this file; the views read these rows. ⋯ in the toolbar copies the current view as YAML.

# Proposal 4 · Mix-first ("the stream board"). A waste stream (a mix: types by composition, CONTRACT.md) is the page:
# its composition as bars, the share table with an example object per type, and, in objects.base beside this file,
# the sampled objects of that stream as 3D cards with their mass distribution. On the prototype page one stream picker
# drives both files' filters (a dashboard: what <data-dashboard> will do once that lane lands). The question it answers
# (Zach, Oct 15): a stream's mix and quick analysis, min/max weight, weight distribution, min/max size. New views.
# The public sample has one mix: RECYC-QUEBEC's published 2023-24 municipal audit, mapped onto the library's types.
# Check it: node bin/data-ui.mjs check gallery/examples/object-db-streams/views.base
data: ../object-db-shelf/mixes.json
facets:
  - { property: mix_name, as: select, label: Stream, dropdown: true }
properties:
  mix_name: { displayName: Stream }
  type: { displayName: Type }
  share: { displayName: Share }
  example: { displayName: Example object }
  objects_in_sample: { displayName: Objects sampled }
  typical_mass_g: { displayName: Typical mass }
views:
  - type: chart
    name: Composition
    chart:
      mark: { type: bar }
      encoding:
        y: { field: type, sort: "-x", title: null }
        x: { field: share, axis: { format: "%" }, title: "Share of the stream" }
        color: { field: mix_name, title: Stream }
    hover: { image: thumbnail, title: type, fields: [share, example, typical_mass_g, objects_in_sample] }
  - type: table
    name: Shares
    order: [type, share, example, objects_in_sample, typical_mass_g, mix_name]
    display: { share: bar, thumbnail: image }
    groupBy: { property: mix_name, direction: ASC }
    sort:
      - { property: share, direction: DESC }
  - type: pivot
    name: Streams × types
    splitBy: [mix_name]
    groupBy: { property: type, direction: ASC }
    value: { property: share, summary: Sum }
// ../object-db-shelf/mixes.json: 31 rows, 22 KB; the first 3
{
 "id": "bam-mixes",
 "title": "Mix compositions",
 "titleProperty": "type",
 "imageProperty": "thumbnail",
 "source": "RECYC-QUEBEC, Etude de caracterisation des matieres recyclables, centres de tri 2023-2024, municipal column (https://www.recyc-quebec.gouv.qc.ca/sites/default/files/documents/etude-caracterisation-centre-de-tri-2023-2024.pdf#page=15), mapped onto BAM's object types",
 "properties": {
  "share": {
   "type": "number",
   "decimals": 3
  },
  "mix_name": {
   "type": "text",
   "facet": "values"
  },
  "typical_mass_g": {
   "type": "number",
   "unitText": "g"
  },
  "objects_in_sample": {
   "type": "number",
   "decimals": 0
  },
  "thumbnail": {
   "type": "text",
   "media": "image",
   "hidden": true
  },
  "mesh": {
   "type": "text",
   "media": "mesh",
   "hidden": true
  },
  "mesh_view": {
   "type": "text",
   "hidden": true
  },
  "id": {
   "type": "text"
  },
  "mix": {
   "type": "text"
  },
  "basis": {
   "type": "text"
  },
  "measured": {
   "type": "boolean"
  },
  "type": {
   "type": "text"
  },
  "example": {
   "type": "text"
  }
 },
 "rows": [
  {
   "id": "recyc-quebec-municipal-2023:corrugated-cardboard",
   "mix": "recyc-quebec-municipal-2023",
   "mix_name": "Household recycling, Quebec municipal (RECYC-QUEBEC 2023-24 audit)",
   "basis": "mass",
   "measured": true,
   "type": "corrugated-cardboard",
   "share": {
    "value": 0.237,
    "basis": "measured",
    "note": "RECYC-QUÉBEC 2023-24, municipal column: \"Carton ondulé (OCC)\" 23.7% = 23.70%. Direct."
   },
   "typical_mass_g": 20.6,
   "objects_in_sample": 5,
   "example": "Google Cardboard kit box",
   "thumbnail": "thumbs/gso_google_cardboard_original_package.webp",
   "mesh": "meshes/gso_google_cardboard_original_package.glb",
   "mesh_view": {
    "dir": [
     0.9,
     0.8,
     1.1
    ],
    "fov": 30,
    "camera": "scan",
    "box": [
     0.0039,
     0.2188,
     0.9961,
     0.7695
    ]
   }
  },
  {
   "id": "recyc-quebec-municipal-2023:paper-sheet",
   "mix": "recyc-quebec-municipal-2023",
   "mix_name": "Household recycling, Quebec municipal (RECYC-QUEBEC 2023-24 audit)",
   "basis": "mass",
   "measured": true,
   "type": "paper-sheet",
   "share": {
    "value": 0.156,
    "basis": "measured",
    "note": "RECYC-QUÉBEC 2023-24, municipal column: \"Papier journal\" 1.5% + \"Publications et circulaires\" 3.6% + \"Bottins, catalogues\" 0.4% + \"Revues, magazines\" 1.3% + \"Papier à usage général/bureau\" 2.7% + \"Autres imprimés\" 2.6% + \"Livres\" 1.5% + \"Sacs d'emplettes de papier kraft\" 0.9% + \"Emballages de papier kraft\" 0.7% + \"Papier laminé\" 0.4% = 15.60%. Printed paper, books and kraft paper."
   },
   "typical_mass_g": 5,
   "objects_in_sample": 0,
   "example": null,
   "thumbnail": null,
   "mesh": null,
   "mesh_view": null
  },
  {
   "id": "recyc-quebec-municipal-2023:paperboard-box",
   "mix": "recyc-quebec-municipal-2023",
   "mix_name": "Household recycling, Quebec municipal (RECYC-QUEBEC 2023-24 audit)",
   "basis": "mass",
   "measured": true,
   "type": "paperboard-box",
   "share": {
    "value": 0.128,
    "basis": "measured",
    "note": "RECYC-QUÉBEC 2023-24, municipal column: \"Carton plat d'emballage (boxboard)\" 10.7% + \"Carton pressé\" 1.1% + \"Contenants composites\" 0.3% + \"Contenants laminés\" 0.3% + \"Autres emballages de papier\" 0.3% + \"Carton servant à présenter (non visé)\" 0.1% = 12.80%. Cereal-type boxboard and paper containers."
   },
   "typical_mass_g": 100,
   "objects_in_sample": 34,
   "example": "Apples to Apples Kids box",
   "thumbnail": "thumbs/gso_apples_to_apples_kids_edition.webp",
   "mesh": "meshes/gso_apples_to_apples_kids_edition.glb",
   "mesh_view": {
    "dir": [
     0.9,
     0.8,
     1.1
    ],
    "fov": 30,
    "camera": "scan",
    "box": [
     0.0039,
     0.1445,
     0.9961,
     0.8555
    ]
   }
  }
 ]
}
README.md
# Object library · stream board (proposal 4)

Mix-first: a waste stream is the page. Its composition as bars and shares, an example object per type, and the
objects sampled for that stream as 3D cards with their mass distribution and size scatter. One stream picker drives
both `.base` files on the prototype page.

- **App:** object database
- **Replaces:** `~/bam-waste-objects/views/composition.html` (object-db composition) and FiftyOne's saved views per mix
- **Shows:** chart (Vega-Lite bars, histogram, scatter with hover card), table with share bars, pivot (streams × types), cards with `mesh:` (3D on click)
- **Data:** `../object-db-shelf/mixes.json` (10 mixes' composition rows, from the mixes' `## Composition` tables) and `objects.json` (a 409-object sample); built by `../object-db-shelf/source/build.py`
- **Prior art:** Greyparrot Analyzer's composition dashboards, AMP Cortex's material breakdowns, waste-audit reports (RECYC-QUÉBEC 2023-24), Zach's own composition.html

The original UI it replaces

~/bam-waste-objects/views/composition.html (object-db composition) and FiftyOne's saved views per mix

What it shows

chart (Vega-Lite bars, histogram, scatter with hover card), table with share bars, pivot (streams × types), cards with mesh: (3D on click)

Data

../object-db-shelf/mixes.json (10 mixes' composition rows, from the mixes' ## Composition tables) and objects.json (a 409-object sample); built by ../object-db-shelf/source/build.py