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:
BaseDomainDomain 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:
- async create(*, input: CreateObservationInput) CreateObservation[source]¶
Create an observation.
- Parameters:
input (CreateObservationInput) – The observation creation input.
- Returns:
The generated GraphQL response model.
- Return type:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- async update_by_id(observation_id: str, *, properties: ObservationPropertiesInput) UpdateObservationById[source]¶
Update a single observation by ID.
- Parameters:
observation_id (str) – The observation ID.
properties (ObservationPropertiesInput) – The properties to update.
- Returns:
The generated GraphQL response model.
- Return type:
- async update_by_reference(observation_reference: str, *, properties: ObservationPropertiesInput) UpdateObservationByReference[source]¶
Update a single observation by reference.
- Parameters:
observation_reference (str) – The observation reference label.
properties (ObservationPropertiesInput) – The properties to update.
- Returns:
The generated GraphQL response model.
- Return type: