Skip to content
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

DRAFT: Change /locations logic #101

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

DRAFT: Change /locations logic #101

wants to merge 1 commit into from

Conversation

lukas-phaf
Copy link
Contributor

This PR is just to discuss an idea.

Change /locations to first get all unique parameters, and then the actual stations, making the connection only by parameter_name.

Advantage is that it there is less data to transfer. For the KNMI test data set:
Before: One request of 220 KB
After: One request of 4 KB followed by request of 132 KB.

Disadvantage is that we can no longer check for inconsistent parameter definitions (i.e. different parameters that have the same parameter_name).

I think a better way of doing this would be to do this approach in the store directly, which means the filtering is done in the store, and significantly less data would be send to the API.

…tual stations, making the connection only by parameter_name.
Copy link

API Unit Test Coverage Report
FileStmtsMissCoverMissing
\_\_init\_\_.py00100% 
datastore_pb2.py584621%24–69
datastore_pb2_grpc.py432347%37–52, 85–87, 92–94, 99–101, 106–108, 112–136, 174, 191, 208, 225
grpc_getter.py201145%15–16, 20–23, 27–29, 33–35
locustfile.py15150%1–31
main.py34585%41, 51–52, 62–63
metadata_endpoints.py552555%42–51, 55, 72–151, 155
utilities.py683253%15, 33, 40, 62–65, 73–80, 85–92, 104–123
custom_geo_json
   edr_feature_collection.py60100% 
formatters
   \_\_init\_\_.py110100% 
   covjson.py53198%75
   geojson.py15193%42
routers
   \_\_init\_\_.py00100% 
   edr.py1112875%68–140, 225–226, 270–271
   feature.py451958%70–103, 113–118, 124–146
TOTAL53420661% 

API Unit Test Coverage Summary

Tests Skipped Failures Errors Time
17 0 💤 0 ❌ 0 🔥 2.015s ⏱️

for group in ts_response.groups:
ts = group.combo
parameter = make_parameter(ts)
all_parameters[ts.parameter_name] = parameter
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that there is a duplicate parameter name? If so should then an exception be raised that it already exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is probably the right way/place to do it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think it is possible. make_parameter creates the definition from variables used for parameter_name.

},
)
all_parameters[obs.ts_mdata.parameter_name] = parameter
# TODO: How to check for inconsistent parameter definitions between stations
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this possible to do on lines 76-79? Because if a parameter_name exists that is not unique, it is likely impossible to distinguish between them for stations.

@Jeffrey-Vervoort-KNMI
Copy link
Contributor

I think it is an improvement that we can request more data. I am curious how it impacts the API performance. Especially now that is less likely that we hit the gRPC limit.

@jo-asplin-met-no
Copy link
Contributor

FYI: Based on discussions I added this issue. Feel free to comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants