Skip to content

Commit 89291a0

Browse files
authored
Now uses numeric_value for predicates (#139)
Closes #138
1 parent e826a7b commit 89291a0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

docs/source/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ on its source format.
7171

7272
1. If the source data is in [MEDS](https://github.com/Medical-Event-Data-Standard/meds) format
7373
(recommended), then the `code` will be checked directly against MEDS' `code` field and the `value_min`
74-
and `value_max` constraints will be compared against MEDS' `numerical_value` field.
74+
and `value_max` constraints will be compared against MEDS' `numeric_value` field.
7575

7676
**Note**: This syntax does not currently support defining predicates that also rely on matching other,
7777
optional fields in the MEDS syntax; if this is a desired feature for you, please let us know by filing a

src/aces/config.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ def MEDS_eval_expr(self) -> pl.Expr:
4545
Examples:
4646
>>> expr = PlainPredicateConfig("BP//systolic", 120, 140, True, False).MEDS_eval_expr()
4747
>>> print(expr) # doctest: +NORMALIZE_WHITESPACE
48-
[(col("code")) == (String(BP//systolic))].all_horizontal([[(col("numerical_value")) >=
49-
(dyn int: 120)], [(col("numerical_value")) < (dyn int: 140)]])
48+
[(col("code")) == (String(BP//systolic))].all_horizontal([[(col("numeric_value")) >=
49+
(dyn int: 120)], [(col("numeric_value")) < (dyn int: 140)]])
5050
>>> cfg = PlainPredicateConfig("BP//systolic", value_min=120, value_min_inclusive=False)
5151
>>> expr = cfg.MEDS_eval_expr()
5252
>>> print(expr) # doctest: +NORMALIZE_WHITESPACE
53-
[(col("code")) == (String(BP//systolic))].all_horizontal([[(col("numerical_value")) >
53+
[(col("code")) == (String(BP//systolic))].all_horizontal([[(col("numeric_value")) >
5454
(dyn int: 120)]])
5555
>>> cfg = PlainPredicateConfig("BP//systolic", value_max=140, value_max_inclusive=True)
5656
>>> expr = cfg.MEDS_eval_expr()
5757
>>> print(expr) # doctest: +NORMALIZE_WHITESPACE
58-
[(col("code")) == (String(BP//systolic))].all_horizontal([[(col("numerical_value")) <=
58+
[(col("code")) == (String(BP//systolic))].all_horizontal([[(col("numeric_value")) <=
5959
(dyn int: 140)]])
6060
>>> cfg = PlainPredicateConfig("BP//diastolic")
6161
>>> expr = cfg.MEDS_eval_expr()
@@ -136,14 +136,14 @@ def MEDS_eval_expr(self) -> pl.Expr:
136136

137137
if self.value_min is not None:
138138
if self.value_min_inclusive:
139-
criteria.append(pl.col("numerical_value") >= self.value_min)
139+
criteria.append(pl.col("numeric_value") >= self.value_min)
140140
else:
141-
criteria.append(pl.col("numerical_value") > self.value_min)
141+
criteria.append(pl.col("numeric_value") > self.value_min)
142142
if self.value_max is not None:
143143
if self.value_max_inclusive:
144-
criteria.append(pl.col("numerical_value") <= self.value_max)
144+
criteria.append(pl.col("numeric_value") <= self.value_max)
145145
else:
146-
criteria.append(pl.col("numerical_value") < self.value_max)
146+
criteria.append(pl.col("numeric_value") < self.value_max)
147147

148148
if self.other_cols:
149149
criteria.extend([pl.col(col) == value for col, value in self.other_cols.items()])

0 commit comments

Comments
 (0)