Skip to content

Commit

Permalink
Merge pull request #207 from rw251/granular-dob-for-rq062
Browse files Browse the repository at this point in the history
Granular dob for rq062
  • Loading branch information
Georgetilston committed Mar 27, 2024
2 parents b85dabc + a09287b commit 5b688f7
Show file tree
Hide file tree
Showing 13 changed files with 944 additions and 353 deletions.
60 changes: 42 additions & 18 deletions projects/062 - Sperrin/README.html
Expand Up @@ -131,7 +131,7 @@ <h2>Reusable queries</h2>
<li>Secondary discharges</li>
<li>Create listing tables for each GP events - RQ062</li>
<li>Define Cohort for RQ062: all individuals registered with a GP who were aged 50 years or older on September 1 2013</li>
<li>Year and quarter month of birth</li>
<li>Year, month, week, and day of birth</li>
<li>GET practice and ccg for each patient</li>
<li>CCG lookup table</li>
<li>Create table of patients who are registered with a GM GP</li>
Expand Down Expand Up @@ -315,15 +315,15 @@ <h3>Define Cohort for RQ062: all individuals registered with a GP who were aged
<p><em>File</em>: <code>query-build-rq062-cohort.sql</code></p>
<p><em>Link</em>: <a href="https://github.com/rw251/gm-idcr/tree/master/shared/Reusable%20queries%20for%20data%20extraction/query-build-rq062-cohort.sql">https://github.com/rw251/.../query-build-rq062-cohort.sql</a></p>
<hr>
<h3>Year and quarter month of birth</h3>
<p>To get the year of birth for each patient.</p>
<h3>Year, month, week, and day of birth</h3>
<p>To get the date of birth for each patient, in various formats.</p>
<p><em>Assumptions</em></p>
<ul>
<li>Patient data is obtained from multiple sources. Where patients have multiple YearAndQuarterMonthOfBirths we determine the YearAndQuarterMonthOfBirth as follows:</li>
<li>If the patients has a YearAndQuarterMonthOfBirth in their primary care data feed we use that as most likely to be up to date</li>
<li>If every YearAndQuarterMonthOfBirth for a patient is the same, then we use that</li>
<li>If there is a single most recently updated YearAndQuarterMonthOfBirth in the database then we use that</li>
<li>Otherwise we take the highest YearAndQuarterMonthOfBirth for the patient that is not in the future</li>
<li>Patient data is obtained from multiple sources. Where patients have multiple DateOfBirths we determine the DateOfBirth as follows:</li>
<li>If the patients has a DateOfBirth in their primary care data feed we use that as most likely to be up to date</li>
<li>If every DateOfBirth for a patient is the same, then we use that</li>
<li>If there is a single most recently updated DateOfBirth in the database then we use that</li>
<li>Otherwise we take the highest DateOfBirth for the patient that is not in the future</li>
</ul>
<p><em>Input</em></p>
<pre><code>Assumes there exists a temp table as follows:
Expand All @@ -332,12 +332,16 @@ <h3>Year and quarter month of birth</h3>
</code></pre>
<p><em>Output</em></p>
<pre><code>A temp table as follows:
#PatientYearAndQuarterMonthOfBirth (FK_Patient_Link_ID, YearAndQuarterMonthOfBirth)
#PatientWeekOfBirth (FK_Patient_Link_ID, WeekOfBirth)
- FK_Patient_Link_ID - unique patient id
- YearAndQuarterMonthOfBirth - (YYYY-MM-01)
- DateOfBirthPID (yyyy-mm-dd) **not to be provided to study teams
- DayOfBirth (dd) (1 to 31)
- WeekOfBirth (ww) (1 to 52)
- MonthOfBirth (mm) (1 to 12)
- YearOfBirth (yyyy)
</code></pre>
<p><em>File</em>: <code>query-patient-year-and-quarter-month-of-birth.sql</code></p>
<p><em>Link</em>: <a href="https://github.com/rw251/gm-idcr/tree/master/shared/Reusable%20queries%20for%20data%20extraction/query-patient-year-and-quarter-month-of-birth.sql">https://github.com/rw251/.../query-patient-year-and-quarter-month-of-birth.sql</a></p>
<p><em>File</em>: <code>query-patient-date-of-birth.sql</code></p>
<p><em>Link</em>: <a href="https://github.com/rw251/gm-idcr/tree/master/shared/Reusable%20queries%20for%20data%20extraction/query-patient-date-of-birth.sql">https://github.com/rw251/.../query-patient-date-of-birth.sql</a></p>
<hr>
<h3>GET practice and ccg for each patient</h3>
<p>For each patient to get the practice id that they are registered to, and the CCG name that the practice belongs to.</p>
Expand Down Expand Up @@ -664,9 +668,10 @@ <h4>Audit log</h4>
<p>LINK: <a href="https://github.com/rw251/gm-idcr/tree/master/shared/clinical-code-sets/conditions/stroke/1">https://github.com/rw251/.../conditions/stroke/1</a></p>
<h3>Dementia</h3>
<p>Any code indicating that a person has dementia, including Alzheimer's disease.</p>
<p>Code set from https://www.opencodelists.org/codelist/opensafely/dementia-complete/48c76cf8/</p>
<p>Code set from https://www.opencodelists.org/codelist/opensafely/dementia-complete/48c76cf8/ supplemented with codes from the NHS PCD refsets.</p>
<h4>Prevalence log</h4>
<p>By examining the prevalence of codes (number of patients with the code in their record) broken down by clinical system, we can attempt to validate the clinical code sets and the reporting of the conditions. Here is a log for this code set. The prevalence range <code>0.67% - 0.81%</code> suggests that this code set is likely well defined.</p>
<p><em>Update <strong>2024-03-15</strong>: Prevalence now 0.83% - 0.99%.</em></p>
<table>
<thead>
<tr>
Expand Down Expand Up @@ -721,14 +726,33 @@ <h4>Prevalence log</h4>
<td style="text-align:right">3170 (0.947%)</td>
</tr>
<tr>
<td>LINK: <a href="https://github.com/rw251/gm-idcr/tree/master/shared/clinical-code-sets/conditions/dementia/1">https://github.com/rw251/.../conditions/dementia/1</a></td>
<td></td>
<td></td>
<td style="text-align:right"></td>
<td style="text-align:right"></td>
<td>2024-03-15</td>
<td>EMIS</td>
<td>2526522</td>
<td style="text-align:right">24910 (0.986%)</td>
<td style="text-align:right">24994 (0.989%)</td>
</tr>
<tr>
<td>2024-03-15</td>
<td>TPP</td>
<td>201758</td>
<td style="text-align:right">1928 (0.956%)</td>
<td style="text-align:right">1948 (0.966%)</td>
</tr>
<tr>
<td>2024-03-15</td>
<td>Vision</td>
<td>335186</td>
<td style="text-align:right">2772 (0.827%)</td>
<td style="text-align:right">2780 (0.829%)</td>
</tr>
</tbody>
</table>
<h4>Audit log</h4>
<ul>
<li>Find_missing_codes last run 2024-03-15</li>
</ul>
<p>LINK: <a href="https://github.com/rw251/gm-idcr/tree/master/shared/clinical-code-sets/conditions/dementia/1">https://github.com/rw251/.../conditions/dementia/1</a></p>
<h3>COPD</h3>
<p>Any suggestion of a diagnosis of COPD.</p>
<p>Developed from https://getset.ga.</p>
Expand Down
45 changes: 29 additions & 16 deletions projects/062 - Sperrin/README.md
Expand Up @@ -42,7 +42,7 @@ This project required the following reusable queries:
- Secondary discharges
- Create listing tables for each GP events - RQ062
- Define Cohort for RQ062: all individuals registered with a GP who were aged 50 years or older on September 1 2013
- Year and quarter month of birth
- Year, month, week, and day of birth
- GET practice and ccg for each patient
- CCG lookup table
- Create table of patients who are registered with a GM GP
Expand Down Expand Up @@ -281,16 +281,16 @@ _File_: `query-build-rq062-cohort.sql`
_Link_: [https://github.com/rw251/.../query-build-rq062-cohort.sql](https://github.com/rw251/gm-idcr/tree/master/shared/Reusable%20queries%20for%20data%20extraction/query-build-rq062-cohort.sql)

---
### Year and quarter month of birth
To get the year of birth for each patient.
### Year, month, week, and day of birth
To get the date of birth for each patient, in various formats.

_Assumptions_

- Patient data is obtained from multiple sources. Where patients have multiple YearAndQuarterMonthOfBirths we determine the YearAndQuarterMonthOfBirth as follows:
- If the patients has a YearAndQuarterMonthOfBirth in their primary care data feed we use that as most likely to be up to date
- If every YearAndQuarterMonthOfBirth for a patient is the same, then we use that
- If there is a single most recently updated YearAndQuarterMonthOfBirth in the database then we use that
- Otherwise we take the highest YearAndQuarterMonthOfBirth for the patient that is not in the future
- Patient data is obtained from multiple sources. Where patients have multiple DateOfBirths we determine the DateOfBirth as follows:
- If the patients has a DateOfBirth in their primary care data feed we use that as most likely to be up to date
- If every DateOfBirth for a patient is the same, then we use that
- If there is a single most recently updated DateOfBirth in the database then we use that
- Otherwise we take the highest DateOfBirth for the patient that is not in the future

_Input_
```
Expand All @@ -302,13 +302,17 @@ Assumes there exists a temp table as follows:
_Output_
```
A temp table as follows:
#PatientYearAndQuarterMonthOfBirth (FK_Patient_Link_ID, YearAndQuarterMonthOfBirth)
#PatientWeekOfBirth (FK_Patient_Link_ID, WeekOfBirth)
- FK_Patient_Link_ID - unique patient id
- YearAndQuarterMonthOfBirth - (YYYY-MM-01)
- DateOfBirthPID (yyyy-mm-dd) **not to be provided to study teams
- DayOfBirth (dd) (1 to 31)
- WeekOfBirth (ww) (1 to 52)
- MonthOfBirth (mm) (1 to 12)
- YearOfBirth (yyyy)
```
_File_: `query-patient-year-and-quarter-month-of-birth.sql`
_File_: `query-patient-date-of-birth.sql`

_Link_: [https://github.com/rw251/.../query-patient-year-and-quarter-month-of-birth.sql](https://github.com/rw251/gm-idcr/tree/master/shared/Reusable%20queries%20for%20data%20extraction/query-patient-year-and-quarter-month-of-birth.sql)
_Link_: [https://github.com/rw251/.../query-patient-date-of-birth.sql](https://github.com/rw251/gm-idcr/tree/master/shared/Reusable%20queries%20for%20data%20extraction/query-patient-date-of-birth.sql)

---
### GET practice and ccg for each patient
Expand Down Expand Up @@ -516,19 +520,28 @@ LINK: [https://github.com/rw251/.../conditions/stroke/1](https://github.com/rw25

Any code indicating that a person has dementia, including Alzheimer's disease.

Code set from https://www.opencodelists.org/codelist/opensafely/dementia-complete/48c76cf8/
Code set from https://www.opencodelists.org/codelist/opensafely/dementia-complete/48c76cf8/ supplemented with codes from the NHS PCD refsets.
#### Prevalence log

By examining the prevalence of codes (number of patients with the code in their record) broken down by clinical system, we can attempt to validate the clinical code sets and the reporting of the conditions. Here is a log for this code set. The prevalence range `0.67% - 0.81%` suggests that this code set is likely well defined.

_Update **2024-03-15**: Prevalence now 0.83% - 0.99%._

| Date | Practice system | Population | Patients from ID | Patient from code |
| ---------- | --------------- | ---------- | ---------------: | ----------------: |
| 2022-12-20 | EMIS | 2438146 | 19770 (0.811%) | 21772 (0.893%) |
| 2022-12-20 | TPP | 198637 | 1427 (0.718%) | 7445 (3.75%) |
| 2022-12-20 | Vision | 327196 | 2244 (0.686%) | 2265 (0.692%) |
| 2024-02-26 | EMIS | 2522441 | 27712 (1.1%) | 27745 (1.1%) |
| 2024-02-26 | TPP | 201679 | 2216 (1.1%) | 1872 (0.928%) |
| 2024-02-26 | Vision | 334812 | 3169 (0.947%) | 3170 (0.947%) |
| 2024-02-26 | EMIS | 2522441 | 27712 (1.1%) | 27745 (1.1%) |
| 2024-02-26 | TPP | 201679 | 2216 (1.1%) | 1872 (0.928%) |
| 2024-02-26 | Vision | 334812 | 3169 (0.947%) | 3170 (0.947%) |
| 2024-03-15 | EMIS | 2526522 | 24910 (0.986%) | 24994 (0.989%) |
| 2024-03-15 | TPP | 201758 | 1928 (0.956%) | 1948 (0.966%) |
| 2024-03-15 | Vision | 335186 | 2772 (0.827%) | 2780 (0.829%) |
#### Audit log

- Find_missing_codes last run 2024-03-15

LINK: [https://github.com/rw251/.../conditions/dementia/1](https://github.com/rw251/gm-idcr/tree/master/shared/clinical-code-sets/conditions/dementia/1)

### COPD
Expand Down

0 comments on commit 5b688f7

Please sign in to comment.