Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baixiac committed Mar 20, 2024
1 parent 595b5be commit 1bdf43e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/app/api/test_serving_medcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def test_concat_trainer_exports():
])
assert response.status_code == 200
assert response.headers["Content-Type"] == "application/json; charset=utf-8"
assert len(response.text) == 36906
assert len(response.text) == 36918


def test_extract_entities_from_text_list_file_as_json_file():
Expand Down
16 changes: 13 additions & 3 deletions tests/app/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,18 @@ def test_augment_annotations_case_insensitive():
result = augment_annotations(trainer_export, {
"00001": [["HiSToRy"]],
"00002": [
[r"^\d{1,2}[-.\/]\d{1,2}[-.\/]\d{2,4}$"],
[r"^\d{1,2}\s*$", r"^[-.\/]\s*$", r"^(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\s*[-.\/]\s*\d{2,4}$"],
[r"^\d{1,2}\s*$", r"-", r"^\s*\d{1,2}\s*$", r"-", r"^\s*\d{2,4}$"],
[r"^\d{1,2}\s*[.\/]\s*\d{1,2}\s*[.\/]\s*\d{2,4}$"],
[r"^\d{2,4}\s*$", r"-", r"^\s*\d{1,2}\s*$", r"-", r"^\s*\d{1,2}$"],
[r"^\d{2,4}\s*[.\/]\s*\d{1,2}\s*[.\/]\s*\d{1,2}$"],
[r"^\d{1,2}$", r"^[-.\/]$", r"^(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\s*[-.\/]\s*\d{2,4}$"],
[r"^\d{2,4}$", r"^[-.\/]$", r"^(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\s*[-.\/]\s*\d{1,2}$"],
[r"^(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\s*[-.\/]\s*\d{4}$"],
[r"^\d{4}$", r"^(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)$"],
[r"^\d{1,2}\s*$", r"-", r"^\s*\d{4}$"],
[r"^\d{1,2}\s*[\/]\s*\d{4}$"],
[r"^\d{4}\s*$", r"-", r"^\s*\d{1,2}$"],
[r"^\d{4}\s*[\/]\s*\d{1,2}$"],
]
}, False)

Expand All @@ -179,4 +189,4 @@ def test_augment_annotations_case_insensitive():
if annotation["cui"] == "00002":
match_count_00002 += 1
assert match_count_00001 == 10
assert match_count_00002 == 3
assert match_count_00002 == 4
2 changes: 1 addition & 1 deletion tests/resources/fixture/trainer_export.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"id": 3204,
"name": "1687",
"text": "SUBJECTIVE: , The patient is a 60-year-old female, who complained of coughing during meals. Her outpatient evaluation revealed a mild-to-moderate cognitive linguistic deficit, which was completed approximately 2 months ago. The patient had a hisTorY of hypertension and TIA/stroke. The patient denied history of heartburn and/or gastroesophageal reflux disorder. A modified barium swallow study was ordered to objectively evaluate the patient's swallowing function and safety and to rule out aspiration.,OBJECTIVE: , Modified barium swallow study was performed in the Radiology Suite in cooperation with Dr. ABC. The patient was seated upright in a video imaging chair throughout this assessment. To evaluate the patient's swallowing function and safety, she was administered graduated amounts of liquid and food mixed with barium in the form of thin liquid (teaspoon x2, cup sip x2); nectar-thick liquid (teaspoon x2, cup sip x2); puree consistency (teaspoon x2); and solid food consistency (1/4 cracker x1).,ASSESSMENT,ORAL STAGE:, Premature spillage to the level of the valleculae and pyriform sinuses with thin liquid. Decreased tongue base retraction, which contributed to vallecular pooling after the swallow.,PHARYNGEAL STAGE: , No aspiration was observed during this evaluation. Penetration was noted with cup sips of thin liquid only. Trace residual on the valleculae and on tongue base with nectar-thick puree and solid consistencies. The patient's hyolaryngeal elevation and anterior movement are within functional limits. Epiglottic inversion is within functional limits.,CERVICAL ESOPHAGEAL STAGE: ,The patient's upper esophageal sphincter opening is well coordinated with swallow and readily accepted the bolus. Radiologist noted reduced peristaltic action of the constricted muscles in the esophagus, which may be contributing to the patient's complaint of globus sensation.,DIAGNOSTIC IMPRESSION:, No aspiration was noted during this evaluation. Penetration with cup sips of thin liquid. The patient did cough during this evaluation, but that was noted related to aspiration or penetration.,PROGNOSTIC IMPRESSION: ,Based on this evaluation, the prognosis for swallowing and safety is good.,PLAN: , Based on this evaluation and following recommendations are being made:,1. The patient to take small bite and small sips to help decrease the risk of aspiration and penetration.,2. The patient should remain upright at a 90-degree angle for at least 45 minutes after meals to decrease the risk of aspiration and penetration as well as to reduce her globus sensation.,3. The patient should be referred to a gastroenterologist for further evaluation of her esophageal function.,The patient does not need any skilled speech therapy for her swallowing abilities at this time, and she is discharged from my services. This was annotated on 29.03.2020, 29/03/2020 and 29-march-2020.",
"text": "SUBJECTIVE: , The patient is a 60-year-old female, who complained of coughing during meals. Her outpatient evaluation revealed a mild-to-moderate cognitive linguistic deficit, which was completed approximately 2 months ago. The patient had a hisTorY of hypertension and TIA/stroke. The patient denied history of heartburn and/or gastroesophageal reflux disorder. A modified barium swallow study was ordered to objectively evaluate the patient's swallowing function and safety and to rule out aspiration.,OBJECTIVE: , Modified barium swallow study was performed in the Radiology Suite in cooperation with Dr. ABC. The patient was seated upright in a video imaging chair throughout this assessment. To evaluate the patient's swallowing function and safety, she was administered graduated amounts of liquid and food mixed with barium in the form of thin liquid (teaspoon x2, cup sip x2); nectar-thick liquid (teaspoon x2, cup sip x2); puree consistency (teaspoon x2); and solid food consistency (1/4 cracker x1).,ASSESSMENT,ORAL STAGE:, Premature spillage to the level of the valleculae and pyriform sinuses with thin liquid. Decreased tongue base retraction, which contributed to vallecular pooling after the swallow.,PHARYNGEAL STAGE: , No aspiration was observed during this evaluation. Penetration was noted with cup sips of thin liquid only. Trace residual on the valleculae and on tongue base with nectar-thick puree and solid consistencies. The patient's hyolaryngeal elevation and anterior movement are within functional limits. Epiglottic inversion is within functional limits.,CERVICAL ESOPHAGEAL STAGE: ,The patient's upper esophageal sphincter opening is well coordinated with swallow and readily accepted the bolus. Radiologist noted reduced peristaltic action of the constricted muscles in the esophagus, which may be contributing to the patient's complaint of globus sensation.,DIAGNOSTIC IMPRESSION:, No aspiration was noted during this evaluation. Penetration with cup sips of thin liquid. The patient did cough during this evaluation, but that was noted related to aspiration or penetration.,PROGNOSTIC IMPRESSION: ,Based on this evaluation, the prognosis for swallowing and safety is good.,PLAN: , Based on this evaluation and following recommendations are being made:,1. The patient to take small bite and small sips to help decrease the risk of aspiration and penetration.,2. The patient should remain upright at a 90-degree angle for at least 45 minutes after meals to decrease the risk of aspiration and penetration as well as to reduce her globus sensation.,3. The patient should be referred to a gastroenterologist for further evaluation of her esophageal function.,The patient does not need any skilled speech therapy for her swallowing abilities at this time, and she is discharged from my services. This was annotated on 29-03-2020, 29/03/2020, 29.03.2020 and 29-march-2020.",
"last_modified": "2020-03-29 14:43:25.537525+00:00",
"annotations": [
{
Expand Down

0 comments on commit 1bdf43e

Please sign in to comment.