Skip to content

Commit 27c6cfd

Browse files
committed
chore: remove deprecated function calls
1 parent 9b7813b commit 27c6cfd

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed

execution_engine/execution_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def register_recommendation(self, recommendation: cohort.Recommendation) -> None
277277
).encode()
278278

279279
rec_json: bytes = recommendation.json()
280-
logging.info(f"Storing recommendation {recommendation}")
280+
logging.info(f"Storing recommendation {recommendation.description}")
281281
update_query = (
282282
update(recommendation_table)
283283
.where(recommendation_table.recommendation_id == recommendation.id)

execution_engine/task/process/rectangle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def forward_fill_intervals(intervals: list[Interval]) -> list[Interval]:
158158
The last interval for each person is not extended (but may be merged with the previous intervals, if they
159159
are of the same type).
160160
161-
:param data: The intervals per person.
161+
:param intervals: The intervals per person.
162162
:return: A DataFrame with the forward filled intervals.
163163
"""
164164
all_intervals = sorted(
@@ -234,7 +234,7 @@ def complement_intervals(
234234
The complement of an interval is the interval that is not covered by the original interval.
235235
The complement of an interval is always of the same type as the original interval.
236236
237-
:param data: The intervals per person.
237+
:param intervals: The intervals per person.
238238
:param type_: The type of the complement intervals.
239239
:return: A DataFrame with the complement intervals.
240240
"""

sample.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ CELIDA_EE_OMOP__DATA_SCHEMA=cds_cdm
2626

2727
## Execution Engine Result Schema
2828
CELIDA_EE_OMOP__RESULT_SCHEMA=celida
29-
CELIDA_EE_OMOP__RESULT_SCHEMA=celida
3029

3130
# Execution Engine Configuration
3231
## Timezone used for date/time calculations

tests/execution_engine/converter/test_converter.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,31 @@
2525

2626
class TestSelectValue:
2727
def test_select_value_codeable_concept(self):
28-
cc = CodeableConcept.construct()
29-
elem = Extension.construct(valueCodeableConcept=cc)
28+
cc = CodeableConcept.model_construct()
29+
elem = Extension.model_construct(valueCodeableConcept=cc)
3030
value = select_value(elem, "value")
3131
assert value == cc
3232

3333
def test_select_value_quantity(self):
34-
q = Quantity.construct()
35-
elem = Extension.construct(valueQuantity=q)
34+
q = Quantity.model_construct()
35+
elem = Extension.model_construct(valueQuantity=q)
3636
value = select_value(elem, "value")
3737
assert value == q
3838

3939
def test_select_value_range(self):
40-
r = Range.construct()
41-
elem = Extension.construct(valueRange=r)
40+
r = Range.model_construct()
41+
elem = Extension.model_construct(valueRange=r)
4242
value = select_value(elem, "value")
4343
assert value == r
4444

4545
def test_select_value_boolean(self):
4646
b = True
47-
elem = Extension.construct(valueBoolean=b)
47+
elem = Extension.model_construct(valueBoolean=b)
4848
value = select_value(elem, "value")
4949
assert value == b
5050

5151
def test_select_value_not_found(self):
52-
elem = Extension.construct()
52+
elem = Extension.model_construct()
5353
with pytest.raises(ValueError):
5454
select_value(elem, "value")
5555

@@ -62,25 +62,25 @@ def test_parse_code(self, monkeypatch):
6262
mock_get_standard_concept,
6363
)
6464

65-
coding = Coding.construct(system="http://example.com", code="123")
66-
codeable_concept = CodeableConcept.construct(coding=[coding])
65+
coding = Coding.model_construct(system="http://example.com", code="123")
66+
codeable_concept = CodeableConcept.model_construct(coding=[coding])
6767
parse_code(codeable_concept)
6868

6969
mock_get_standard_concept.assert_called_once_with("http://example.com", "123")
7070

7171

7272
class TestCodeDisplay:
7373
def test_code_display_with_display(self):
74-
coding = Coding.construct(
74+
coding = Coding.model_construct(
7575
system="http://example.com", code="123", display="Example display"
7676
)
77-
codeable_concept = CodeableConcept.construct(coding=[coding])
77+
codeable_concept = CodeableConcept.model_construct(coding=[coding])
7878
display = code_display(codeable_concept)
7979
assert display == "Example display"
8080

8181
def test_code_display_without_display(self):
82-
coding = Coding.construct(system="http://example.com", code="123")
83-
codeable_concept = CodeableConcept.construct(coding=[coding])
82+
coding = Coding.model_construct(system="http://example.com", code="123")
83+
codeable_concept = CodeableConcept.model_construct(coding=[coding])
8484
display = code_display(codeable_concept)
8585
assert display == "123"
8686

@@ -94,9 +94,9 @@ def test_parse_value_codeable_concept(self, monkeypatch, test_concept):
9494
mock_get_standard_concept,
9595
)
9696

97-
coding = Coding.construct(system="http://example.com", code="123")
98-
codeable_concept = CodeableConcept.construct(coding=[coding])
99-
elem = Extension.construct(valueCodeableConcept=codeable_concept)
97+
coding = Coding.model_construct(system="http://example.com", code="123")
98+
codeable_concept = CodeableConcept.model_construct(coding=[coding])
99+
elem = Extension.model_construct(valueCodeableConcept=codeable_concept)
100100

101101
value = parse_value(elem, "value")
102102

@@ -113,8 +113,8 @@ def test_parse_value_quantity(self, monkeypatch, unit_concept):
113113
mock_get_standard_unit_concept,
114114
)
115115

116-
quantity = Quantity.construct(value=42, code="kg")
117-
elem = Extension.construct(valueQuantity=quantity)
116+
quantity = Quantity.model_construct(value=42, code="kg")
117+
elem = Extension.model_construct(valueQuantity=quantity)
118118

119119
value = parse_value(elem, "value")
120120

@@ -130,10 +130,10 @@ def test_parse_value_range(self, monkeypatch, unit_concept):
130130
mock_get_standard_unit_concept,
131131
)
132132

133-
low = Quantity.construct(value=10, code="kg")
134-
high = Quantity.construct(value=20, code="kg")
135-
range_obj = Range.construct(low=low, high=high)
136-
elem = Extension.construct(valueRange=range_obj)
133+
low = Quantity.model_construct(value=10, code="kg")
134+
high = Quantity.model_construct(value=20, code="kg")
135+
range_obj = Range.model_construct(low=low, high=high)
136+
elem = Extension.model_construct(valueRange=range_obj)
137137

138138
value = parse_value(elem, "value")
139139

@@ -170,7 +170,7 @@ def test_criterion_converter_factory_get(self):
170170
factory = CriterionConverterFactory()
171171
factory.register(TestCriterionConverter.MockCriterionConverter)
172172

173-
element = Element.construct(id="valid")
173+
element = Element.model_construct(id="valid")
174174
converter = factory.get(element)
175175

176176
assert isinstance(
@@ -181,7 +181,7 @@ def test_criterion_converter_factory_no_matching_converter(self):
181181
factory = CriterionConverterFactory()
182182
factory.register(TestCriterionConverter.MockCriterionConverter)
183183

184-
element = Element.construct(id="not-valid")
184+
element = Element.model_construct(id="not-valid")
185185

186186
with pytest.raises(ValueError, match="Cannot find a converter"):
187187
factory.get(element)

tests/execution_engine/fhir/test_util.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
class TestUtils:
1111
@pytest.fixture
1212
def codeable_concept(self):
13-
cc = CodeableConcept.construct(
13+
cc = CodeableConcept.model_construct(
1414
coding=[
15-
Coding.construct(
15+
Coding.model_construct(
1616
system="http://example.com/system",
1717
code="example_code",
1818
display="Example Code",
@@ -34,16 +34,16 @@ def test_get_coding_with_system_uri(self, codeable_concept):
3434
assert coding.display == "Example Code"
3535

3636
def test_get_coding_fail(self):
37-
cc = CodeableConcept.construct()
37+
cc = CodeableConcept.model_construct()
3838
with pytest.raises(ValueError):
3939
get_coding(cc)
4040

4141
@pytest.fixture
4242
def element_with_extension(self):
43-
ext = Extension.construct(
43+
ext = Extension.model_construct(
4444
url="http://example.com/extension", valueString="test"
4545
)
46-
elem = Element.construct(extension=[ext])
46+
elem = Element.model_construct(extension=[ext])
4747
return elem
4848

4949
def test_get_extension(self, element_with_extension):
@@ -60,6 +60,6 @@ def test_get_extension_not_found(self, element_with_extension):
6060
assert extension is None
6161

6262
def test_get_extension_no_extensions(self):
63-
elem = Element.construct()
63+
elem = Element.model_construct()
6464
extension = get_extension(elem, "http://example.com/extension")
6565
assert extension is None

tests/execution_engine/task/process/test_rectangle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,7 @@ def to_df(data):
30243024
],
30253025
)
30263026
df["interval_start"] = pd.to_datetime(df["interval_start"])
3027-
df["interval_end"] = pd.to_datetime(df["interval_end"])
3027+
df["interval_end"] = pd.to_datetime(df["interval_end"], utc=True)
30283028

30293029
return df
30303030

0 commit comments

Comments
 (0)