-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new QL endpoints of /v2/attr and /v2/attr/{attr_name} #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orange95 thanks, for this pull request. Unfortunatly, there are no tests provided for the functionality. Please, do so. Additionally, it would great if you state why you deviate from the TimeSeries pattern. I think, that all queries that actually contain values should be converted to Either TimeSeries objects or to list of TimeSeriesObjects
filip/models/ngsi_v2/timeseries.py
Outdated
entityType: str = Field(default=None, | ||
alias="entityType", | ||
description="The type of an entity") | ||
entities: List[Any] = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't the entities a list of something? I think here the same applies
filip/models/ngsi_v2/timeseries.py
Outdated
title="Attribute name", | ||
description="" | ||
) | ||
types: List[Any] = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the docs there is model used for the types. .. Please reconsider how you use the models. The field type containes a list of entities and the a entityType
{
"application/json": {
"attrs:": [
{
"attrName": "temperature",
"types": [
{
"entities": [
{
"entityId": "Room1",
"index": [
"2018-01-05T15:44:34",
"2018-01-06T15:44:59",
"2018-01-07T15:44:59"
],
"values": [
24.1,
25.3,
26.7
]
},
{
"entityId": "Room2",
"index": [
"2018-01-05T15:44:34",
"2018-01-06T15:44:59",
"2018-01-07T15:44:59"
],
"values": [
22.1,
23.3,
25.7
]
}
],
"entityType": "Room"
},
{
"entities": [
{
"entityId": "DeviceInRoom1",
"index": [
"2018-01-05T15:44:34",
"2018-01-06T15:44:59",
"2018-01-07T15:44:59"
],
"values": [
24.1,
25.3,
26.7
]
},
{
"entityId": "DeviceInRoom2",
"index": [
"2018-01-05T15:44:34",
"2018-01-06T15:44:59",
"2018-01-07T15:44:59"
],
"values": [
22.1,
23.3,
25.7
]
}
],
"entityType": "Device"
}
]
}
]
}
}
filip/clients/ngsi_v2/quantumleap.py
Outdated
offset=offset) | ||
return [TimeSeriesEntities( | ||
entityType=entities_item.get('entityType'), | ||
entities=[EntityValues( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a possibility to use itertools.product here instead of nested for-loops?
filip/clients/ngsi_v2/quantumleap.py
Outdated
to_date=to_date, | ||
limit=limit, | ||
offset=offset) | ||
return [TimeSeriesAttrHeader( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if you can use itertools instead of nested forloops
filip/clients/ngsi_v2/quantumleap.py
Outdated
to_date=to_date, | ||
limit=limit, | ||
offset=offset) | ||
return [TimeSeriesAttrHeader( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually everything should somehow a TimeSeries Object in the very end
as for adding test, I plan to add these to the line 126 of tests/clients/test_ngsi_v2_timeseries.py ` entity_attr = client.get_entity_by_attrs(
` |
@SBlechmann is there still any progress on this? |
Yes, we are still on it, sorry for the delay. |
216 release v0 3 0
# Conflicts: # README.md
…ible-with-Pydantic-v2 fix: updated regex to pattern
# Conflicts: # filip/clients/ngsi_v2/cb.py # tests/clients/test_ngsi_v2_cb.py
Update README.md
Fix wrong msg in iota.py
230 increase pandas version
…rclient-update_entity
…rclient-update_entity
…ontextbrokerclient-update_entity add ``update_entity_relationships`` to allow relationship update
# Conflicts: # tutorials/ngsi_v2/e4_iot_thermal_zone_sensors/e4_iot_thermal_zone_sensors_solution.py
…cated fix: ngsi v2 tutorials are deprecated (#255)
rebased #15 to current master branch
@tstorek First , appologies for the long list of commits, only the last three are relevant, the rest stems from a rebase on master because the branch was old. The methods now return the sought after timeseries/timeseries list object. I could not find a way to avoid nested loops, given that the response itself comprises of nested/categorized elements. |
filip/clients/ngsi_v2/quantumleap.py
Outdated
geometry=geometry, | ||
coords=coords, | ||
aggr_scope=aggr_scope) | ||
return [TimeSeries(index=item.get('index'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SystemsPurge could you test here again? It does not work for me. It gives error message:
AttributeError: 'collections.deque' object has no attribute 'get'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djs0109 Could you please give me more information on how to reproduce this ? What versions of the GEs are you running ? Did this error come up in the unittests ?
I've just re-ran the tests ( with added types to account for that scenario ) and it still works for me.
No description provided.