From d76f725e05bf524292c7c4a1c9d12f5f23b2f67d Mon Sep 17 00:00:00 2001 From: Eric Buckley Date: Fri, 31 Jan 2025 13:34:29 -0800 Subject: [PATCH] removing Sex.UNKNOWN [Executive Order 14168] (#186) ## Description Removing the Sex.UNKNOWN value per [Executive Order 14168](https://www.chcoc.gov/content/initial-guidance-regarding-president-trump%E2%80%99s-executive-order-defending-women). --- docs/site/reference.md | 4 ++-- src/recordlinker/schemas/pii.py | 5 +++-- tests/unit/routes/test_seed_router.py | 2 +- tests/unit/schemas/test_pii.py | 10 +++++----- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/site/reference.md b/docs/site/reference.md index b164bdac..afaef085 100644 --- a/docs/site/reference.md +++ b/docs/site/reference.md @@ -17,7 +17,7 @@ linkage evaluation phase. The following features are supported: `SEX` -: The patient's sex (normalized to `M`, `F`, or `U` for unknown). +: The patient's sex (normalized to `M` or `F`). `RACE` @@ -91,7 +91,7 @@ patient data and used during query retrieval. The following blocking key types a `SEX` (ID: **3**) -: The patient's sex in the format of `M`, `F`, or `U` for unknown. +: The patient's sex in the format of `M` or `F`. `ZIP` (ID: **4**) diff --git a/src/recordlinker/schemas/pii.py b/src/recordlinker/schemas/pii.py index f3ed800e..c2ff16a9 100644 --- a/src/recordlinker/schemas/pii.py +++ b/src/recordlinker/schemas/pii.py @@ -26,6 +26,7 @@ class FeatureAttribute(enum.Enum): CITY = "CITY" STATE = "STATE" ZIP = "ZIP" + # GENDER removed to be in compliance with Executive Order 14168 RACE = "RACE" TELECOM = "TELECOM" PHONE = "PHONE" @@ -95,7 +96,7 @@ class Sex(enum.Enum): MALE = "M" FEMALE = "F" - UNKNOWN = "U" + # UNKNOWN Sex removed to be in compliance with Executive Order 14168 def __str__(self): """ @@ -253,7 +254,7 @@ def parse_sex(cls, value): return Sex.MALE elif val in ["f", "female"]: return Sex.FEMALE - return Sex.UNKNOWN + return None @pydantic.field_validator("race", mode="before") def parse_race(cls, value): diff --git a/tests/unit/routes/test_seed_router.py b/tests/unit/routes/test_seed_router.py index e22d196a..10e0fa31 100644 --- a/tests/unit/routes/test_seed_router.py +++ b/tests/unit/routes/test_seed_router.py @@ -40,7 +40,7 @@ def test_large_batch(self, client): assert sum(len(p["patients"]) for p in persons) == 1397 assert client.session.query(models.Person).count() == 100 assert client.session.query(models.Patient).count() == 1397 - assert client.session.query(models.BlockingValue).count() == 12603 + assert client.session.query(models.BlockingValue).count() == 12139 @mock.patch("recordlinker.database.algorithm_service.default_algorithm") def test_seed_and_link(self, mock_algorithm, basic_algorithm, client): diff --git a/tests/unit/schemas/test_pii.py b/tests/unit/schemas/test_pii.py index 1cc63848..cd61be2a 100644 --- a/tests/unit/schemas/test_pii.py +++ b/tests/unit/schemas/test_pii.py @@ -120,9 +120,9 @@ def test_parse_sex(self): record = pii.PIIRecord(sex="FEMALE") assert record.sex == pii.Sex.FEMALE record = pii.PIIRecord(sex="U") - assert record.sex == pii.Sex.UNKNOWN + assert record.sex is None record = pii.PIIRecord(sex="Unknown") - assert record.sex == pii.Sex.UNKNOWN + assert record.sex is None record = pii.PIIRecord() assert record.sex is None @@ -313,11 +313,11 @@ def test_blocking_keys_sex(self): rec = pii.PIIRecord(**{"sex": "FEMALE"}) assert rec.blocking_keys(BlockingKey.SEX) == {"F"} rec = pii.PIIRecord(**{"sex": "other"}) - assert rec.blocking_keys(BlockingKey.SEX) == {"U"} + assert rec.blocking_keys(BlockingKey.SEX) == set() rec = pii.PIIRecord(**{"sex": "unknown"}) - assert rec.blocking_keys(BlockingKey.SEX) == {"U"} + assert rec.blocking_keys(BlockingKey.SEX) == set() rec = pii.PIIRecord(**{"sex": "?"}) - assert rec.blocking_keys(BlockingKey.SEX) == {"U"} + assert rec.blocking_keys(BlockingKey.SEX) == set() def test_blocking_keys_zipcode(self): rec = pii.PIIRecord(**{"zip_code": "12345"})