11"""Tests for cumulus.upload_notes.labelstudio.py"""
22
3+ import datetime
34from unittest import mock
45
56import ddt
@@ -26,7 +27,11 @@ def setUp(self):
2627
2728 @staticmethod
2829 def make_note (
29- * , unique_id : str = "unique" , ctakes : bool = True , philter_label : bool = True
30+ * ,
31+ unique_id : str = "unique" ,
32+ ctakes : bool = True ,
33+ philter_label : bool = True ,
34+ ** kwargs ,
3035 ) -> LabelStudioNote :
3136 text = "Normal note text"
3237 note = LabelStudioNote (
@@ -38,6 +43,7 @@ def make_note(
3843 doc_mappings = {"doc" : "doc-anon" },
3944 doc_spans = {"doc" : (0 , len (text ))},
4045 text = text ,
46+ ** kwargs ,
4147 )
4248 if ctakes :
4349 note .ctakes_matches = ctakesmock .fake_ctakes_extract (note .text ).list_match (
@@ -71,7 +77,7 @@ def get_pushed_task(self) -> dict:
7177 return imported_tasks [0 ]
7278
7379 async def test_basic_push (self ):
74- await self .push_tasks (self .make_note ())
80+ await self .push_tasks (self .make_note (date = datetime . datetime ( 2010 , 10 , 10 ) ))
7581 self .assertEqual (
7682 {
7783 "data" : {
@@ -81,6 +87,7 @@ async def test_basic_push(self):
8187 "anon_patient_id" : "patient-anon" ,
8288 "encounter_id" : "enc" ,
8389 "anon_encounter_id" : "enc-anon" ,
90+ "date" : "2010-10-10T00:00:00" ,
8491 "docref_mappings" : {"doc" : "doc-anon" },
8592 "docref_spans" : {"doc" : [0 , 16 ]},
8693 "mylabel" : [{"value" : "Itch" }, {"value" : "Nausea" }],
@@ -174,6 +181,7 @@ async def test_no_predictions(self):
174181 "anon_patient_id" : "patient-anon" ,
175182 "encounter_id" : "enc" ,
176183 "anon_encounter_id" : "enc-anon" ,
184+ "date" : None ,
177185 "docref_mappings" : {"doc" : "doc-anon" },
178186 "docref_spans" : {"doc" : [0 , 16 ]},
179187 "mylabel" : [],
@@ -198,6 +206,7 @@ async def test_dynamic_labels(self, label_type):
198206 "anon_patient_id" : "patient-anon" ,
199207 "encounter_id" : "enc" ,
200208 "anon_encounter_id" : "enc-anon" ,
209+ "date" : None ,
201210 "docref_mappings" : {"doc" : "doc-anon" },
202211 "docref_spans" : {"doc" : [0 , 16 ]},
203212 "mylabel" : [
@@ -218,6 +227,7 @@ async def test_dynamic_labels_no_predictions(self):
218227 "anon_patient_id" : "patient-anon" ,
219228 "encounter_id" : "enc" ,
220229 "anon_encounter_id" : "enc-anon" ,
230+ "date" : None ,
221231 "docref_mappings" : {"doc" : "doc-anon" },
222232 "docref_spans" : {"doc" : [0 , 16 ]},
223233 "mylabel" : [], # this needs to be sent, or the server will complain
@@ -276,6 +286,7 @@ async def test_push_highlights(self):
276286 "anon_patient_id" : "patient-anon" ,
277287 "encounter_id" : "enc" ,
278288 "anon_encounter_id" : "enc-anon" ,
289+ "date" : None ,
279290 "docref_mappings" : {"doc" : "doc-anon" },
280291 "docref_spans" : {"doc" : [0 , 16 ]},
281292 "mylabel" : [{"value" : "Label1" }, {"value" : "Label2" }],
0 commit comments