fix(compliance): evidence-based HIPAA coverage, token hint matching, GDPR measures - #354
Open
kevincostner17 wants to merge 1 commit into
Open
kevincostner17 wants to merge 1 commit into
kevincostner17 wants to merge 1 commit into
Conversation
…vidence HIPAA Safe Harbor passed without dataframe= even when identifier columns existed (#245). Without a source frame the adapter only saw columns that cleaning touched, so untouched identifiers such as ssn or patient_email were invisible and all 18 identifiers came back not_detected. CleanReport now records input_columns (the post-rename column list) in run_pipeline and execute_plan, and the compliance context uses it when dataframe= is absent. When neither is available the HIPAA report sets coverage_verifiable=False, adds a warning and does not pass. input_columns is not added to to_dict(), so the JSON schema and golden snapshots are unchanged. HIPAA identifier hints matched raw substrings (#283), so "ip" flagged description and shipping_cost, "date" flagged last_updated and "sin" flagged business_unit. Column names are now tokenized on separators, camelCase and letter/digit boundaries. Every hint matches as a whole token or token sequence. Hints of four characters or fewer match only that way. Longer hints may also match inside run-together names (patientemail, dateofbirth), but not starting part-way through a token (ip_address no longer matches ship_address). "surname" and "zipcode" hints were added so those common run-together names are still detected. The GDPR Article 30 record always listed "Hash-salt PII masking (SHA-256 + salt)" (#287). security_measures is now built from evidence: a masking entry appears only when columns were masked, with the recorded strategies and no cryptographic claims, and the Data Trust Score entry appears only when a trust score was available. Closes #245 Closes #283 Closes #287
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Compliance reports now rest on evidence from the run instead of optimistic defaults.
dataframe=.ssn,patient_email) were invisible, so every identifier came backnot_detected.CleanReportnow recordsinput_columns, the post-rename column list, inrun_pipelineandapply_plan.dataframe=is absent.coverage_verifiable: False, adds a warning, and does not pass.input_columnsis not part ofto_dict(), so the JSON schema and golden snapshots are unchanged.ipindescription,dateinlast_updated,sininbusiness_unit).DateOfBirthmatchesdate_of_birth), and hints of four characters or fewer match only that way.patientemail), but never starting part-way through a token (ship_addressno longer matchesip_address).surnameandzipcodehints.security_measuresis now built from evidence.Behaviour changes
fd.clean/fd.apply_planwithoutdataframe=detect them, so reports that used to pass can fail.input_columnsyet.visitdate,patientssn) are no longer flagged; separated or camelCase forms still are.security_measuresno longer claims masking or a trust score that wasn't applied.Tests
tests/test_compliance/test_hipaa.py:input_columnsis recorded after rename and kept out ofto_dict().dataframe=, with the same gaps as with it; masked identifiers still pass; no column evidence gives unverifiable and not passed.hotel,cancelled,province,fluid,surface,backlinks,filename) and true-positive cases (IPv4Address,DateOfBirth,dateofbirth,patientemail,zip5,surname).ship_addressis not an IP.apply_planrecordsinput_columns.tests/test_compliance/test_gdpr.py:masked_columns.Verification
ruff check .: all checks passedmypy src/freshdata: no issues in 202 source filespytest -m "not online and not large"on py3.12: 4279 passed, 6 skippedpytest -m "not online and not large"on py3.9 / pandas 1.5: 4275 passed, 10 skippedCloses #245
Closes #283
Closes #287