From a6a65700b0211a5f436d7380e415b3b613e7503a Mon Sep 17 00:00:00 2001 From: kathryn1995 Date: Fri, 2 Oct 2026 21:46:32 -0700 Subject: [PATCH] Rename host_subject_id to host_subject_name for v1.1.0 schema --- src/pmotools/pmo_builder/metatable_to_pmo.py | 10 +++++----- tests/test_pmo_builder/test_metatable_to_pmo.py | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pmotools/pmo_builder/metatable_to_pmo.py b/src/pmotools/pmo_builder/metatable_to_pmo.py index 6169646..d244922 100644 --- a/src/pmotools/pmo_builder/metatable_to_pmo.py +++ b/src/pmotools/pmo_builder/metatable_to_pmo.py @@ -212,7 +212,7 @@ def specimen_info_table_to_pmo( has_travel_out_six_month_col: str = None, host_age_col: str = None, host_sex_col: str = None, - host_subject_id: str = None, + host_subject_name_col: str = None, lat_lon_col: str = None, parasite_density_col: str = None, parasite_density_method_col: str = None, @@ -281,8 +281,8 @@ def specimen_info_table_to_pmo( :type host_age_col: str, optional :param host_sex_col: if the specimen is from a person, the sex of that person :type host_sex_col: str, optional - :param host_subject_id: ID for the individual a specimen was collected from - :type host_subject_id: str, optional + :param host_subject_name_col: identifier for the individual a specimen was collected from + :type host_subject_name_col: str, optional :param lat_lon_col: latitude and longitude of the collection site :type lat_lon_col: str, optional :param parasite_density_col: the parasite density in parasites per microliter @@ -353,7 +353,7 @@ def specimen_info_table_to_pmo( geo_admin3_col: "geo_admin3", host_age_col: "host_age", host_sex_col: "host_sex", - host_subject_id: "host_subject_id", + host_subject_name_col: "host_subject_name", lat_lon_col: "lat_lon", specimen_accession_col: "specimen_accession", specimen_type_col: "specimen_type", @@ -392,7 +392,7 @@ def specimen_info_table_to_pmo( geo_admin3_col, host_age_col, host_sex_col, - host_subject_id, + host_subject_name_col, lat_lon_col, specimen_accession_col, specimen_type_col, diff --git a/tests/test_pmo_builder/test_metatable_to_pmo.py b/tests/test_pmo_builder/test_metatable_to_pmo.py index 7223cca..9aa15f3 100644 --- a/tests/test_pmo_builder/test_metatable_to_pmo.py +++ b/tests/test_pmo_builder/test_metatable_to_pmo.py @@ -1028,7 +1028,7 @@ def test_specimen_info_table_to_pmo_with_host_fields(self): "project_name": ["project1", "project2", "project3"], "host_age": [25, None, 30], "host_sex": ["M", "F", ""], - "host_subject_id": ["SUB001", "", "SUB003"], + "host_subject_name": ["SUB001", "", "SUB003"], "gravid": [True, None, False], "gravidity": [2, None, 0], } @@ -1044,7 +1044,7 @@ def test_specimen_info_table_to_pmo_with_host_fields(self): project_name_col="project_name", host_age_col="host_age", host_sex_col="host_sex", - host_subject_id="host_subject_id", + host_subject_name_col="host_subject_name", gravid_col="gravid", gravidity_col="gravidity", ) @@ -1052,25 +1052,25 @@ def test_specimen_info_table_to_pmo_with_host_fields(self): # sample1: all fields have values self.assertEqual(result[0]["host_age"], 25) self.assertEqual(result[0]["host_sex"], "M") - self.assertEqual(result[0]["host_subject_id"], "SUB001") + self.assertEqual(result[0]["host_subject_name"], "SUB001") self.assertEqual(result[0]["gravid"], True) self.assertEqual(result[0]["gravidity"], 2) - # sample2: host_age is None, host_subject_id is empty string, gravid is None, gravidity is None - # Should remove: host_age, host_subject_id, gravid, gravidity + # sample2: host_age is None, host_subject_name is empty string, gravid is None, gravidity is None + # Should remove: host_age, host_subject_name, gravid, gravidity # Should keep: host_sex self.assertNotIn("host_age", result[1]) self.assertEqual(result[1]["host_sex"], "F") - self.assertNotIn("host_subject_id", result[1]) + self.assertNotIn("host_subject_name", result[1]) self.assertNotIn("gravid", result[1]) self.assertNotIn("gravidity", result[1]) # sample3: host_sex is empty string # Should remove: host_sex - # Should keep: host_age, host_subject_id, gravid, gravidity + # Should keep: host_age, host_subject_name, gravid, gravidity self.assertEqual(result[2]["host_age"], 30) self.assertNotIn("host_sex", result[2]) - self.assertEqual(result[2]["host_subject_id"], "SUB003") + self.assertEqual(result[2]["host_subject_name"], "SUB003") self.assertEqual(result[2]["gravid"], False) self.assertEqual(result[2]["gravidity"], 0)