API referenceovok_sdk.resources

ovok_sdk.resources.measurement_services

Per-type rules that turn a measurement into Observation details and show it as text.

  • Stable unknown
  • Release candidate not available
  • Development since 0.2.0-dev.36+f12b151

Per-type rules that turn a measurement into Observation details and show it as text.

MeasurementField

MeasurementField(
    key: str,
    code: str,
    display: str,
    unit: str,
    decimals: int,
    additional_codes: tuple[str, ...] = (),
)

One value of a measurement and how its Observation stores it.

Attributes

NameTypeDescription
keystrThe value's key on the measurement, in snake_case.
codestrCode of the Observation that carries it.
displaystrDisplay name of that code.
unitstrUnit the value is stored in.
decimalsintDecimal places the value is rounded to.
additional_codestuple[str, ...]Further codes of the same Observation.

concept()

concept() -> Resource

Return the Observation code as a CodeableConcept.

Returns

  • Resource: The concept, primary code first.

service_for()

service_for(type_key: str) -> _FieldService

Return the rules for a measurement type.

Parameters

NameTypeDefaultDescription
type_keystrThe measurement type, such as "blood-pressure".

Returns

  • _FieldService: The type's service.

Raises

  • OvokValidationError: The SDK cannot save this type.

ucum_quantity()

ucum_quantity(value: int | float, unit: str) -> Resource

Return a quantity in unit, coded in UCUM when the unit has a UCUM code.

Parameters

NameTypeDefaultDescription
valueint | floatThe value.
unitstrThe display unit, such as "mmHg"; empty for none.

Returns

  • Resource: The FHIR Quantity.

sampled_data()

sampled_data(samples: list[Any], decimals: int) -> str

Return SampledData's space-separated values; a sample with no value is E.

Parameters

NameTypeDefaultDescription
sampleslist[Any]The values.
decimalsintDecimal places each value is rounded to.

Returns

  • str: The data string.

read()

read(mapping: Resource | None, snake: str) -> Any

Return a value by its snake_case key, or by the camelCase one.

Parameters

NameTypeDefaultDescription
mappingResource | NoneWhere to look; None reads as empty.
snakestrThe snake_case key.

Returns

  • Any: The value, or None.

camel()

camel(value: str) -> str

Return a snake_case key in camelCase.

Parameters

NameTypeDefaultDescription
valuestrThe snake_case key.

Returns

  • str: The camelCase key.

parse_date()

parse_date(value: Any) -> datetime | None

Return a datetime for a datetime, date or ISO string; naive values are UTC.

Parameters

NameTypeDefaultDescription
valueAnyThe value.

Returns

  • datetime | None: The datetime, or None when the value is no date.

iso()

iso(value: datetime | date | str) -> str

Return a time as UTC ISO 8601 with milliseconds; an unparseable string is kept.

Parameters

NameTypeDefaultDescription
valuedatetime | date | strThe time.

Returns

  • str: The ISO string.

number()

number(value: Any) -> float | None

Return a finite number, or None for anything else.

Parameters

NameTypeDefaultDescription
valueAnyThe value.

Returns

  • float | None: The number.

Last updated on

On this page