Skip to content

6.5.2.6 ObservationSession

6.5.2.6.1 Purpose

A bounded activity on a subject, optionally with a device: a milking, weighing, feeding or sampling. It groups the observations produced together and records whether the activity succeeded.

6.5.2.6.2 Questions it answers

  • Which observations come from the same milking?
  • Was a milking refused, failed or incomplete?
  • Which device and which animal were involved?

6.5.2.6.3 Fields

Field Type Cardinality Description
id string (uuid) 1..1 Key.
session_type enum 1..1 Values: milking, weighing, feeding, sampling, other.
Sampling is the collection activity; Sample identifies the physical material and links its results.
animal Animal 0..1 Empty when the device could not identify the animal.
device Device 0..1
time ObservationTime 1..1
outcome enum 1..1 Values: success, refused, failed, incomplete, unknown.
e.g. a robot refusal (too early) or a failed attachment.
source_producer SourceProducerEntity 1..1
raw_metadata RawMetadata 0..1 Required unless computed by us; see lineage.
raw_locator string 0..1
source_record_key string 1..1 (source_feed, source_record_key) is the logical identity; uniqueness across history also includes revision number.
source_feed SourceFeed 1..1
content_hash string 1..1
status enum 1..1 Values: final, corrected, cancelled. Default: final.
Same rules as CanonicalObservation.status.
revision RecordRevision 1..1
product_material ProductMaterial 0..1 For collective milk sampling: material rather than an individual animal. Unknown subject remains explicitly unresolved.
ordinal_in_day integer 0..1 Session number in the day, 1-based, when the source gives only a date; a source that counts from 0 (AfiMilk sessions 0, 1, 2) is shifted by the adapter.
milk_destination enum 0..1 Values: tank, separated, calf_feed, discarded, unknown.
Only for session_type = milking: where the milk went. separated: kept apart from the tank (e.g. Lely M4Use, bucket); discarded: to the sewer. The quantity is the yield observation of the session.
milk_destination_reason CodedValue 0..1 The source's reason, with its code system (e.g. Lely LimMilkDestinationReasonType: MIS, MQC, Manual).
farm Farm 1..1 The farm of the feed that delivered the record (= source_feed.farm), copied here as the key of partitioning, row-level access and erasure; it never changes on a revision. See STORAGE.
created_at datetime 1..1
updated_at datetime 1..1

6.5.2.6.4 Relationships

References

Referenced by

Uses types

ObservationTime, RecordRevision, CodedValue

6.5.2.6.5 Rules & constraints

  • A bounded activity involving a subject, optionally a device: milking, weighing, feeding or manual sampling.
  • Milking is not an event: it is a session that groups observations.
  • A session with unresolved animal/material may remain as evidence; its measurements are not published with a fake subject.
  • Known pooled-milk sampling is not an unidentified animal session. animal and product_material cannot both be set.
  • Session source corrections follow RecordRevision; cross-feed duplicate preference must not alter its evidence.