condition_source_value
SUS Outpatient Condition Occurrence
-
Value copied from
DiagnosisICD -
DiagnosisICDICD10 diagnosis code PRIMARY DIAGNOSIS (ICD)
select
distinct
d.DiagnosisICD,
op.GeneratedRecordIdentifier,
op.NHSNumber,
op.CDSActivityDate
from omop_staging.sus_OP_ICDDiagnosis d
inner join omop_staging.sus_OP op
on d.MessageId = op.MessageId
where op.NHSNumber is not null
and AttendedorDidNotAttend in ('5','6')
order by
d.DiagnosisICD,
op.GeneratedRecordIdentifier,
op.NHSNumber,
op.CDSActivityDate
Comment or raise an issue for this mapping.
SUS Inpatient Condition Occurrence
-
Value copied from
DiagnosisICD -
DiagnosisICDICD10 diagnosis code PRIMARY DIAGNOSIS (ICD)
select
distinct
d.DiagnosisICD,
apc.GeneratedRecordIdentifier,
apc.NHSNumber,
apc.CDSActivityDate
from omop_staging.sus_ICDDiagnosis d
inner join omop_staging.sus_APC apc
on d.MessageId = apc.MessageId
where apc.NHSNumber is not null
order by
d.DiagnosisICD,
apc.GeneratedRecordIdentifier,
apc.NHSNumber,
apc.CDSActivityDate
Comment or raise an issue for this mapping.
SACT Condition Occurrence
-
Value copied from
Primary_Diagnosis -
Primary_DiagnosisPRIMARY DIAGNOSIS (ICD AT START SYSTEMIC ANTI-CANCER THERAPY) is the PRIMARY DIAGNOSIS (ICD) at the start of the Systemic Anti-Cancer Therapy. PRIMARY DIAGNOSIS (ICD AT START SYSTEMIC ANTI-CANCER THERAPY)
select
Primary_Diagnosis,
replace(NHS_Number, ' ', '') as NHS_Number,
min(Administration_Date) as Administration_Date
from omop_staging.sact_staging
group by
Primary_Diagnosis,
NHS_Number
order by
NHS_Number,
Primary_Diagnosis,
min(Administration_Date)
Comment or raise an issue for this mapping.
Rtds Condition Occurrence
with results as (
select
distinct
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = dc.PatientSer limit 1) as PatientId,
dc.DiagnosisCode,
dc.DateStamp as event_start_date,
dc.DateStamp as event_end_date
from omop_staging.RTDS_5_Diagnosis_Course dc
where dc.DiagnosisTableName = 'ICD-10'
)
select
PatientId,
DiagnosisCode,
event_start_date,
event_end_date
from results
where
PatientId is not null
and regexp_matches(patientid, '\d{10}');
Comment or raise an issue for this mapping.
COSD V9 Lung Condition Occurrence Recurrence
-
Value copied from
NonPrimaryRecurrenceOriginalDiagnosis -
NonPrimaryRecurrenceOriginalDiagnosisORIGINAL PRIMARY DIAGNOSIS (ICD) is the International Classification of Diseases (ICD) code of the original PATIENT DIAGNOSIS relating to the cancer recurrence. ORIGINAL PRIMARY DIAGNOSIS (ICD)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.NonPrimaryPathway.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
Record ->> '$.NonPrimaryPathway.Recurrence.OriginalPrimaryDiagnosisIcd.@code' as NonPrimaryRecurrenceOriginalDiagnosis
from omop_staging.cosd_staging_901
where type = 'LU'
and NonPrimaryRecurrenceOriginalDiagnosis is not null
and DateOfNonPrimaryCancerDiagnosisClinicallyAgreed is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V9 Lung Condition Occurrence Progression
-
Value copied from
NonPrimaryProgressionOriginalDiagnosis -
NonPrimaryProgressionOriginalDiagnosisCANCER PROGRESSION (ICD ORIGINAL) is the International Classification of Diseases (ICD) code of the original PATIENT DIAGNOSIS of the Cancer Progression. CANCER PROGRESSION (ICD ORIGINAL)
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.NonPrimaryPathway.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
Record ->> '$.NonPrimaryPathway.Progression.ProgressionIcd.@code' as NonPrimaryProgressionOriginalDiagnosis
from omop_staging.cosd_staging_901
where type = 'LU'
and NonPrimaryProgressionOriginalDiagnosis is not null
and NonPrimaryDiagnosisDate is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Condition Occurrence Progression
-
Value copied from
NonPrimaryProgressionOriginalDiagnosis -
NonPrimaryProgressionOriginalDiagnosisCANCER PROGRESSION (ICD ORIGINAL) is the International Classification of Diseases (ICD) code of the original PATIENT DIAGNOSIS of the Cancer Progression. CANCER PROGRESSION (ICD ORIGINAL)
select distinct
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
Record ->> '$.Lung.LungCore.LungCoreNonPrimaryCancerPathwayRoute.CancerProgressionICD.@code' as NonPrimaryProgressionOriginalDiagnosis
from omop_staging.cosd_staging_81
where type = 'LU'
and NonPrimaryProgressionOriginalDiagnosis is not null
and NonPrimaryDiagnosisDate is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Condition Occurrence Primary Diagnosis
-
Value copied from
CancerDiagnosis -
CancerDiagnosisThe primary diagnosis code for the cancer. PRIMARY DIAGNOSIS
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as DiagnosisDate,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
Record ->> '$.Lung.LungCore.LungCoreDiagnosis.MorphologyICDODiagnosis.@code' as CancerHistology,
Record ->> '$.Lung.LungCore.LungCoreDiagnosis.TopographyICDO.@code' as CancerTopography,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.PrimaryDiagnosis.@code'as CancerDiagnosis
from omop_staging.cosd_staging_81 lu
where lu.Type = 'LU'
)
select
distinct
NHSNumber,
coalesce(DiagnosisDate, NonPrimaryDiagnosisDate) as DiagnosisDate,
CancerHistology,
CancerTopography,
CancerDiagnosis
from lung
where NHSNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Condition Occurrence Primary Diagnosis Histology Topography
Source columns CancerHistology, CancerTopography. Separates text with newlines. Trim whitespace.
-
CancerHistologyMORPHOLOGY (ICD-O CANCER TRANSFORMATION) is the morphology code of the Cancer Transformation using the ICD-O CODE. MORPHOLOGY (ICD-O CANCER TRANSFORMATION) -
CancerTopographyTOPOGRAPHY (ICD-O) is the topographical site of the Tumour using the ICD-O CODE. TOPOGRAPHY (ICD-O)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as DiagnosisDate,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
Record ->> '$.Lung.LungCore.LungCoreDiagnosis.MorphologyICDODiagnosis.@code' as CancerHistology,
Record ->> '$.Lung.LungCore.LungCoreDiagnosis.TopographyICDO.@code' as CancerTopography,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.PrimaryDiagnosis.@code'as CancerDiagnosis
from omop_staging.cosd_staging_81 lu
where lu.Type = 'LU'
)
select
distinct
NHSNumber,
coalesce(DiagnosisDate, NonPrimaryDiagnosisDate) as DiagnosisDate,
CancerHistology,
CancerTopography,
CancerDiagnosis
from lung
where NHSNumber is not null
and CancerHistology is not null
and CancerTopography is not null;
Comment or raise an issue for this mapping.
Cosd V8 Condition Occurrence Primary Diagnosis
-
Value copied from
CancerDiagnosis -
CancerDiagnosisPRIMARY DIAGNOSIS (ICD) is the International Classification of Diseases (ICD) code used to identify the PRIMARY DIAGNOSIS. PRIMARY DIAGNOSIS (ICD)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as DiagnosisDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.MorphologyICDODiagnosis.@code' as CancerHistology,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.TopographyICDO.@code' as CancerTopography,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.BasisOfCancerDiagnosis.@code' as BasisOfDiagnosisCancer,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.PrimaryDiagnosis.@code' as CancerDiagnosis
from omop_staging.cosd_staging_81 co
where co.Type = 'CO'
)
select
distinct
NhsNumber,
coalesce (DiagnosisDate, NonPrimaryDiagnosisDate) as DiagnosisDate,
BasisOfDiagnosisCancer,
CancerDiagnosis
from CO
where NhsNumber is not null and
(
DiagnosisDate is not null or
NonPrimaryDiagnosisDate is not null
);
Comment or raise an issue for this mapping.
Cosd V8 Condition Occurrence Primary Diagnosis Histology Topography
Source columns CancerHistology, CancerTopography. Separates text with newlines. Trim whitespace.
-
CancerHistologyMORPHOLOGY (ICD-O CANCER TRANSFORMATION) is the morphology code of the Cancer Transformation using the ICD-O CODE. MORPHOLOGY (ICD-O CANCER TRANSFORMATION) -
CancerTopographyTOPOGRAPHY (ICD-O) is the topographical site of the Tumour using the ICD-O CODE. TOPOGRAPHY (ICD-O)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as DiagnosisDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.MorphologyICDODiagnosis.@code' as CancerHistology,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.TopographyICDO.@code' as CancerTopography,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.BasisOfCancerDiagnosis.@code' as BasisOfDiagnosisCancer,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.PrimaryDiagnosis.@code' as CancerDiagnosis
from omop_staging.cosd_staging_81 co
where co.Type = 'CO'
)
select
distinct
NhsNumber,
coalesce (DiagnosisDate, NonPrimaryDiagnosisDate) as DiagnosisDate,
BasisOfDiagnosisCancer,
CancerHistology,
CancerTopography
from CO
where NhsNumber is not null and
(
DiagnosisDate is not null or
NonPrimaryDiagnosisDate is not null
)
and (CancerHistology is not null and CancerTopography is not null)
Comment or raise an issue for this mapping.
COSD V9 Condition Occurrence Recurrence
-
Value copied from
SecondaryDiagnosis -
SecondaryDiagnosisSECONDARY DIAGNOSIS (ICD) is the International Classification of Diseases (ICD) code used to identify the secondary PATIENT DIAGNOSIS. SECONDARY DIAGNOSIS (ICD)
with CO as (
select
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Diagnosis.DiagnosisAdditionalItems.SecondaryDiagnosisIcd.@code' as SecondaryDiagnosis
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
NhsNumber,
DateOfPrimaryDiagnosisClinicallyAgreed,
max(SecondaryDiagnosis) as SecondaryDiagnosis
from CO
where DateOfPrimaryDiagnosisClinicallyAgreed is not null
and SecondaryDiagnosis is not null
group by NhsNumber, DateOfPrimaryDiagnosisClinicallyAgreed;
Comment or raise an issue for this mapping.
COSD V9 Condition Occurrence Recurrence
-
Value copied from
NonPrimaryRecurrenceOriginalDiagnosis -
NonPrimaryRecurrenceOriginalDiagnosisPRIMARY DIAGNOSIS (ICD ORIGINAL) is the International Classification of Diseases (ICD) code used to identify the original PRIMARY DIAGNOSIS. PRIMARY DIAGNOSIS (ICD ORIGINAL)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.NonPrimaryPathway.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
Record ->> '$.NonPrimaryPathway.Recurrence.OriginalPrimaryDiagnosisIcd.@code' as NonPrimaryRecurrenceOriginalDiagnosis
from omop_staging.cosd_staging_901
where type = 'CO'
and NonPrimaryRecurrenceOriginalDiagnosis is not null;
Comment or raise an issue for this mapping.
COSD V9 Condition Occurrence Progression
-
Value copied from
NonPrimaryProgressionOriginalDiagnosis -
NonPrimaryProgressionOriginalDiagnosisCANCER PROGRESSION (ICD ORIGINAL) is the International Classification of Diseases (ICD) code of the original PATIENT DIAGNOSIS of the Cancer Progression. CANCER PROGRESSION (ICD ORIGINAL)
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.NonPrimaryPathway.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
Record ->> '$.NonPrimaryPathway.Progression.ProgressionIcd.@code' as NonPrimaryProgressionOriginalDiagnosis
from omop_staging.cosd_staging_901
where type = 'CO'
and NonPrimaryProgressionOriginalDiagnosis is not null;
Comment or raise an issue for this mapping.
COSD V9 Condition Occurrence Primary Diagnosis
-
Value copied from
CancerDiagnosis -
CancerDiagnosisThe basis of how a PATIENT DIAGNOSIS relating to cancer was identified. BASIS OF DIAGNOSIS (CANCER)
with co as (
select
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Diagnosis."MorphologyIcd-o-3"."@code"' as CancerHistology,
Record ->> '$.PrimaryPathway.Diagnosis."TopographyIcd-o-3"."@code"' as CancerTopography,
Record ->> '$.PrimaryPathway.Diagnosis.BasisOfDiagnosisCancer.@code' as BasisOfDiagnosisCancer,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.PrimaryDiagnosisIcd.@code' as CancerDiagnosis
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
NhsNumber,
DateOfPrimaryDiagnosisClinicallyAgreed,
max(BasisOfDiagnosisCancer) as BasisOfDiagnosisCancer,
CancerDiagnosis
from co
where DateOfPrimaryDiagnosisClinicallyAgreed is not null
group by NhsNumber, DateOfPrimaryDiagnosisClinicallyAgreed, CancerDiagnosis;
Comment or raise an issue for this mapping.
COSD V9 Condition Occurrence Primary Diagnosis Histology Topography
Source columns CancerHistology, CancerTopography. Separates text with newlines. Trim whitespace.
-
CancerHistologyMORPHOLOGY (ICD-O CANCER TRANSFORMATION) is the morphology code of the Cancer Transformation using the ICD-O CODE. MORPHOLOGY (ICD-O CANCER TRANSFORMATION) -
CancerTopographyTOPOGRAPHY (ICD-O) is the topographical site of the Tumour using the ICD-O CODE. TOPOGRAPHY (ICD-O)
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Diagnosis.BasisOfDiagnosisCancer.@code' as BasisOfDiagnosisCancer,
Record ->> '$.PrimaryPathway.Diagnosis."MorphologyIcd-o-3"."@code"' as CancerHistology,
Record ->> '$.PrimaryPathway.Diagnosis."TopographyIcd-o-3"."@code"' as CancerTopography
from omop_staging.cosd_staging_901
where type = 'CO'
and DateOfPrimaryDiagnosisClinicallyAgreed is not null
and CancerHistology is not null
and CancerTopography not null;