opennem.schema package

Submodules

opennem.schema.core module

class opennem.schema.core.BaseConfig

Bases: 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: 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: Optional[str] = None, type: Optional[str] = None, fuel_tech: Optional[str] = None, network: Optional[str] = None, region: Optional[str] = None, data_type: str, code: Optional[str] = None, units: str, interval: Optional[TimeInterval] = None, period: Optional[TimePeriod] = None, history: OpennemDataHistory, forecast: Optional[OpennemDataHistory] = None, x_capacity_at_present: Optional[float] = None)

Bases: 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, last: datetime, interval: str, data: List)

Bases: 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, float]]

[summary]

Returns

[description]

Return type

List[Tuple[datetime, float]]

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

Bases: BaseConfig

code: Optional[str]
created_at: Optional[datetime]
data: List[OpennemData]
get_by_network_id(network_id: str) OpennemDataSet
get_by_network_region(network_region: str) OpennemDataSet
get_by_stat_type(stat_type: StatType) OpennemDataSet
get_by_year(year: int) OpennemDataSet
get_by_years(years: List[int]) OpennemDataSet
get_id(id: str) Optional[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

An enumeration.

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

opennem.schema.interval module

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

Bases: BaseConfig

human: str
interval: int

opennem.schema.network module

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

Bases: BaseConfig

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

Bases: BaseConfig

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

Bases: BaseConfig

Defines a network region

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

Bases: BaseConfig

Defines a network

code: str
country: str
interval_size: int
label: str
regions: Optional[List[NetworkRegionSchema]]
timezone: Optional[str]

opennem.schema.period module

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

Bases: BaseConfig

human: str
period: int

opennem.schema.stat module

class opennem.schema.stat.StatType(value)

Bases: Enum

An enumeration.

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

opennem.schema.validators module

opennem.schema.validators.chop_microseconds(dt: datetime) datetime
opennem.schema.validators.data_validate(values: List[Union[float, int, None, 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]

Format numbers for data series outputs

opennem.schema.validators.optionally_parse_string_datetime(value: Optional[Union[str, datetime, date]] = None) Optional[Union[str, 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