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

changes to redaction #213

Merged
merged 3 commits into from
Oct 21, 2024
Merged

changes to redaction #213

merged 3 commits into from
Oct 21, 2024

Conversation

BrandonSharratt
Copy link
Collaborator

*Issue:*bcgov/entity#23402

Description of changes:
Redaction is now the same (currently) across Staff and Public. The rules have also changed to match the spreadsheet in the ticket.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the namex license (Apache 2.0).

@BrandonSharratt
Copy link
Collaborator Author

/gcbrun

Copy link
Collaborator

@hfekete hfekete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, have one comment.

If implemented behavior for RedactionType.REDACT_MONONYM_LN is as we wanted, it's good to merge, otherwise, please either use the function I provided, or rewrite it accordingly

@@ -104,6 +106,19 @@ def redact_field(field, redact_type):
rv += ' '
rv += word[0:1] + '***'
redacted_field = rv
elif redact_type == RedactionType.REDACT_MONONYM_LN:
rv = ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this function locally, and for Little Red Riding Hood I get: Little Red R*** H***
is that what we want ?

if we want to redact every word you can use following:

   temp = []
    words = field.split()
    for word in words:
        temp.append(word[0:1] + '***')
    rv = ' '.join(temp)
    return rv

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't using REDACT_MONONYM_LN I was working on it and realized this case and when I dug into it we aren't using the modifiers as we have to show the full name. The other use potential problem with the function is when for instance someone is 'Jr.' or 'the III' because these go after the last name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the above stated I have updated the function to properly only redact the last word so Little Red Riding Hood becomes Little Red Riding H*** and Queen Elizabeth II becomes Queen Elizabeth I***

@BrandonSharratt BrandonSharratt merged commit 60618a5 into bcgov:main Oct 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants