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

Appropriately handle race unknown #196

Merged
merged 4 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion src/recordlinker/schemas/pii.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def feature_iter(self, feature: Feature) -> typing.Iterator[str]:
if name.family:
yield name.family
elif attribute == FeatureAttribute.RACE:
if self.race:
if self.race and self.race not in [Race.UNKNOWN, Race.ASKED_UNKNOWN]:
yield str(self.race)
elif attribute == FeatureAttribute.TELECOM:
for telecom in self.telecom:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/schemas/test_pii.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def test_feature_iter(self):
assert list(record.feature_iter(pii.Feature(attribute=pii.FeatureAttribute.GIVEN_NAME))) == ["John", "L", "Jane"]
assert list(record.feature_iter(pii.Feature(attribute=pii.FeatureAttribute.FIRST_NAME))) == ["John", "Jane"]
assert list(record.feature_iter(pii.Feature(attribute=pii.FeatureAttribute.LAST_NAME))) == ["Doe", "Smith"]
assert list(record.feature_iter(pii.Feature(attribute=pii.FeatureAttribute.RACE))) == ["UNKNOWN"]
assert list(record.feature_iter(pii.Feature(attribute=pii.FeatureAttribute.RACE))) == []
assert list(record.feature_iter(pii.Feature(attribute=pii.FeatureAttribute.TELECOM))) == [
"555-123-4567",
"(555) 987-6543",
Expand Down
Loading