Skip to content

Conversation

flora-hofmann-frequenz
Copy link
Contributor

@flora-hofmann-frequenz flora-hofmann-frequenz commented Feb 25, 2025

First draft of initial client, tests still need to be added.

@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels Feb 25, 2025
@flora-hofmann-frequenz flora-hofmann-frequenz force-pushed the initial_client branch 2 times, most recently from 9d2d8f1 to 818c66e Compare February 27, 2025 14:00
manufacturer: str
model_name: str
status: str
start_timestamp: Optional[datetime]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{start,end}_time

id: int
enterprise_id: int
name: str
delivery_area_code: Optional[str]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional = str | None

longitude=location.longitude if location else None,
country_code=location.country_code if location else None,
status=pb.status,
created_at=pb.create_timestamp.ToDatetime().replace(tzinfo=timezone.utc),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_time

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

microgrid_id: int
name: str
category: str
category_metadata: dict[str, Any]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit tricky, I think the type implementation for the metadata variant should also be implemented in common client.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

category_metadata: dict[str, Any]
manufacturer: str
model_name: str
status: str
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we need to use a python equivalent of that type (I think it exists also already in common).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: str
start_timestamp: Optional[datetime]
end_timestamp: Optional[datetime]
metric_config_bounds: list[dict]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metric could be the key and the bounds be in a dedicated dataclass. Maybe also worth in common?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# pylint: disable=too-many-instance-attributes
@dataclass(frozen=True)
class Microgrid:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if all these dataclasses here should go into the common client repo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we discuss this with someone else from the api-team?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posted it in the assets-channel to get some opinions on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self,
microgrid_id: int,
source_component_ids: Optional[list[int]] = None,
destination_component_ids: Optional[list[int]] = None,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be useful to be able to optionally pass a timestamp and the connections are filtered such that only those relevant to that point in time are returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing in service

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be implemented in the client already since we have this information. However, it's not so easy since it would ideally support a time range, which could result in multiple graphs. Maybe that's something for the assets API tooling.

@flora-hofmann-frequenz flora-hofmann-frequenz marked this pull request as ready for review May 6, 2025 14:06
@flora-hofmann-frequenz flora-hofmann-frequenz requested a review from a team as a code owner May 6, 2025 14:06
@flora-hofmann-frequenz flora-hofmann-frequenz force-pushed the initial_client branch 3 times, most recently from 7bd17bd to deb6533 Compare June 9, 2025 09:08
@flora-hofmann-frequenz flora-hofmann-frequenz force-pushed the initial_client branch 2 times, most recently from 0797dc2 to 2609589 Compare July 3, 2025 12:40
Signed-off-by: Flora <[email protected]>
@flora-hofmann-frequenz
Copy link
Contributor Author

@cwasicki & @cyiallou: I would like to get this one merged if possible (it is working, but has been open very long due to dependencies on other repos). We can then improve on the open topics (such taking wrappers out and using the ones from client-common once available , generally updating the service / assets-api to common-api v0.8.0 etc) in follow up PRs. Costas, Richard & I will meet tomorrow to discuss open topics and next steps forward. Let me know if anything speaks against this plan of action.

Copy link

@cyiallou cyiallou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together. I’m still getting up to speed with all the integration points across the various repos, so I’m not in a position to fully evaluate all the implementation details just yet. From what I can see, the client seems functional, but it looks like tests are still missing, and as you noted, some refactoring would be needed. I imagine those improvements could be done in follow-up PRs.

I will hold off on giving a formal approval for now and would appreciate if someone with more context around the broader system could take a closer look.

@@ -0,0 +1,86 @@
# License: MIT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better implemented as a CLI tool similar to the reporting client.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually more like the CLI tool in trading, which provides an example for different endpoints.

source_component_ids: List of source component IDs to filter.
destination_component_ids: List of destination component IDs to filter.
"""
server_url = "localhost:50052"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a command line argument.


source_component_id: int
destination_component_id: int
start_time: Optional[datetime]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datetime | None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace all Optionals in this module following this pattern

self,
microgrid_id: int,
source_component_ids: Optional[list[int]] = None,
destination_component_ids: Optional[list[int]] = None,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be implemented in the client already since we have this information. However, it's not so easy since it would ideally support a time range, which could result in multiple graphs. Maybe that's something for the assets API tooling.

with the component.
"""

id: int

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs docstrings.


# pylint: disable=too-many-instance-attributes
@dataclass
class ElectricalComponent:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



@dataclass
class ElectricalComponentConnection:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@llucax
Copy link
Contributor

llucax commented Aug 20, 2025

This one was replaced by #21, right @eduardiazf ?

@cwasicki
Copy link

This one was replaced by #21, right @eduardiazf ?

Only partly, e.g. the connection part is not part of #21.

@sandovalrr sandovalrr closed this Aug 21, 2025
@sandovalrr
Copy link

@llucax @cwasicki , Just close this one since @eduardiazf will cover the missing methods in separate PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants