{"id":15555717,"url":"https://github.com/philipdarke/ehr-codesets","last_synced_at":"2026-01-30T02:03:53.001Z","repository":{"id":134820445,"uuid":"424961909","full_name":"philipdarke/ehr-codesets","owner":"philipdarke","description":"Code sets for Electronic Health Record research","archived":false,"fork":false,"pushed_at":"2024-11-25T15:56:58.000Z","size":66,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-03T12:52:53.867Z","etag":null,"topics":["clinical-terminologies","codeset","ehr","electronic-health-records","healthcare","uk-biobank"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philipdarke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-05T13:41:13.000Z","updated_at":"2024-12-15T08:30:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"43b11471-44eb-4a14-bfd6-4f1d8f3d8877","html_url":"https://github.com/philipdarke/ehr-codesets","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"9135cfd1b719cf62eed7d28ec5deab72cf906455"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipdarke%2Fehr-codesets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipdarke%2Fehr-codesets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipdarke%2Fehr-codesets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipdarke%2Fehr-codesets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philipdarke","download_url":"https://codeload.github.com/philipdarke/ehr-codesets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131246,"owners_count":20728299,"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":["clinical-terminologies","codeset","ehr","electronic-health-records","healthcare","uk-biobank"],"created_at":"2024-10-02T15:10:19.284Z","updated_at":"2026-01-30T02:03:52.913Z","avatar_url":"https://github.com/philipdarke.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Code sets for Electronic Health Record research\n\nPrimary and secondary care code sets for Electronic Health Record research. The code sets were developed primarily for use with UK Biobank data.\n\n:student: Please [cite](#citing-this-work) this work if you use it!\n\n## Primary care\n\nClinical event codes are provided using Read v2 and Clinical Terms Version 3 (CTV3) classifications.\n\n### Conditions ([csv](primary_care/conditions.csv)/[rds](primary_care/conditions.rds))\n\nVariable | Value | Level | Description\n-------- | ----- | ----- | -----------\n`angina` | `diagnosis` | `stable` | Stable angina\n`angina` | `diagnosis` | `unstable` | Unstable angina\n`bipolar` | `diagnosis` | `-` | Bipolar disorder\n`diabetes` | `diagnosis` | `-` | Diabetes (type unknown)\n`diabetes` | `diagnosis` | `type1` | Type 1 diabetes\n`diabetes` | `diagnosis` | `type2` | Type 2 diabetes\n`diabetes` | `diagnosis` | `gestational` | Gestational diabetes\n`diabetes` | `diagnosis` | `secondary` | Secondary diabetes\n`diabetes` | `diagnosis` | `remission` | Diabetes remission\n`diabetes` | `diagnosis` | `resolved` | Diabetes resolution\n`diabetes` | `family_history` | `-` | Family history of diabetes\n`hypertension` | `diagnosis` | `-` | Hypertension\n`learning_disabilities` | `diagnosis` | `-` | Learning disabilities\n`mi` | `diagnosis` | `-` | Myocardial infarction/heart attack\n`pcos` | `diagnosis` | `-` | Polycystic ovarian syndrome\n`schizophrenia` | `diagnosis` | `-` | Schizophrenia\n`stroke` | `diagnosis` | `haemorrhagic` | Haemorrhagic stroke\n`stroke` | `diagnosis` | `ischaemic` | Ischaemic stroke\n`tia` | `diagnosis` | `-` | Transient ischaemic attack\n\n### Biomarkers ([csv](primary_care/biomarkers.csv)/[rds](primary_care/biomarkers.rds))\n\nVariable | Value | Level | Description\n-------- | ----- | ----- | -----------\n`blood_glucose` | `fpg` | `-` | Fasting plasma glucose\n`blood_glucose` | `hba1c` | `-` | Glycated hemoglobin\n`blood_glucose` | `ogtt` | `2hour` | 2 hour oral glucose tolerance test\n`blood_glucose` | `random` | `-` | Random blood sugar\n`blood_glucose` | `unknown` | `-` | Glucose test (unknown type)\n`anthropometric` | `bmi` | `-` | Body mass index\n`anthropometric` | `height` | `-` | Height\n`anthropometric` | `weight` | `-` | Weight\n`anthropometric` | `waist` | `-` | Waist circumference\n\n### Demographic/other ([csv](primary_care/other.csv)/[rds](primary_care/other.rds))\n\nVariable | Value | Level | Description\n-------- | ----- | ----- | -----------\n`smoking` | `current` | `trivial` | Current trivial smoker\n`smoking` | `current` | `light` | Current light smoker\n`smoking` | `current` | `moderate` | Current moderate smoker\n`smoking` | `current` | `heavy` | Current heavy smoker\n`smoking` | `current` | `very_heavy` | Current very heavy smoker\n`smoking` | `current` | `-` | Current smoker (level unknown)\n`smoking` | `former` | `trivial` | Former trivial smoker\n`smoking` | `former` | `light` | Former light smoker\n`smoking` | `former` | `moderate` | Former moderate smoker\n`smoking` | `former` | `heavy` | Former heavy smoker\n`smoking` | `former` | `very_heavy` | Former very heavy smoker\n`smoking` | `former` | `-` | Former smoker (level unknown)\n`smoking` | `never` | `-` | Never smoked\n`smoking` | `non` | `-` | Non-smoker (assumed current)\n`smoking` | `passive` | `-` | Passive smoker (assumed current)\n`smoking` | `consumption` | `-` | Cigarette consumption\n\n## Drug prescriptions\n\nAround 76% of UK Biobank prescription records have a BNF code. 99.7% of records have a BNF and/or Read v2 code. Prescription codes are therefore provided using British National Formulary (BNF) and Read v2 classifications.\n\n[prescriptions.rds](drugs/prescriptions.rds) is a named \"list of lists\" for the following drug categories:\n\nDrug category | Name\n------------- | ---------\nAnti-diabetes drugs | `diabetes`\nAnti-hypertensives | `hypertension`\nAtypical anti-psychotics | `antipsychotic`\nSteroids | `steroids`\nStatins | `statins`\n\n**Further details are provided [here](drugs/README.md).**\n\n:warning: UK Biobank [guidance](https://biobank.ndph.ox.ac.uk/showcase/ukb/docs/primary_care_data.pdf) highlights issues including incomplete and/or inconsistently formatted BNF codes, missing Read v2 codes and missing drug names. The [ukbb-ehr-data repository](https://github.com/philipdarke/ukbb-ehr-data/) includes example code to handle these issues and extract drugs using these code sets.\n\n## Secondary care\n\nSecondary care diagnoses are provided using ICD-9 and ICD-10 coding classifications. Procedures are provided using OPCS-3 and OPCS-4 classifications.\n\n### Conditions ([csv](secondary_care/conditions.csv)/[rds](secondary_care/conditions.rds))\n\nVariable | Value | Level | Description\n-------- | ----- | ----- | -----------\n`diabetes` | `diagnosis` | `-` | Diabetes (type unknown)\n`diabetes` | `diagnosis` | `type1` | Type 1 diabetes\n`diabetes` | `diagnosis` | `type2` | Type 2 diabetes\n`diabetes` | `diagnosis` | `gestational` | Gestational diabetes\n`diabetes` | `diagnosis` | `secondary` | Secondary diabetes\n\n## Other resources\n\n### Open repositories\n\nThe majority of diagnosis records in the [interim EHR data release](https://biobank.ndph.ox.ac.uk/showcase/ukb/docs/primary_care_data.pdf) use the CTV3 coding classification. The code set repositories below typically only cover Read v2 diagnostic codes and limited prescription coding.\n\n* https://phenotypes.healthdatagateway.org/\n* https://www.opencodelists.org/\n* https://clinicalcodes.rss.mhs.man.ac.uk/\n* https://caliberresearch.org/portal is no longer updated\n\n[Kuan et al](https://doi.org/10.1016/S2589-7500(19)30012-3) (2019) includes a map of 308 physical and mental health conditions. Read v2 codes are available at [CALIBER](https://caliberresearch.org/portal) and https://github.com/spiros/chronological-map-phenotypes.\n\n### Prescription coding\n\n* https://openprescribing.net/bnf/ includes a browsable BNF with high-level prescribing trends\n* https://www.thedatalab.org/blog/161/prescribing-data-bnf-codes/ summarises the BNF coding structure\n\n### Code mapping\n\n* https://biobank.ndph.ox.ac.uk/showcase/refer.cgi?id=592\n* https://isd.digital.nhs.uk/\n\n## Citing this work\n\nIf you use this work, please cite it as below:\n\n```\n@article{10.1093/jamia/ocab260,\n    author = {Darke, Philip and Cassidy, Sophie and Catt, Michael and Taylor, Roy and Missier, Paolo and Bacardit, Jaume},\n    title = \"{Curating a longitudinal research resource using linked primary care EHR data - a UK Biobank case study}\",\n    journal = {Journal of the American Medical Informatics Association},\n    volume = {29},\n    number = {3},\n    pages = {546-552},\n    year = {2021},\n    month = {12},\n    issn = {1527-974X},\n    doi = {10.1093/jamia/ocab260},\n    url = {https://doi.org/10.1093/jamia/ocab260},\n    eprint = {https://academic.oup.com/jamia/article-pdf/29/3/546/42333190/ocab260.pdf},\n}\n```\n\n## Licence\n\nMade available under a [Creative Commons Attribution 4.0 International License](https://github.com/philipdarke/ehr-codesets/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipdarke%2Fehr-codesets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilipdarke%2Fehr-codesets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipdarke%2Fehr-codesets/lists"}