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

refactor: implement new querying interface #191

Conversation

JabobKrauskopf
Copy link
Member

@JabobKrauskopf JabobKrauskopf commented Sep 3, 2024

This PR removes the old query engine and implements the new query engine as an interface in the querying.pyi. All current query engine usage was refactored to use the new interface.

It does not include the interface for control flow

Expected tests to fail:

  • medmodels/medrecord/tests/test_builder.py
  • medmodels/medrecord/tests/test_datatype.py
  • medmodels/medrecord/tests/test_indexers.py
  • medmodels/medrecord/tests/test_medrecord.py
  • medmodels/medrecord/tests/test_overview.py
  • medmodels/medrecord/tests/test_schema.py
  • medmodels/treatment_effect/matching/tests/test_classic_distance_models.py
  • medmodels/treatment_effect/matching/tests/test_metrics.py
  • medmodels/treatment_effect/matching/tests/test_propensity_score.py
  • medmodels/treatment_effect/tests/test_continuous_estimators.py
  • medmodels/treatment_effect/tests/test_temporal_analysis.py
  • medmodels/treatment_effect/tests/test_treatment_effect.py

@JabobKrauskopf JabobKrauskopf force-pushed the 170-define-query-engine-interface branch 2 times, most recently from 3468cfe to d2d31d9 Compare September 3, 2024 10:29
@JabobKrauskopf JabobKrauskopf marked this pull request as ready for review September 3, 2024 10:34
@JabobKrauskopf JabobKrauskopf requested review from a team as code owners September 3, 2024 10:34
@JabobKrauskopf JabobKrauskopf force-pushed the 170-define-query-engine-interface branch from d2d31d9 to 8c2d0d5 Compare September 3, 2024 11:21
@JabobKrauskopf
Copy link
Member Author

Usage examples:

def query(node: NodeOperand):
    edges_to_treatment = node.outgoing_edges()
    edges_to_treatment.target_node().in_group("treatment")

    edges_to_outcome = node.outgoing_edges()
    edges_to_outcome.target_node().in_group("outcome")

    max_time_edge = edges_to_treatment.attribute("time").max()

    max_time_edge.less_than(edges_to_outcome.attribute("time"))


medrecord.select_nodes(query)

@JabobKrauskopf JabobKrauskopf force-pushed the 170-define-query-engine-interface branch 2 times, most recently from fe7a3a9 to 31971ef Compare September 3, 2024 11:34
medmodels/medrecord/medrecord.py Outdated Show resolved Hide resolved
medmodels/medrecord/querying.pyi Outdated Show resolved Hide resolved
medmodels/medrecord/querying.pyi Outdated Show resolved Hide resolved
medmodels/medrecord/querying.pyi Show resolved Hide resolved
Copy link
Contributor

@LauraBoenchenLB LauraBoenchenLB left a comment

Choose a reason for hiding this comment

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

Very cool new query engine! Can't wait to use it to build complex queries with 😎

@JabobKrauskopf JabobKrauskopf merged commit cd391ec into epic/165-query-engine-refactor-1 Sep 4, 2024
2 of 6 checks passed
@JabobKrauskopf JabobKrauskopf deleted the 170-define-query-engine-interface branch September 4, 2024 10:57
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