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

Enable multiple filters to be supplied by using get_resource_sql #54

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Moohan
Copy link
Member

@Moohan Moohan commented Nov 28, 2024

I was working with @peterl04. He was using https://www.opendata.nhs.scot/dataset/prescriptions-in-the-community but needed data on specific drugs from a number of practices for ~2 years (24 resources). Each resource takes 30+ seconds to fully download, so filtering is super useful. However, only being able to filter by one drug and practice at a time is quite limiting and makes the code more complicated.

This change worked for me. It just uses get_resource_sql when multiple filters are supplied and generates some appropriate SQL.

I think it could probably do with more tests, especially for incorrect or weird/edge cases. I tried to do it using existing functions as much as possible.

One thing to note is that get_resource_sql is slower than get_resource so there could be a better way of doing this...

@Moohan Moohan requested a review from csillasch November 28, 2024 11:11
Copy link
Contributor

@csillasch csillasch left a comment

Choose a reason for hiding this comment

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

Nice solution!

@Moohan
Copy link
Member Author

Moohan commented Dec 10, 2024

@csillasch if you're happy with this approach, would you have time to add any more tests to it?

Also should we have the message? I'm leaning towards removing it, as I'm no longer sure that the user needs to know how we are doing the filtering :D

@csillasch
Copy link
Contributor

Yes sounds good, I will look at adding some more tests.
Agree the user probably doesn`t need to know how the filtering is being done, but might be useful to have a message anyway because it is slower than usual/would be expected?

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.

2 participants