Observation

Getting an observation

Do not construct an Observation directly. Instead, use these methods on an observation list.

ocdsmetricsanalysis.library.ObservationList.get_data(self) list

Returns a list of Observations.

Observations will match the filters set on this observation list. (Just don’t set any filters to get all observations.)

ocdsmetricsanalysis.library.ObservationList.get_data_by_dimension(self, dimension_key: str) dict

Returns Observations grouped by the value of a dimension key.

Observations will match the filters set on this observation list. (Just don’t set any filters to get all observations.)

Returns a dict. The key is the value of the dimension, and the value is a list of all observations with that dimension value.

Class reference

class ocdsmetricsanalysis.library.Observation(metric: Metric, observation_row_data)

A class representing one observation from a store. It has methods to get information.

Do not construct directly; instead use an ObservationList to get Observations.

get_dimensions() dict
get_id() str
get_measure() str
get_unit_id() str
get_unit_name() str
get_unit_scheme() str
get_unit_uri() str
get_value_amount() str
get_value_currency() str
has_measure() bool

Does this observation have a measure?

has_unit() bool

Does this observation have the unit object (name, scheme, id and uri keys)

has_value() bool

Does this observation have the value object (amount and currency keys)