limebit / medmodels

MedModels is a high-speed RWE framework to apply the latest methods from scientific research to medical data.
https://www.medmodels.de
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

refactor: update interface #212

Closed JabobKrauskopf closed 2 months ago

JabobKrauskopf commented 2 months ago

This PR updates the query engine interface according to new findings during the rust implementation.

Usage itself remains mainly the same.

E.g

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)

but this refactoring allows for some other stuff like node.attributes().starts_with("test_") and disallows e.g. comparing node indices with edge indices or values

Expected tests to fail (same as in the previous PR):