Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/main/dependencies-f3b4a41397
Browse files Browse the repository at this point in the history
  • Loading branch information
glichtner authored Dec 4, 2024
2 parents 7cf9f3d + e44cd80 commit 4b6d510
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 95 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
name: isort (python)
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -18,12 +18,12 @@ repos:
- id: pretty-format-json
args: ['--autofix', '--no-sort-keys']
- repo: https://github.com/ambv/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.11.1'
rev: 'v1.13.0'
hooks:
- id: mypy
name: mypy
Expand All @@ -36,7 +36,7 @@ repos:
exclude: tests/
args: [--select, "D101,D102,D103,D105,D106"]
- repo: https://github.com/PyCQA/bandit
rev: '1.7.9'
rev: '1.8.0'
hooks:
- id: bandit
args: [--skip, "B101,B303,B110,B311"]
Expand Down
32 changes: 31 additions & 1 deletion apps/graph/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ async function loadRecommendations() {
});
}

function checkCount(ele) {
if (ele && ele.data) {
const count_min = ele.data('count_min');
const count_max = ele.data('count_max');

if (count_min !== null && count_max === null) {
return `>=${count_min}`;
} else if (count_min === null && count_max !== null) {
return `<=${count_max}`;
} else if (count_min !== null && count_max !== null) {
return `${count_min} - ${count_max}`;
}
}
}

async function loadGraph(recommendationId) {
const response = await fetch(`${eeApiUrl}/recommendation/${recommendationId}/execution_graph`);
const data = await response.json();
Expand Down Expand Up @@ -60,12 +75,18 @@ async function loadGraph(recommendationId) {
return ele.data('class')
}
var label;
label = ele.data('concept')["concept_name"];
var concept = ele.data('concept');
var value = ele.data('value');
var dose = ele.data('dose');
var timing = ele.data('timing');
var route = ele.data('route');

if (concept) {
label = concept["concept_name"];
} else {
label = ele.data('class');
}

if (value) {
label += " " + value;
}
Expand All @@ -80,7 +101,16 @@ async function loadGraph(recommendationId) {
}
return label;

} else if (ele.data('type').startsWith('Temporal') && ele.data('type').endsWith('Count')) {
var label = ele.data('class')

label += "[" + checkCount(ele) +'; ' + ele.data('interval_type') + "]";
return label;
} else if (ele.data('type').endsWith('Count')) {
return ele.data('class') + '[' + checkCount(ele) + ']';
}


if (ele.data("is_sink")) {
return ele.data('category') + " [SINK]"
}
Expand Down
9 changes: 9 additions & 0 deletions execution_engine/execution_graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ def criterion_attr(attr: str) -> str | None:
except NotImplementedError:
# non-concept criterion, e.g. base criterion
pass
elif isinstance(node, logic.TemporalCount):
node_data["data"]["start_time"] = node.start_time
node_data["data"]["end_time"] = node.end_time
node_data["data"]["interval_type"] = node.interval_type

if hasattr(node, "count_min"):
node_data["data"]["count_min"] = node.count_min
if hasattr(node, "count_max"):
node_data["data"]["count_max"] = node.count_max

if self.nodes[node]["category"] == CohortCategory.BASE:
node_data["data"]["base_criterion"] = str(
Expand Down
5 changes: 4 additions & 1 deletion execution_engine/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ def handle_binary_logical_operator(
:return: A DataFrame with the merged or intersected intervals.
"""

if len(data) == 1:
if (
isinstance(self.expr, (logic.And, logic.NonSimplifiableAnd, logic.Or))
and len(data) == 1
):
# if there is only one dependency, return the intervals of that dependency, i.e. no merge/intersect
return data[0]

Expand Down
Loading

0 comments on commit 4b6d510

Please sign in to comment.