Skip to content

Persist recorded sensor values with collision handling #2467

Description

@BelhsanHmida

Add the backend service and endpoint needed to validate and persist values recorded on a sensor graph, including values produced by recurrence expansion.

Acceptance criteria

  • Operate only on the sensor identified by the sensor page or endpoint.
  • Require the appropriate permission to create sensor data.
  • Validate event starts, values, resolution, timezone, and belief time.
  • Use the selected belief time, defaulting to the current time when none is supplied.
  • Allow values for the same event start when their belief times differ.
  • When an exact event-start and belief-time collision exists, preserve the existing belief.
  • Return a summary of values created, skipped because of collisions, and rejected.
  • Persist the batch atomically so partial failures do not leave an incomplete recording.
  • Reuse the recurrence-expansion function rather than implementing DST behavior in the route.

Tests

  • Successful single-value and batch recording.
  • Permission failure.
  • Same event start with a different belief time.
  • Exact collision where the existing belief wins.
  • Validation failure rolls back the full batch.

Out of scope

  • Graph recording controls.
  • Recurrence stored as schema rather than concrete beliefs.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions