Skip to content

Observation import: support attaching to an existing point by ID #1660

Description

@ClemRz

Summary

The current import pipeline always creates a new TPoint (or finds an existing one by label + cave). Allow attaching a new observation to an existing point by ID instead of only by label.

Current Behaviour

EntityBuilder.build() resolves a point by matching profile.pointLabel + profile.caveId. If no match is found, a new point is created. There is no way to pass an existing pointId directly.

Proposed Enhancement

Add an optional pointId field to the import profile:

{
  "pointId": 42,
  "caveId": 1,
  ...
}

When pointId is provided:

  1. ReferenceValidator verifies the point exists (TPoint.findOne({ id: pointId }))
  2. EntityBuilder uses that point directly (skips label-based resolution/creation)
  3. pointLabel becomes optional when pointId is present

Validation Rules

  • If both pointId and pointLabel are provided, pointId takes precedence
  • If pointId is provided, the point must exist (otherwise → IMPORT_REFERENCE_ERROR)
  • If the point has a cave FK, it should match profile.caveId (or warn)

Priority

Low — the current label-based resolution handles the common case. This is a convenience for users who want to attach multiple imports to a known point without risking label typos creating duplicates.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions