# OIP-0013: MOBILE profile: platforms and trajectories

| Field | Value |
|---|---|
| Status | DRAFT |
| Functions | `describe` (§5.3), `time` (§5.4), `observe` (§5.5), `qualify` (§5.6); no new function (the register keeps exactly twelve) |
| Affects | §4.2, §7.1, new §7.4; new schemas `platform` and `trajectory`; `registers/conformance-profiles.yaml` (new profile `OBSP-MOBILE`); `registers/functions.yaml` (`describe` objects gain `platform` and `trajectory`, `time` objects gain `trajectory`); `registers/relations.yaml` (new `EXT-CF`, `EXT-OGCMF`, `EXT-PLATFORMIDS`); new crosswalks `crosswalks/cf-trajectory.yaml` and `crosswalks/moving-features.yaml`; `conformance/suite.yaml`; the profile enumerations of `conformance-claim`, `conformance-report` and `participant-manifest` (additive); new cases CT-MOBILE-001 to CT-MOBILE-006 |
| Protocol version | obsp/0.1 |
| Work packages | WP-PR-05 (frontier profiles: mobile), WP-IM-08 (moving features) |
| Requires | OIP-0006 (universal observation: `deploymentRef` on the observation record, `platformRef` on the deployment, the subject class rule for `PERSONS`). Acceptance order: OIP-0006 first, then this proposal (after OIP-0012 if both are accepted, so its section is §7.4; accepted before OIP-0012 it becomes §7.3). The patches here apply to the current tree on their own and do not depend on OIP-0006's files: the new objects are self-contained and reach OIP-0006 objects by UNI fields only |
| Last call | 30 days (new profile and objects, additive) unless the editors rule otherwise |

## Problem

OIP-0006 locates an observation by a geometry and its observer by a deployment at a site. That suffices for a mast;
it does not for an observer that moves:

1. an Argo float, a ship, a drone, an aircraft, a spacecraft or a person carries the observer, and the position at
   the phenomenon time is the platform's position, which changes between observations;
2. platforms have public identifiers (MMSI, ICAO 24-bit address, IMO number, WMO float number, COSPAR designator,
   satellite catalogue number) that receivers use to join data, but nothing types or checks them;
3. a track can be out of order, carry a position that jumps further than the platform can move, or lack the vertical
   datum of its heights, and no receiver can tell;
4. a track of a person-carried device singles out a person, and a track under a vessel or aircraft identifier singles
   out that vehicle, but nothing makes the track carry the subject class that OIP-0006 defines;
5. trajectories are exchanged as CF-netCDF trajectories or OGC Moving Features, and the protocol has no mapping to
   either.

## Change

### Normative text

A new §7.4 "Mobile profile (`OBSP-MOBILE`)" with requirements MOB-1 to MOB-6 in an id table and the table of platform
kinds (full text in `patches/spec.patch`); §4.2 gains the row `Platform, Trajectory | platform, trajectory | Describe,
Time, Observe`; §7.1 gains the profile row. In short:

1. **MOB-1 (Observe).** A record made on a platform whose kind is not `FIXED` (its OIP-0006 deployment names the
   platform) MUST lie within a trajectory segment of that platform: a Trajectory whose period, and first and last
   points, cover the phenomenon time.
2. **MOB-2 (Time).** Points MUST be in strictly increasing time (RFC 3339 with offset) and within the period, which ends
   after it starts.
3. **MOB-3 (Qualify).** The speed implied by consecutive points, less their position uncertainties, and every reported
   speed MUST NOT exceed the maximum of the platform's kind (table) or the platform's declared maximum; a declared
   maximum above the kind's MUST reference a justification.
4. **MOB-4 (Describe).** A Platform MUST state its kind and SHOULD give its public identifiers; each MUST be well formed
   for its scheme, of a scheme allowed for the kind, once per scheme; an IMO number MUST pass its check digit.
5. **MOB-5 (Describe).** A Trajectory MUST name its platform by UNI and digest, a geographic CRS by OGC definition URI
   with longitude and latitude named per point, the vertical datum of any height and its positioning source, and MUST
   carry at least two points or one coverage reference to a long track by URI and digest.
6. **MOB-6 (Observe).** Positions of a `PERSON_CARRIED` platform MUST be `PERSONS` with a consent or policy URI (the
   OIP-0006 OBS-4 rule); positions under `MMSI`, `ICAO24` or `IMO` MUST be `OBJECTS` or higher; a
   trajectory MUST NOT exceed its platform's class; a record made on a `PERSON_CARRIED` platform MUST be `PERSONS`.

Platform kinds (§7.4 table, also `PLATFORM_KINDS` in `obsp/mobile.py`; a unit test fails when the two differ):

| Kind | Maximum speed (m/s) | Identifier schemes |
|---|---|---|
| `FIXED` | 0.1 | `MMSI` |
| `MOBILE_GROUND` | 100 | none |
| `AIRBORNE` | 350 | `ICAO24`, `MMSI` |
| `VESSEL` | 30 | `MMSI`, `IMO` |
| `FLOAT` | 3 | `WMO_FLOAT`, `MMSI` |
| `SPACECRAFT` | 12000 | `COSPAR`, `NORAD` |
| `HAPS` | 60 | `ICAO24` |
| `PERSON_CARRIED` | 12 | none |

The maximums are plausibility bounds chosen so that a correct track never fails, not performance figures. Distances are
haversine great-circle distances on the mean Earth sphere (radius 6 371 008.8 m), scaled to the points' mean height,
with the height difference added in quadrature.

Names follow the repository's conventions: enumerations in upper case (`MOBILE_GROUND`, `PERSON_CARRIED`, `DEAD_RECKONING`),
the platform's kind under `platformKind` because `kind` is the envelope's object kind, the WMO float number as scheme
`WMO_FLOAT` and the satellite catalogue number as `NORAD`.

### Contract: `platform` (schemaVersion `3.1.0`, `$id` `urn:obsp:schema:v3.1:platform`)

| Property | Required | Shape |
|---|---|---|
| envelope | yes | `3.1.0`, `obsp/platform/v3.1`, `Platform`, `obsp/0.1` |
| `platformUni`, `version` | yes | UNI, record version |
| `platformKind` | yes | `FIXED`, `MOBILE_GROUND`, `AIRBORNE`, `VESSEL`, `FLOAT`, `SPACECRAFT`, `HAPS`, `PERSON_CARRIED` |
| `externalIds` | no (SHOULD) | `{scheme, value}`: `MMSI` nine digits; `ICAO24` six upper-case hexadecimal digits; `IMO` seven digits; `WMO_FLOAT` seven (or five) digits; `COSPAR` `YYYY-NNNA`; `NORAD` up to nine digits |
| `maxSpeed`, `maxSpeedRef` | no | m/s, positive; `{uri, digest}` |
| `subjectClass` | yes | `NONE`, `OBJECTS`, `PERSONS`; `PERSONS` for `PERSON_CARRIED`; `subjectPolicyRef` `{uri, digest?}` required for `PERSONS` |
| `operatorUni`, `recordedAt` | yes | participant UNI by role; RFC 3339 |

### Contract: `trajectory` (schemaVersion `3.1.0`, `$id` `urn:obsp:schema:v3.1:trajectory`)

| Property | Required | Shape |
|---|---|---|
| envelope | yes | `3.1.0`, `obsp/trajectory/v3.1`, `Trajectory`, `obsp/0.1` |
| `trajectoryUni`, `version` | yes | UNI, record version |
| `platformRef` | yes | `{uni, version?, digest}` of a `platform` |
| `crs` | yes | OGC CRS84, CRS84h, EPSG 4326 or EPSG 4979 definition URI |
| `verticalDatum` | when any point has `z` | OGC definition URI of a vertical CRS or datum |
| `source` | yes | `GNSS`, `INS`, `GNSS_INS`, `DEAD_RECKONING`, `AIS`, `ADSB`, `ACOUSTIC`, `NETWORK` |
| `period` | yes | `{start, end}` |
| `points` or `coverageRef` | exactly one | points (two or more) `{t, lon, lat, z?, heading?, speed?, positionUncertainty?}`; coverage `{uri, digest, format (CF_NETCDF, MF_JSON, CSV), pointCount}` |
| `subjectClass`, `subjectPolicyRef` | yes; policy for `PERSONS` | as on the platform |
| `provenanceRef`, `extensions` | no | as elsewhere |
| `operatorUni`, `recordedAt` | yes | participant UNI by role; RFC 3339 |

Points are objects with named `lon` and `lat`, so the axis order of the CRS cannot be confused (OIP-0006 OBS-6);
`positionUncertainty` is a horizontal standard uncertainty in metres (OIP-0006 QUAL-1). The observation record is not
changed: the link from an observation to its trajectory goes through its deployment (`deploymentRef` → deployment
`platformRef` → trajectory `platformRef`). A direct `trajectoryRef` on the observation is an open question.

### Profile

`OBSP-MOBILE` in `registers/conformance-profiles.yaml`: functions `describe`, `time`, `observe`, `qualify`; it extends
no profile. `conformance/suite.yaml` lists it; the Makefile runs its example set (`conformance/examples/OBSP-MOBILE/`:
an Argo float, a research vessel tracked by AIS, a survey drone and an aircraft with AMDAR-style reports, each with its
trajectory). The three profile enumerations gain the id (additive).

### Invariants (suite module `sdk/python/src/obsp/mobile.py`, merged into the suite's table; unit tests in `sdk/python/tests/test_mobile.py`)

| Invariant | Rule |
|---|---|
| `platform-external-ids` | scheme allowed for the kind, one identifier per scheme, IMO check digit, declared maximum above the kind's only with `maxSpeedRef` (MOB-4, MOB-3) |
| `trajectory-links-platform` | `platformRef` names a platform in the set, by UNI and its RFC 8785 digest (MOB-5) |
| `trajectory-time-ordered` | points strictly increasing as instants, inside the period; the period ends after it starts (MOB-2) |
| `trajectory-speed-plausible` | no leg (distance less both uncertainties, over the time step) and no reported speed above the platform's maximum (MOB-3) |
| `mobile-observation-located` | a record whose OIP-0006 deployment names a non-fixed platform lies within a trajectory of it (period and end points cover the instant or interval) (MOB-1) |
| `trajectory-subject-class` | person-carried positions `PERSONS` with policy, identified vehicles `OBJECTS` or higher, no trajectory above its platform, records on a person-carried platform `PERSONS` (MOB-6) |

### Crosswalks and relations

`crosswalks/cf-trajectory.yaml` (CF Conventions, edition CF-1.11, discrete sampling geometries, feature type
trajectory) and `crosswalks/moving-features.yaml` (OGC 19-045r3, Moving Features JSON encoding 1.0, with ISO 19141:2008
as the conceptual model) cover `trajectory`; every required property has a row. Neither standard was opened for this
draft: every row says `checked: not checked`, and clauses are cited by number (CF) or by object name (Moving
Features). Envelope, versioning, operator and subject class fields are `match: none` with the reason. Examples:
`crosswalks/examples/cf-trajectory/` (the vessel trajectory and its CDL) and `crosswalks/examples/moving-features/`
(the same trajectory as a MovingFeature with a MovingPoint). Relation rows `EXT-CF` and `EXT-OGCMF` name the files;
`EXT-PLATFORMIDS` cites the identifier schemes. `implements-edges.json` is regenerated (44 edges).

## Compatibility

Additive: two new objects, a new profile, two crosswalks and three enumerations that gain a value. No existing record
changes. MOB-1 and the record part of MOB-6 read OIP-0006 fields (`deploymentRef`, deployment `platformRef`,
`phenomenonTime`, `subjectClass`); until OIP-0006 is accepted no record has them and those checks find nothing to
check, so the patches apply and pass on the current tree.

Draft interplay: the invariants and their tests are new files (`obsp/mobile.py`, `test_mobile.py`) joined to the
suite by three lines placed away from the lines other drafts edit, and the §4.2 row, the `functions.yaml` objects and
the relation rows sit where no other draft's patch has context. With these patches applied, the patches of OIP-0001,
OIP-0005, OIP-0006, OIP-0007 and OIP-0008 still apply except two hunks: the generated `"count"` of
`registers/implements-edges.json` (OIP-0005, OIP-0006 and OIP-0008 `registers.patch`), regenerated by the proposal
accepted second (`python3 tools/build_edges.py`, as for `registers/requirements.yaml`), and the one-line change to
`tests/test_validate.py` (the crosswalk count) that OIP-0006 `cases-invariants.patch` makes identically, so the second
of the two drops that hunk. OIP-0012 adds a profile at the same lines (profile register, suite, Makefile `PROFILES`, the
three enumerations, §7.1, §7.3/§7.4), so whichever of the two is accepted second is rebased on the first. The round-trip
method of `crosswalks/README.md` is fixed by OIP-0006 (its first crosswalks); the examples here keep every `exact` and
`both` field.

## Tests

| Requirement | Case | Kind | Evidence and invariants |
|---|---|---|---|
| MOB-4 | CT-MOBILE-001 | invariant | `platform`; `platform-external-ids` |
| MOB-5 | CT-MOBILE-002 | invariant | `trajectory`, `platform`; `trajectory-links-platform` |
| MOB-2 | CT-MOBILE-003 | invariant | `trajectory`; `trajectory-time-ordered` |
| MOB-1 | CT-MOBILE-004 | invariant | `trajectory`, `platform`; `mobile-observation-located` |
| MOB-3 | CT-MOBILE-005 | invariant | `trajectory`, `platform`; `trajectory-speed-plausible` |
| MOB-6 | CT-MOBILE-006 | invariant | `trajectory`, `platform`; `trajectory-subject-class` |

Positive fixtures: `platform.` `valid` (Argo float), `vessel` (MMSI, IMO), `aircraft` (ICAO 24-bit address), `drone` (declared maximum speed), `person-carried` (`PERSONS` with policy), `spacecraft` (COSPAR, catalogue
number); `trajectory.` `valid` (Argo float surfacing positions over three cycles), `vessel-ais`, `drone-survey` (heights
with vertical datum), `aircraft-amdar` (AMDAR-style ascent reports), `person-carried`, `long-track-coverage` (a
CF-netCDF track by digest).

Negative fixtures, one broken rule each: `platform.` `unknown-kind`, `mmsi-not-nine-digits`, `icao24-not-hex`,
`imo-not-seven-digits`, `wmo-float-malformed`, `cospar-malformed`, `unknown-scheme`, `person-carried-not-persons`,
`persons-without-policy`, `missing-subject-class`, `zero-max-speed`; `trajectory.` `points-and-coverage`,
`no-points-no-coverage`, `one-point`, `z-without-vertical-datum`, `lat-out-of-range`, `lon-out-of-range`,
`projected-crs`, `unknown-source`, `point-time-without-offset`, `persons-without-policy`, `negative-speed`,
`heading-out-of-range`, `missing-platform-ref`, `coverage-without-digest`, `missing-period`. Rules the schema cannot
express (time order, speed, check digits, scheme by kind, set membership, subject class across records) are proved by
27 unit tests, including the spec-table check, one that runs the profile on the example set (PASS, report valid against
`conformance-report`) and one that runs it on a broken copy and sees only CT-MOBILE-005 fail.

`tests/test_validate.py`: the crosswalk-layout test counts the shipped crosswalks instead of assuming none (the same
edit as OIP-0006).

## Open questions

Revision (editors, owner decision): the radio call sign is not an identifier scheme of this proposal. A call sign can
identify a person (amateur stations), and no scheme of `registers/external-id-schemes.yaml` (OIP-0016) covers it; the
`CALL_SIGN` scheme, its pattern, its rows in the MOB-4 table and the call signs of the fixtures and examples are
removed, and the digests that pinned the changed platforms are moved.

1. Should OIP-0006 give the observation record a direct `trajectoryRef` (`{uni, version, digest}` with an optional
   segment interval), so a record names its track without resolving its deployment? It is additive on top of OIP-0006;
   this draft does not touch the observation record so that it stays independent of OIP-0006's files.
2. The maximum speeds are this proposal's own plausibility bounds, not taken from any standard. Are 12 m/s for a
   person-carried device (a person in a vehicle exceeds it) and 3 m/s for a float right, or should person-carried
   devices declare their maximum?
3. Identifier formats are cited from memory and not checked: MMSI nine digits (ITU-R M.585), ICAO 24-bit address as six
   hexadecimal digits (ICAO Annex 10, Volume III), IMO number seven digits with a weighted check digit (IMO ship
   identification number scheme), Argo WMO numbers of seven digits (five for older platforms), COSPAR designator
   `YYYY-NNNA`, catalogue numbers up to nine digits. The scheme-by-kind table is this proposal's own.
4. CF: the edition CF-1.11 and its clause numbers (2.6.2, 3.3, 3.4, 4.1 to 4.4, 5.6, 9.2, 9.4, 9.5, Appendices C, F and
   H.4) and the standard names `platform_id`, `platform_course` and `platform_speed_wrt_ground` were not opened. Should
   the crosswalk cite a later edition?
5. OGC Moving Features: OGC 19-045r3 (JSON encoding, 1.0) and ISO 19141:2008 were not opened; member names (`temporalGeometry`,
   `datetimes`, `interpolation`, `temporalProperties`, `time`, `crs`) are cited from memory. Should the crosswalk also
   cover OGC API - Moving Features?
6. Should `trajectory` accept projected or Earth-centred CRSs (for spacecraft, an Earth-centred Earth-fixed frame) with
   `x`, `y`, `z`, instead of geographic coordinates only?
7. A float's underwater positions are unknown between surfacings; should the trajectory mark interpolated positions
   explicitly (a per-point `interpolated` flag), as Argo trajectory files do?

Acceptance needs appointed editors and a last-call window. Until then this proposal stays at DRAFT.
