Running
Install sql_runner -https://bitbucket.renalregistry.nhs.uk/projects/RR/repos/sql_runner/browse
Run:
|
Definition
All patients extracted are restricted to those who were successfully matched and held in the STUDY_PATIENTS table. The original cohort was "for all patients with ERF diagnosed at anytime up to 31 March 2017 and alive at 1 April 2009".
These were found using:
Code Block |
---|
SELECT
A.RR_NO,
A.DATE_BIRTH,
A.SEX,
ISNULL(A.NEW_NHS_NO, A.TRACING_NHS_NO) AS NEW_NHS_NO,
B.POST_CODE
FROM
PATIENTS A
LEFT JOIN
(
SELECT
RR_NO,
POST_CODE,
ROW_NUMBER() OVER (PARTITION BY RR_NO ORDER BY DATE_START DESC) AS ROWNUMBER
FROM
RESIDENCY
WHERE
DATE_END IS NULL
) B ON A.RR_NO = B.RR_NO AND B.ROWNUMBER = 1
WHERE
(A.DATE_DEATH IS NULL OR A.DATE_DEATH > '20090401')
AND
A.RR_NO IN
(
SELECT
RR_NO
FROM
QUARTERLY_TREATMENT
INNER JOIN MODALITY_CODES ON TREATMENT_MODALITY = REGISTRY_CODE
INNER JOIN LOCATIONS ON HOSP_CENTRE = CENTRE_CODE
WHERE
DATE_START <= '20170101' AND
RRT = 1 AND
COUNTRY_CODE IN ('GB-ENG', 'GB-WLS')
) |
NB: There is a new field in the STUDY_PATIENTS for the match score that was returned by NHS Digital should it be required in futue.