Skip to content

Commit

Permalink
changes to accommodate old cogshop model and improved scenario concept (
Browse files Browse the repository at this point in the history
#328)

* changes to accommodate old cogshop model and improved scenario concept

* erik comments

* review comments

* remove unused type

* Update cognite/powerops/custom_modules/power_model_v1/data_models/containers/Case.container.yaml

Co-authored-by: Erik Lien Johnsen <[email protected]>

* Update cognite/powerops/custom_modules/power_model_v1/data_models/containers/Case.container.yaml

Co-authored-by: Erik Lien Johnsen <[email protected]>

* Update cognite/powerops/custom_modules/power_model_v1/data_models/containers/Case.container.yaml

Co-authored-by: Erik Lien Johnsen <[email protected]>

* review comments on modelTemplate and Case

* add missing view Commands to two datamodels

* more missing views

* last deployed version

* fix write_read_instances script and regen pygen sdk

* fix name mapping

* remove type filter on SHOPResult view and add a TODO with deciding on correct filtering

* changelog and version

---------

Co-authored-by: Erik Lien Johnsen <[email protected]>
  • Loading branch information
Juliamg and eriklien authored Mar 12, 2024
1 parent d75f30d commit 05125ae
Show file tree
Hide file tree
Showing 115 changed files with 8,996 additions and 2,023 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [0.90.0] - 2024-03-12
### Changed
* `v1` data model with domain informed changes
- Added a separate cogshop data model
- Changes to `Scenario` type to accommodate for `Incremental mappings`. Preprocessor will now take in a `Scenario` and
output a `Case`
- Added wrapper for SHOP output timeseries - SHOPTimeSeries
- Added interface for a generic SHOP result - SHOPResult

## [0.88.9] - 2024-03-07
### Fixed
* Transformation `AddWaterInTransit` apply returns input time series if discharge is empty
Expand Down
2 changes: 1 addition & 1 deletion cognite/powerops/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.88.9"
__version__ = "0.90.0"
4 changes: 2 additions & 2 deletions cognite/powerops/client/_generated/afrr_bid/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class AFRRBidAPI:
Generated with:
pygen = 0.99.11
cognite-sdk = 7.20.0
pydantic = 2.6.1
cognite-sdk = 7.26.0
pydantic = 2.6.3
Data Model:
space: power-ops-afrr-bid
Expand Down
4 changes: 2 additions & 2 deletions cognite/powerops/client/_generated/assets/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class PowerAssetAPI:
Generated with:
pygen = 0.99.11
cognite-sdk = 7.20.0
pydantic = 2.6.1
cognite-sdk = 7.26.0
pydantic = 2.6.3
Data Model:
space: power-ops-assets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class DayAheadBidAPI:
Generated with:
pygen = 0.99.11
cognite-sdk = 7.20.0
pydantic = 2.6.1
cognite-sdk = 7.26.0
pydantic = 2.6.3
Data Model:
space: power-ops-day-ahead-bid
Expand Down
253 changes: 253 additions & 0 deletions cognite/powerops/client/_generated/v1/_api/bid_configuration_shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from cognite.client import CogniteClient
from cognite.client import data_modeling as dm
from cognite.client.data_classes.data_modeling.instances import InstanceAggregationResultList

from cognite.powerops.client._generated.v1.data_classes._core import DEFAULT_INSTANCE_SPACE
from cognite.powerops.client._generated.v1.data_classes import (
Expand All @@ -14,10 +15,13 @@
ResourcesWriteResult,
BidConfigurationShop,
BidConfigurationShopWrite,
BidConfigurationShopFields,
BidConfigurationShopList,
BidConfigurationShopWriteList,
BidConfigurationShopTextFields,
)
from cognite.powerops.client._generated.v1.data_classes._bid_configuration_shop import (
_BIDCONFIGURATIONSHOP_PROPERTIES_BY_FIELD,
_create_bid_configuration_shop_filter,
)
from ._core import (
Expand Down Expand Up @@ -52,6 +56,8 @@ def __init__(self, client: CogniteClient, view_by_read_class: dict[type[DomainMo
def __call__(
self,
market_configuration: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
method: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
price_area: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
external_id_prefix: str | None = None,
Expand All @@ -63,6 +69,8 @@ def __call__(
Args:
market_configuration: The market configuration to filter on.
name: The name to filter on.
name_prefix: The prefix of the name to filter on.
method: The method to filter on.
price_area: The price area to filter on.
external_id_prefix: The prefix of the external ID to filter on.
Expand All @@ -78,6 +86,8 @@ def __call__(
filter_ = _create_bid_configuration_shop_filter(
self._view_id,
market_configuration,
name,
name_prefix,
method,
price_area,
external_id_prefix,
Expand Down Expand Up @@ -213,9 +223,248 @@ def retrieve(
],
)

def search(
self,
query: str,
properties: BidConfigurationShopTextFields | Sequence[BidConfigurationShopTextFields] | None = None,
market_configuration: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
method: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
price_area: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
external_id_prefix: str | None = None,
space: str | list[str] | None = None,
limit: int | None = DEFAULT_LIMIT_READ,
filter: dm.Filter | None = None,
) -> BidConfigurationShopList:
"""Search bid configuration shops
Args:
query: The search query,
properties: The property to search, if nothing is passed all text fields will be searched.
market_configuration: The market configuration to filter on.
name: The name to filter on.
name_prefix: The prefix of the name to filter on.
method: The method to filter on.
price_area: The price area to filter on.
external_id_prefix: The prefix of the external ID to filter on.
space: The space to filter on.
limit: Maximum number of bid configuration shops to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
Returns:
Search results bid configuration shops matching the query.
Examples:
Search for 'my_bid_configuration_shop' in all text properties:
>>> from cognite.powerops.client._generated.v1 import PowerOpsModelsV1Client
>>> client = PowerOpsModelsV1Client()
>>> bid_configuration_shops = client.bid_configuration_shop.search('my_bid_configuration_shop')
"""
filter_ = _create_bid_configuration_shop_filter(
self._view_id,
market_configuration,
name,
name_prefix,
method,
price_area,
external_id_prefix,
space,
filter,
)
return self._search(self._view_id, query, _BIDCONFIGURATIONSHOP_PROPERTIES_BY_FIELD, properties, filter_, limit)

@overload
def aggregate(
self,
aggregations: (
Aggregations
| dm.aggregations.MetricAggregation
| Sequence[Aggregations]
| Sequence[dm.aggregations.MetricAggregation]
),
property: BidConfigurationShopFields | Sequence[BidConfigurationShopFields] | None = None,
group_by: None = None,
query: str | None = None,
search_properties: BidConfigurationShopTextFields | Sequence[BidConfigurationShopTextFields] | None = None,
market_configuration: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
method: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
price_area: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
external_id_prefix: str | None = None,
space: str | list[str] | None = None,
limit: int | None = DEFAULT_LIMIT_READ,
filter: dm.Filter | None = None,
) -> list[dm.aggregations.AggregatedNumberedValue]: ...

@overload
def aggregate(
self,
aggregations: (
Aggregations
| dm.aggregations.MetricAggregation
| Sequence[Aggregations]
| Sequence[dm.aggregations.MetricAggregation]
),
property: BidConfigurationShopFields | Sequence[BidConfigurationShopFields] | None = None,
group_by: BidConfigurationShopFields | Sequence[BidConfigurationShopFields] = None,
query: str | None = None,
search_properties: BidConfigurationShopTextFields | Sequence[BidConfigurationShopTextFields] | None = None,
market_configuration: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
method: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
price_area: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
external_id_prefix: str | None = None,
space: str | list[str] | None = None,
limit: int | None = DEFAULT_LIMIT_READ,
filter: dm.Filter | None = None,
) -> InstanceAggregationResultList: ...

def aggregate(
self,
aggregate: (
Aggregations
| dm.aggregations.MetricAggregation
| Sequence[Aggregations]
| Sequence[dm.aggregations.MetricAggregation]
),
property: BidConfigurationShopFields | Sequence[BidConfigurationShopFields] | None = None,
group_by: BidConfigurationShopFields | Sequence[BidConfigurationShopFields] | None = None,
query: str | None = None,
search_property: BidConfigurationShopTextFields | Sequence[BidConfigurationShopTextFields] | None = None,
market_configuration: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
method: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
price_area: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
external_id_prefix: str | None = None,
space: str | list[str] | None = None,
limit: int | None = DEFAULT_LIMIT_READ,
filter: dm.Filter | None = None,
) -> list[dm.aggregations.AggregatedNumberedValue] | InstanceAggregationResultList:
"""Aggregate data across bid configuration shops
Args:
aggregate: The aggregation to perform.
property: The property to perform aggregation on.
group_by: The property to group by when doing the aggregation.
query: The query to search for in the text field.
search_property: The text field to search in.
market_configuration: The market configuration to filter on.
name: The name to filter on.
name_prefix: The prefix of the name to filter on.
method: The method to filter on.
price_area: The price area to filter on.
external_id_prefix: The prefix of the external ID to filter on.
space: The space to filter on.
limit: Maximum number of bid configuration shops to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
Returns:
Aggregation results.
Examples:
Count bid configuration shops in space `my_space`:
>>> from cognite.powerops.client._generated.v1 import PowerOpsModelsV1Client
>>> client = PowerOpsModelsV1Client()
>>> result = client.bid_configuration_shop.aggregate("count", space="my_space")
"""

filter_ = _create_bid_configuration_shop_filter(
self._view_id,
market_configuration,
name,
name_prefix,
method,
price_area,
external_id_prefix,
space,
filter,
)
return self._aggregate(
self._view_id,
aggregate,
_BIDCONFIGURATIONSHOP_PROPERTIES_BY_FIELD,
property,
group_by,
query,
search_property,
limit,
filter_,
)

def histogram(
self,
property: BidConfigurationShopFields,
interval: float,
query: str | None = None,
search_property: BidConfigurationShopTextFields | Sequence[BidConfigurationShopTextFields] | None = None,
market_configuration: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
method: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
price_area: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
external_id_prefix: str | None = None,
space: str | list[str] | None = None,
limit: int | None = DEFAULT_LIMIT_READ,
filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
"""Produces histograms for bid configuration shops
Args:
property: The property to use as the value in the histogram.
interval: The interval to use for the histogram bins.
query: The query to search for in the text field.
search_property: The text field to search in.
market_configuration: The market configuration to filter on.
name: The name to filter on.
name_prefix: The prefix of the name to filter on.
method: The method to filter on.
price_area: The price area to filter on.
external_id_prefix: The prefix of the external ID to filter on.
space: The space to filter on.
limit: Maximum number of bid configuration shops to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
Returns:
Bucketed histogram results.
"""
filter_ = _create_bid_configuration_shop_filter(
self._view_id,
market_configuration,
name,
name_prefix,
method,
price_area,
external_id_prefix,
space,
filter,
)
return self._histogram(
self._view_id,
property,
interval,
_BIDCONFIGURATIONSHOP_PROPERTIES_BY_FIELD,
query,
search_property,
limit,
filter_,
)

def list(
self,
market_configuration: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
method: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
price_area: str | tuple[str, str] | list[str] | list[tuple[str, str]] | None = None,
external_id_prefix: str | None = None,
Expand All @@ -228,6 +477,8 @@ def list(
Args:
market_configuration: The market configuration to filter on.
name: The name to filter on.
name_prefix: The prefix of the name to filter on.
method: The method to filter on.
price_area: The price area to filter on.
external_id_prefix: The prefix of the external ID to filter on.
Expand All @@ -251,6 +502,8 @@ def list(
filter_ = _create_bid_configuration_shop_filter(
self._view_id,
market_configuration,
name,
name_prefix,
method,
price_area,
external_id_prefix,
Expand Down
Loading

0 comments on commit 05125ae

Please sign in to comment.