Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing Sex.UNKNOWN [Executive Order 14168] #186

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading