Observation

The observation domain provides access to observation queries, mutations, and subscriptions.

Use observation to create, retrieve, update, delete, restore, clone, and subscribe to observations.

Quick Example

async with GPPClient() as client:
   observation = await client.observation.get_by_id("o-123")

Creating and Cloning

Create an observation:

result = await client.observation.create(input=create_input)

Clone an observation:

result = await client.observation.clone(input=clone_input)

Both methods return generated GraphQL response models.

Retrieving Observations

Get a single observation by ID:

result = await client.observation.get_by_id("o-123")

Get a single observation by reference:

result = await client.observation.get_by_reference("GN-2026A-Q-1-1")

Get multiple observations:

result = await client.observation.get_all(
   include_deleted=False,
   where=where_input,
   limit=50,
)

Updating Observations

Update a single observation by ID:

result = await client.observation.update_by_id(
   "o-123",
   properties=properties,
)

Update a single observation by reference:

result = await client.observation.update_by_reference(
   "GN-2026A-Q-1-1",
   properties=properties,
)

Update multiple observations:

result = await client.observation.update_all(input=bulk_update_input)

Delete and Restore

Delete an observation by ID:

result = await client.observation.delete_by_id("o-123")

Delete an observation by reference:

result = await client.observation.delete_by_reference("GN-2026A-Q-1-1")

Restore an observation by ID:

result = await client.observation.restore_by_id("o-123")

Restore an observation by reference:

result = await client.observation.restore_by_reference("GN-2026A-Q-1-1")

Subscriptions

Subscribe to observation edit events:

async for event in client.observation.subscribe_to_edits():
   print(event)

Restrict the subscription to a program:

async for event in client.observation.subscribe_to_edits(
   program_id="p-123"
):
   print(event)

Subscribe to observation calculation updates:

async for event in client.observation.subscribe_to_calculation_updates():
   print(event)

Notes

All observation operations use GraphQL and return generated response models.

Subscription methods return asynchronous iterators.

API Reference

class gpp_client.domains.observation.ObservationDomain(*, graphql: GraphQLClient, rest: RESTClient, settings: GPPSettings)[source]

Bases: BaseDomain

Domain class for observation-related operations.

async clone(*, input: CloneObservationInput) CloneObservation[source]

Clone an observation.

Parameters:

input (CloneObservationInput) – The clone observation input.

Returns:

The generated GraphQL response model.

Return type:

CloneObservation

async create(*, input: CreateObservationInput) CreateObservation[source]

Create an observation.

Parameters:

input (CreateObservationInput) – The observation creation input.

Returns:

The generated GraphQL response model.

Return type:

CreateObservation

async delete_by_id(observation_id: str) DeleteObservationById[source]

Delete an observation by ID.

Parameters:

observation_id (str) – The observation ID.

Returns:

The generated GraphQL response model.

Return type:

DeleteObservationById

async delete_by_reference(observation_reference: str) DeleteObservationByReference[source]

Delete an observation by reference.

Parameters:

observation_reference (str) – The observation reference label.

Returns:

The generated GraphQL response model.

Return type:

DeleteObservationByReference

async get_all(*, include_deleted: bool = False, where: WhereObservation | None = None, offset: str | None = None, limit: int | None = None) GetObservations[source]

Get observations matching the provided filters.

Parameters:
  • include_deleted (bool, default=False) – Whether to include deleted observations.

  • where (WhereObservation | None, optional) – Optional observation filter.

  • offset (str | None, optional) – Optional pagination offset.

  • limit (int | None, optional) – Optional page size limit.

Returns:

The generated GraphQL response model.

Return type:

GetObservations

async get_by_id(observation_id: str) GetObservation[source]

Get an observation by ID.

Parameters:

observation_id (str) – The observation ID.

Returns:

The generated GraphQL response model.

Return type:

GetObservation

async get_by_reference(observation_reference: str) GetObservation[source]

Get an observation by reference.

Parameters:

observation_reference (str) – The observation reference label.

Returns:

The generated GraphQL response model.

Return type:

GetObservation

async restore_by_id(observation_id: str) RestoreObservationById[source]

Restore an observation by ID.

Parameters:

observation_id (str) – The observation ID.

Returns:

The generated GraphQL response model.

Return type:

RestoreObservationById

async restore_by_reference(observation_reference: str) RestoreObservationByReference[source]

Restore an observation by reference.

Parameters:

observation_reference (str) – The observation reference label.

Returns:

The generated GraphQL response model.

Return type:

RestoreObservationByReference

async subscribe_to_calculation_updates(*, program_id: str | None = None) AsyncIterator[ObsCalculationUpdate][source]

Subscribe to observation calculation update events.

Parameters:

program_id (str | None, optional) – Restrict the subscription to a program ID.

Yields:

ObsCalculationUpdate – Observation calculation update events.

async subscribe_to_edits(*, program_id: str | None = None) AsyncIterator[ObservationEdit][source]

Subscribe to observation edit events.

Parameters:

program_id (str | None, optional) – Restrict the subscription to a program ID.

Yields:

ObservationEdit – Observation edit events.

async update_all(*, input: UpdateObservationsInput) UpdateObservations[source]

Update observations using a bulk update input.

Parameters:

input (UpdateObservationsInput) – The bulk update input.

Returns:

The generated GraphQL response model.

Return type:

UpdateObservations

async update_by_id(observation_id: str, *, properties: ObservationPropertiesInput) UpdateObservationById[source]

Update a single observation by ID.

Parameters:
Returns:

The generated GraphQL response model.

Return type:

UpdateObservationById

async update_by_reference(observation_reference: str, *, properties: ObservationPropertiesInput) UpdateObservationByReference[source]

Update a single observation by reference.

Parameters:
Returns:

The generated GraphQL response model.

Return type:

UpdateObservationByReference