Skip to content

ontology: add Dataset, DatasetQuery, MapLayer - #1178

Open
EgorPPS wants to merge 3 commits into
mainfrom
nlagromap/dataset-and-fieldlayer-ontologies
Open

EgorPPS wants to merge 3 commits into
mainfrom
nlagromap/dataset-and-fieldlayer-ontologies

Conversation

@EgorPPS

@EgorPPS EgorPPS commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Adds three agriculture-domain schemas used by nlagromap (agri map + AI imagery library). Checked all three ontology circles first (live registry /schemas, this repo, and the schema inventory) — none of these types exist yet, so they are newly minted. Schemas are auto-discovered by schemaId (services/ontology/src/index.js), so only the JSON files are added.

Schemas & ids

Title schemaId Purpose
Dataset 7d5a2c1e-6b3f-4c8a-9e21-0a1b2c3d4e5f Immutable snapshot of a curated set of files (images/annotations) for annotation or model training; references a manifest file (content-addressed via manifestSha256) and the DatasetQuery that produced it. References file URIs — does not copy blobs.
DatasetQuery 7d5a2c1e-6b3f-4c8a-9e21-0a1b2c3d4e60 The re-runnable selection criteria that produced a Dataset — stored separately so the same query can pull more data as the corpus grows.
FieldLayer 7d5a2c1e-6b3f-4c8a-9e21-0a1b2c3d4e61 A georeferenced raster analytics product per field (e.g. Soil Organic Matter, NDVI) an external service writes to the eVault as a GeoTIFF: layerType, acquiredAt, statistics, crs, bounds, fileRef → the raster blob, optional previewRef. Distinct from Observation (a point/footprint scan with photos).

All follow the existing conventions (draft-07, $id/schemaId, bitemporal schemaVersion/recordedAt/supersedes/deleted, w3ds:// ref patterns).

Naming is open to review — happy to rename (e.g. Dataset→Collection) or split layerType into its own catalog schema if preferred.

🤖 Generated with Claude Code

Dataset = immutable snapshot of curated files (images/annotations) referencing a
manifest file; DatasetQuery = the re-runnable selection criteria (stored separately
so the same query can pull more data as the corpus grows); FieldLayer = a
georeferenced raster analytics product per field (e.g. Soil Organic Matter, NDVI)
an external service writes to the eVault as a GeoTIFF.

Used by nlagromap (agri map + imagery library); share ids with annotation/training.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@EgorPPS
EgorPPS requested a review from coodos as a code owner September 29, 2026 20:02
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: ddc27263-f9cc-42df-91e6-2dfd77f735e3

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EgorPPS

EgorPPS commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Clarifications on FieldLayer, after checking the actual sample data (honesty fixes):

  1. Field link. The real producer payload only carries the service's own field_id (a UUID) — there is no reference to a field boundary object, and the GeoTIFF itself carries only geo-transform + CRS + nodata (no field/boundary reference). So fieldExternalId is the field link that actually exists; logicalFieldRef is optional, usable only once a field_id → LogicalField mapping exists (there is none in the sample). I'll re-word the schema so fieldExternalId is documented as the primary link and logicalFieldRef as the optional W3DS-native one.

  2. Do we even need a new type, vs reusing Observation+MediaAsset? Fair question raised in review. Both a robot photo and a crop-map GeoTIFF reference an external file via w3ds:// fileRef, so file-referencing is identical — that is not the distinction. One could model a crop map as an Observation (footprint = field extent) + a MediaAsset (fileRef → GeoTIFF) + ObservationAttributes.attributes = {layerType, statistics, crs}. A dedicated FieldLayer is proposed only for: (a) a typed home for layerType/statistics/crs/bounds instead of the free-form attributes bag; (b) a raster extent vs MediaAsset.geometry which is Point-only; (c) keeping analytic products out of the scan pipeline (Observation = a robot scan with crop/weeds; a crop map is not a scan). Holding this schema open pending the owner's call on new-type-vs-reuse.

…ayer)

Same schemaId (7d5a2c1e-…4e61). MapLayer covers raster (GeoTIFF/COG) AND vector
(point/line/polygon/many features, inline GeoJSON or fileRef), with a dataType
discriminator + conditional required fields (raster→fileRef+crs; vector→features|fileRef).
Subject link generalised from field-specific logicalFieldRef to subjectRef/subjectExternalId.
Domain geo (was agriculture) since it is not field-specific.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@EgorPPS EgorPPS changed the title ontology: add Dataset, DatasetQuery, FieldLayer (agriculture) ontology: add Dataset, DatasetQuery, MapLayer Sep 29, 2026
@EgorPPS

EgorPPS commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Generalised FieldLayer → MapLayer (same schemaId 7d5a2c1e-…4e61). Per discussion, made it a universal georeferenced layer instead of a field-only raster:

  • dataType: raster | vector, with a geometryType (point/line/polygon/multi*/collection) for vector.
  • Raster (GeoTIFF/COG): fileRef + crs required; plus bbox, nodata, statistics, format.
  • Vector: inline features (small GeoJSON) or fileRef (GeoJSON/GeoPackage/FlatGeobuf) required; featureCount.
  • Conditional requirements via allOf/if-then so each kind stays well-specified (not a free-form bag).
  • Subject link generalised: subjectRef (w3ds ref to a field/parcel/region/asset) + subjectExternalId — no longer field-specific. Domain changed agriculture → geo.
  • Common: layerType, acquiredAt, bbox4326 (map overlay), unit, statistics, style (render hints), previewRef, source.

The GeoTIFF crop-map (Soil Organic Matter) is just dataType:"raster". Naming (MapLayer) and domain (geo) open to the owner's preference.

frozen is implied — a Dataset is an immutable snapshot by definition, and
growing the corpus is DatasetQuery's job (re-run criteria -> new snapshot).
observationRefs duplicated the manifest (the single source of truth) and
risked drift; the manifest already lists all members, content-addressed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@andpuc23

andpuc23 commented Oct 6, 2026 •

Copy link
Copy Markdown

Amethyst (CVAT on W3DS) would like to use Dataset for annotated image datasets. Three requests:

  1. A third kind, e.g. "annotated": a set of image–annotation pairs. Each manifest row would carry an image ref (File envelope) or the ref of the ImageAnnotation that labels it (the annotation already holds imageRef). Today you have to pick images or annotations, and neither describes a training-ready labelled set.
  2. The manifestRef pattern ^w3ds://(@[^/\s]+)/([^/\s]+)$ rejects the URIs uploadFile produces (w3ds://file?id=@ename/, from evault-core buildFileUri). Could it accept both forms?
  3. Could you publish the manifest format? Then Datasets from nlagromap and Amethyst can be read by both apps (columns, encoding JSON/CSV, how manifestSha256 is computed).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants