Skip to content

Commit

Permalink
removing Sex.UNKNOWN [Executive Order 14168] (#186)
Browse files Browse the repository at this point in the history
## 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).
  • Loading branch information
ericbuckley authored Jan 31, 2025
1 parent 9942907 commit d76f725
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/site/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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**)

Expand Down
5 changes: 3 additions & 2 deletions src/recordlinker/schemas/pii.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/routes/test_seed_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/schemas/test_pii.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"})
Expand Down

0 comments on commit d76f725

Please sign in to comment.