{"id":23421095,"url":"https://github.com/nhsdigital/ndr_pseudonymise","last_synced_at":"2025-04-12T14:04:39.139Z","repository":{"id":39636729,"uuid":"269589856","full_name":"NHSDigital/ndr_pseudonymise","owner":"NHSDigital","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-06T09:39:44.000Z","size":105,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-10T20:21:51.293Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NHSDigital.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-05T09:42:16.000Z","updated_at":"2025-02-06T09:39:43.000Z","dependencies_parsed_at":"2024-11-19T13:18:41.929Z","dependency_job_id":"d5fe6fb7-9ea3-4135-a7f9-a90ee83448b3","html_url":"https://github.com/NHSDigital/ndr_pseudonymise","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":0.08333333333333337,"last_synced_commit":"614e0e1026842c43f565b8534b0a0578f01ce13c"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fndr_pseudonymise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fndr_pseudonymise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fndr_pseudonymise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fndr_pseudonymise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NHSDigital","download_url":"https://codeload.github.com/NHSDigital/ndr_pseudonymise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578860,"owners_count":21127713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-23T02:14:01.414Z","updated_at":"2025-04-12T14:04:39.074Z","avatar_url":"https://github.com/NHSDigital.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## NdrPseudonymise [![Build Status](https://github.com/publichealthengland/ndr_pseudonymise/workflows/Test/badge.svg)](https://github.com/publichealthengland/ndr_pseudonymise/actions?query=workflow%3Atest)\n\nPseudonymise confidential data, in CSV format, with specifications for which fields to be encrypted.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ndr_pseudonymise'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install ndr_pseudonymise\n\n## Usage\n\nExample input file:\nnhsnumber,birthdate,postcode,surname,data1,date2\n1234567881,1955-01-01,CB22 3AD,SMITH,xyz,abc\n,01/02/1955,,JONES,zzz,aaa\n\noutfile.yml:\n\nFile version:\n'something-1'\n\nPseudonymised keys:\n[sha1('nhsnumber_1234567881' + salt1), 'n-random-uuencoded-bits-1']\n[sha1('birthdate_postcode_1955-01-01_CB22 3AD' + salt1), 'n-random-uuencoded-bits-2']\n[sha1('birthdate_postcode_1955-02-01_' + salt1), 'n-random-uuencoded-bits-3']\n\nEncrypted demographics\n[sha1('nhsnumber_1234567881' + salt1), encrypt(['surname' =\u003e 'SMITH'], 'nhsnumber_1234567881' + 'n-random-uuencoded-bits-1' + salt2, 'n-random-uuencoded-bits2-1']\n[sha1('birthdate_postcode_1955-01-01_CB22 3AD'  + salt1), encrypt(['surname' =\u003e 'SMITH'], 'birthdate_postcode_1955-01-01_CB22 3AD'  + 'n-random-uuencoded-bits-2' + salt2, 'n-random-uuencoded-bits2-2']\n[sha1('birthdate_postcode_1955-02-01_' + salt1), encrypt(['surname' =\u003e 'JONES'], 'birthdate_postcode_1955-02-01_'  + 'n-random-uuencoded-bits-2' + salt2, 'n-random-uuencoded-bits2-3']\n\nEncrypted data\n[sha1('nhsnumber_1234567881' + salt1), encrypt(['xyz','abc'], 1', 'nhsnumber_1234567881' + 'n-random-uuencoded-bits2-1' + salt2)]\n[sha1('birthdate_postcode_1955-01-01_CB22 3AD' + salt1), encrypt(['xyz','abc'], 1', 'birthdate_postcode_1955-01-01_CB22 3AD' + 'n-random-uuencoded-bits2-2' + salt2)]\n[sha1('birthdate_postcode_1955-02-01_' + salt1), encrypt(['zzz','aaa'], 1', 'birthdate_postcode_1955-02-01_' + 'n-random-uuencoded-bits2-3' + salt2)]\n\nEncrypted meta-data, header row?\n\nTODO: Replace text e.g. 'nhsnumber_1234567881' on RHS above with e.g. sha1('extraprefix_' + 'nhsnumber_1234567881') i.e. something non-disclosive, derivable from the original data.\nTODO: Put original versions of e.g. nhsnumber, birthdate, postcode into \"Encrypted demographics\"\nTODO: Maybe salt2 could be retained, to allow some fuzzy demographic matching, without the possibility of brute forcing the main identifiers??? Or maybe you can do pseudonymised matching without any salt...\n\nOpen questions:\nStandard date / postcode normalisation\nDo you escape underscores in field values\nDo we need salt2, or re-use salt1?\nCan we remove n-random-uuencoded-bits2 into the pseudonymised keys hash?\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Fndr_pseudonymise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhsdigital%2Fndr_pseudonymise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Fndr_pseudonymise/lists"}