File tree Expand file tree Collapse file tree 4 files changed +18
-13
lines changed
Expand file tree Collapse file tree 4 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 77class LabXPaths (StrEnum ):
88 """The list of Sub XPath expressions to extract text in various locations from lab elements."""
99
10- CODE_DISPLAY_NAME = "/ code/@displayName"
11- CODE_ORIGINAL_TEXT = "/ code/originalText"
12- CODE_TEXT = "/ text"
13- CODE_TRANSLATION_DISPLAY_NAME = "/ code/translation/@displayName"
14- CODE_TRANSLATION_ORIGINAL_TEXT = "/ code/translation/originalText"
10+ CODE_DISPLAY_NAME = "code/@displayName"
11+ CODE_ORIGINAL_TEXT = "code/originalText"
12+ OBSERVATION_TEXT = "text"
13+ CODE_TRANSLATION_DISPLAY_NAME = "code/translation/@displayName"
14+ CODE_TRANSLATION_ORIGINAL_TEXT = "code/translation/originalText"
1515
1616
1717class Candidate (BaseModel ):
Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ class LabTestNameOrderedEvaluationCriteria(BaseEvaluationCriteria):
132132 XPathPriority (xpath = LabXPaths .CODE_TRANSLATION_DISPLAY_NAME , priority = 2 ),
133133 XPathPriority (xpath = LabXPaths .CODE_ORIGINAL_TEXT , priority = 3 ),
134134 XPathPriority (xpath = LabXPaths .CODE_TRANSLATION_ORIGINAL_TEXT , priority = 4 ),
135+ XPathPriority (xpath = LabXPaths .OBSERVATION_TEXT , priority = 5 ),
135136 ]
136137 )
137138
@@ -162,6 +163,7 @@ class LabTestNameResultedEvaluationCriteria(BaseEvaluationCriteria):
162163 XPathPriority (xpath = LabXPaths .CODE_TRANSLATION_DISPLAY_NAME , priority = 2 ),
163164 XPathPriority (xpath = LabXPaths .CODE_ORIGINAL_TEXT , priority = 3 ),
164165 XPathPriority (xpath = LabXPaths .CODE_TRANSLATION_ORIGINAL_TEXT , priority = 4 ),
166+ XPathPriority (xpath = LabXPaths .OBSERVATION_TEXT , priority = 5 ),
165167 ]
166168 )
167169
Original file line number Diff line number Diff line change 2222 </tr >
2323 </thead >
2424 <tbody >
25- <tr >
25+ <tr ID = " row_reference_1 " >
2626 <td ID =" simple_reference_1" >
2727 My reference
2828 </td >
3939 </table >
4040 </text >
4141 <observation >
42+ <text >
43+ <reference value =" #row_reference_1" />
44+ </text >
4245 <code >
4346 <originalText >
4447 <reference value =" #simple_reference_1" />
Original file line number Diff line number Diff line change @@ -91,16 +91,16 @@ def results(self) -> list[Candidate]:
9191
9292 def test_simple_reference (self , results : list [Candidate ]):
9393 expected = "My reference"
94- assert results [ 0 ] == Candidate (value = expected , xpath = LabXPaths .CODE_ORIGINAL_TEXT )
94+ assert Candidate (value = expected , xpath = LabXPaths .CODE_ORIGINAL_TEXT ) in results
9595
9696 def test_additional_text_in_original (self , results : list [Candidate ]):
9797 expected = "This original text has additional text My reference Even more stuff here"
98- assert results [1 ] == Candidate (
99- value = expected , xpath = LabXPaths .CODE_TRANSLATION_ORIGINAL_TEXT
100- )
98+ assert Candidate (value = expected , xpath = LabXPaths .CODE_TRANSLATION_ORIGINAL_TEXT ) in results
10199
102100 def test_complicated_reference (self , results : list [Candidate ]):
103101 expected = "A more complicated reference With extra nodes"
104- assert results [2 ] == Candidate (
105- value = expected , xpath = LabXPaths .CODE_TRANSLATION_ORIGINAL_TEXT
106- )
102+ assert Candidate (value = expected , xpath = LabXPaths .CODE_TRANSLATION_ORIGINAL_TEXT )
103+
104+ def test_row_reference (self , results : list [Candidate ]):
105+ expected = "My reference A more complicated reference With extra nodes"
106+ assert Candidate (value = expected , xpath = LabXPaths .OBSERVATION_TEXT ) in results
You can’t perform that action at this time.
0 commit comments