opennem.schema package

Submodules

opennem.schema.core module

class opennem.schema.core.BaseConfig

Bases: opennem.schema.core.PropertyBaseModel

class Config

Bases: object

anystr_strip_whitespace = True
arbitrary_types_allowed = True
json_encoders = {}
orm_mode = True
validate_assignment = True
class opennem.schema.core.PropertyBaseModel

Bases: pydantic.main.BaseModel

Workaround for serializing properties with pydantic until https://github.com/samuelcolvin/pydantic/issues/935 is solved

dict(*args, **kwargs)Dict

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod get_properties()

opennem.schema.dataset module

OpenNEM Stat Data Schemas.

These schemas define the format data is returned in.

class opennem.schema.dataset.OpennemData(*, id: str = None, type: str = None, fuel_tech: str = None, network: str = None, region: str = None, data_type: str, code: str = None, units: str, interval: opennem.schema.interval.TimeInterval = None, period: opennem.schema.period.TimePeriod = None, history: opennem.schema.dataset.OpennemDataHistory, forecast: opennem.schema.dataset.OpennemDataHistory = None, x_capacity_at_present: float = None)

Bases: opennem.schema.core.BaseConfig

[summary]

Parameters

BaseConfig ([type]) – [description]

code: Optional[str]
data_type: str
forecast: Optional[OpennemDataHistory]
fuel_tech: Optional[str]
history: OpennemDataHistory
id: Optional[str]
interval: Optional[TimeInterval]
network: Optional[str]
period: Optional[TimePeriod]
region: Optional[str]
type: Optional[str]
units: str
x_capacity_at_present: Optional[float]
class opennem.schema.dataset.OpennemDataHistory(*, start: datetime.datetime, last: datetime.datetime, interval: str, data: List)

Bases: opennem.schema.core.BaseConfig

The start date of the data series.

Returns

[description]

Return type

[type]

data: List
interval: str
last: datetime
start: datetime

[summary]

Returns

[description]

Return type

[type]

values()List[Tuple[datetime.datetime, float]]

[summary]

Returns

[description]

Return type

List[Tuple[datetime, float]]

class opennem.schema.dataset.OpennemDataSet(*, type: str = None, version: str = None, network: str = None, code: str = None, region: str = None, created_at: datetime.datetime = None, data: List[opennem.schema.dataset.OpennemData])

Bases: opennem.schema.core.BaseConfig

code: Optional[str]
created_at: Optional[datetime]
data: List[OpennemData]
get_by_network_id(network_id: str)opennem.schema.dataset.OpennemDataSet
get_by_network_region(network_region: str)opennem.schema.dataset.OpennemDataSet
get_by_stat_type(stat_type: opennem.schema.stat.StatType)opennem.schema.dataset.OpennemDataSet
get_by_year(year: int)opennem.schema.dataset.OpennemDataSet
get_by_years(years: List[int])opennem.schema.dataset.OpennemDataSet
get_id(id: str)Optional[opennem.schema.dataset.OpennemData]
network: Optional[str]
region: Optional[str]
type: Optional[str]
version: Optional[str]

opennem.schema.envs module

class opennem.schema.envs.Environment(value)

Bases: enum.Enum

An enumeration.

development = 'dev'
local = 'local'
production = 'production'
staging = 'staging'

opennem.schema.interval module

class opennem.schema.interval.TimeInterval(*, interval: int, human: str)

Bases: opennem.schema.core.BaseConfig

human: str
interval: int

opennem.schema.network module

class opennem.schema.network.FacilityStatusSchema(*, code: str, label: str)

Bases: opennem.schema.core.BaseConfig

code: str
label: str
class opennem.schema.network.FueltechSchema(*, code: str, label: str, renewable: bool)

Bases: opennem.schema.core.BaseConfig

code: str
label: str
renewable: bool
class opennem.schema.network.NetworkRegionSchema(*, code: str, timezone: str = None)

Bases: opennem.schema.core.BaseConfig

Defines a network region

code: str
timezone: Optional[str]
class opennem.schema.network.NetworkSchema(*, code: str, country: str, label: str, regions: List[opennem.schema.network.NetworkRegionSchema] = None, timezone: str = None, interval_size: int)

Bases: opennem.schema.core.BaseConfig

Defines a network

code: str
country: str
interval_size: int
label: str
regions: Optional[List[opennem.schema.network.NetworkRegionSchema]]
timezone: Optional[str]

opennem.schema.period module

class opennem.schema.period.TimePeriod(*, period: int, human: str)

Bases: opennem.schema.core.BaseConfig

human: str
period: int

opennem.schema.stat module

class opennem.schema.stat.StatType(value)

Bases: enum.Enum

An enumeration.

energy = 'energy'
gov = 'gov'
interchange = 'interchange'
power = 'power'

opennem.schema.validators module

opennem.schema.validators.chop_microseconds(dt: datetime.datetime)datetime.datetime
opennem.schema.validators.data_validate(values: List[Union[float, int, None, decimal.Decimal]])List[Optional[Union[float, int]]]

Validate and format list of numeric data values

opennem.schema.validators.number_output(n: Optional[Union[float, int]])Union[float, int, None, decimal.Decimal]

Format numbers for data series outputs

opennem.schema.validators.optionally_parse_string_datetime(value: Optional[Union[str, datetime.datetime, datetime.date]] = None)Optional[Union[str, datetime.datetime, datetime.date]]
opennem.schema.validators.optionaly_lowercase_string(value: str)str

Read from settings if we want output schema string values to be lowercased or not and perform

Module contents