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

Switch to SQL and providing more support for queries #71

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

prquinlan
Copy link
Contributor

Pull Request Contents

As part of the refactor of the query solvers, we have changed the code from data frames to SQL.

This is a major change to how the queries are created and provides full support for the RQUEST API specification.

♻️ Refactor - removal of old data frame code
✨ Feature - new search functionality
🦋 Bug Fix - prevents a bug from causing issues
⚡️ Optimization - more resilient query creation to cope with OMOP vocab changes.

Description

Major change to query_solvers that has switched out all the previous query creation code and replaced with a gradual creation of the required SQL for rules and between groups. The consequence is a single SQL is created that performs the full query for all groups and rules.

Additional support for missing functionality has been added for certain types of queries not previously supported.

Related Issues or other material

src/hutch_bunny/core/query_solvers.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/query_solvers.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/query_solvers.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/query_solvers.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/query_solvers.py Outdated Show resolved Hide resolved
full_query_all_groups = select(func.count()).where(*all_groups_queries)

# here for debug, prints the SQL statement created
print(str(full_query_all_groups.compile(
Copy link
Member

Choose a reason for hiding this comment

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

logger.debug() instead of print()

src/hutch_bunny/core/query_solvers.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/AvailabilityQuerySolver.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/AvailabilityQuerySolver.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/AvailabilityQuerySolver.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/AvailabilityQuerySolver.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/AvailabilityQuerySolver.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/AvailabilityQuerySolver.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/AvailabilityQuerySolver.py Outdated Show resolved Hide resolved
src/hutch_bunny/core/query_solvers.py Show resolved Hide resolved
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