measurement_date
Sus OP Measurement
Source column CDSActivityDate. Converts text to dates.
CDSActivityDateStart date of the episode, if exists, else the start date of the spell. CDS ACTIVITY DATE
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')
Comment or raise an issue for this mapping.
Sus CCMDS Measurement - Gestation Length at Delivery
Source column MeasurementDate. Converts text to dates.
MeasurementDateStart date of the Measurement CRITICAL CARE START DATE
select distinct
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
cc.CriticalCareStartDate as MeasurementDate,
coalesce(cc.CriticalCareStartTime, '00:00:00') as MeasurementDateTime,
cc.GestationLengthAtDelivery as ValueAsNumber
from omop_staging.sus_CCMDS cc
inner join omop_staging.sus_APC apc on cc.GeneratedRecordID = apc.GeneratedRecordIdentifier
where apc.NHSNumber is not null
and cc.GestationLengthAtDelivery is not null
Comment or raise an issue for this mapping.
Sus CCMDS Measurement - Person Weight
Source column MeasurementDate. Converts text to dates.
MeasurementDateStart date of the Measurement CRITICAL CARE START DATE
select distinct
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
cc.CriticalCareStartDate as MeasurementDate,
coalesce(cc.CriticalCareStartTime, '00:00:00') as MeasurementDateTime,
cc.PersonWeight as ValueAsNumber
from omop_staging.sus_CCMDS cc
inner join omop_staging.sus_APC apc on cc.GeneratedRecordID = apc.GeneratedRecordIdentifier
where apc.NHSNumber is not null
and cc.PersonWeight is not null
Comment or raise an issue for this mapping.
Sus APC Measurement
Source column CDSActivityDate. Converts text to dates.
CDSActivityDateStart date of the episode, if exists, else the start date of the spell. CDS ACTIVITY DATE
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 Measurement Weight at Start of Regimen
Source column Start_Date_Of_Regimen. Converts text to dates.
Start_Date_Of_RegimenDate the Regiment started START DATE OF REGIMEN
select distinct
NHS_Number,
Weight_At_Start_Of_Regimen,
Start_Date_Of_Regimen
from omop_staging.sact_staging
Comment or raise an issue for this mapping.
SACT Measurement Weight at Start of Cycle
Source column Start_Date_Of_Cycle. Converts text to dates.
Start_Date_Of_CycleDate the Cycle started START DATE OF CYCLE
select distinct
NHS_Number,
Weight_At_Start_Of_Cycle,
Start_Date_Of_Cycle
from omop_staging.sact_staging
Comment or raise an issue for this mapping.
SACT Measurement Height
Source column Start_Date_Of_Regimen. Converts text to dates.
Start_Date_Of_RegimenDate the Regiment started START DATE OF REGIMEN
select distinct
NHS_Number,
Height_At_Start_Of_Regimen,
Start_Date_Of_Regimen
from omop_staging.sact_staging
Comment or raise an issue for this mapping.
Oxford Lab Measurement
Source column EVENT_START_DT_TM. Converts text to dates.
select
NHS_NUMBER,
EVENT,
EVENT_START_DT_TM,
RESULT_VALUE,
RESULT_UNITS,
NORMAL_LOW,
NORMAL_HIGH
from ##duckdb_source##
where lower(EVENT) not like '%comment%'
Comment or raise an issue for this mapping.
COSD V9 Lung Measurement N Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateThe date of the staging measurement, using the stage date if available, otherwise the diagnosis date. STAGE DATE FINAL PRETREATMENT STAGE / DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.NCategoryIntegratedStage' as NCategoryIntegratedStage
from omop_staging.cosd_staging_901
where type = 'LU'
and NCategoryIntegratedStage is not null
and NhsNumber is not null
Comment or raise an issue for this mapping.
COSD V9 Lung Measurement N Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateThe date of the staging measurement, using the stage date if available, otherwise the diagnosis date. STAGE DATE FINAL PRETREATMENT STAGE / DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.NCategoryFinalPretreatment' as NcategoryFinalPreTreatment
from omop_staging.cosd_staging_901
where type = 'LU'
and NcategoryFinalPreTreatment is not null
and NhsNumber is not null
Comment or raise an issue for this mapping.
COSD V9 Lung Measurement M Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateThe date of the staging measurement, using the stage date if available, otherwise the diagnosis date. STAGE DATE FINAL PRETREATMENT STAGE / DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.MCategoryIntegratedStage' as MCategoryIntegratedStage
from omop_staging.cosd_staging_901
where type = 'LU'
and MCategoryIntegratedStage is not null
and NhsNumber is not null
Comment or raise an issue for this mapping.
COSD V9 Lung Measurement M Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateThe date of the staging measurement, using the stage date if available, otherwise the diagnosis date. STAGE DATE FINAL PRETREATMENT STAGE / DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.MCategoryFinalPretreatment' as McategoryFinalPreTreatment
from omop_staging.cosd_staging_901
where type = 'LU'
and McategoryFinalPreTreatment is not null
and NhsNumber is not null
Comment or raise an issue for this mapping.
COSD V9 Lung Measurement Grade of Differentiation (At Diagnosis)
Source column DateOfPrimaryDiagnosisClinicallyAgreed. Converts text to dates.
DateOfPrimaryDiagnosisClinicallyAgreedDATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Diagnosis.GradeOfDifferentiationAtDiagnosis.@code' as GradeOfDifferentiationAtDiagnosis
from omop_staging.cosd_staging_901
where Type = 'LU'
and GradeOfDifferentiationAtDiagnosis is not null
and NhsNumber is not null
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement Tumour Laterality
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. If this is not available, then it is the date when the diagnosis of the Non-Primary Cancer was clinically agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.TumourLaterality.@code' as TumourLaterality
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NhsNumber,
coalesce(ClinicalDateCancerDiagnosis, DateOfNonPrimaryCancerDiagnosisClinicallyAgreed) as MeasurementDate,
TumourLaterality
from lung
where TumourLaterality is not null
and TumourLaterality in ('L','R','M','B')
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement TNM Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTNMStageGrouping' as TnmStageGroupingIntegrated,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NhsNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TnmStageGroupingIntegrated
from lung
where TnmStageGroupingIntegrated is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement TNM Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTNMStageGrouping' as TnmStageGroupingFinalPretreatment,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NhsNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TnmStageGroupingFinalPretreatment
from lung
where TnmStageGroupingFinalPretreatment is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement T Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTCategory' as TCategoryIntegratedStage,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NhsNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TCategoryIntegratedStage
from lung
where TCategoryIntegratedStage is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement T Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTCategory' as TcategoryFinalPreTreatment,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NhsNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TcategoryFinalPreTreatment
from lung
where TcategoryFinalPreTreatment is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement Primary Pathway Metastasis
Source column ClinicalDateCancerDiagnosis. Converts text to dates.
ClinicalDateCancerDiagnosisThe date on which the diagnosis of cancer was made or agreed clinically, excluding the basis of screening alone. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
unnest(
[
[
Record ->> '$.Lung.LungCore.LungCoreDiagnosis.MetastaticSite.@code'
],
Record ->> '$.Lung.LungCore.LungCoreDiagnosis.MetastaticSite[*].@code'
], recursive := true
) as MetastaticSite
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NhsNumber,
ClinicalDateCancerDiagnosis,
MetastaticSite
from lung
where MetastaticSite is not null
and MetastaticSite != 97
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement Non Primary Pathway Metastasis
Source column DateOfNonPrimaryCancerDiagnosisClinicallyAgreed. Converts text to dates.
DateOfNonPrimaryCancerDiagnosisClinicallyAgreedThe date when the diagnosis of the Non-Primary Cancer was clinically agreed. DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with lung as (
select distinct
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
unnest(
[
[ Record ->> '$.Lung.LungCore.LungCoreNonPrimaryCancerPathwayRoute.MetastaticSite.@code' ],
Record ->> '$.Lung.LungCore.LungCoreNonPrimaryCancerPathwayRoute.MetastaticSite[*].@code'
],
recursive := true
) as MetastaticSite
from omop_staging.cosd_staging_81
where type = 'LU'
)
select distinct
NhsNumber,
DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
MetastaticSite
from lung
where MetastaticSite is not null
and MetastaticSite != '97'
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement N Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageNCategory' as NCategoryIntegratedStage,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NhsNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
NCategoryIntegratedStage
from lung
where NCategoryIntegratedStage is not null
and NhsNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement N Category (Final Pretreatment)
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentNCategory' as NcategoryFinalPreTreatment,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NHSNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
NcategoryFinalPreTreatment
from lung
where NcategoryFinalPreTreatment is not null
and NHSNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement M Category (Integrated Stage)
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageMCategory' as MCategoryIntegratedStage,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NHSNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
MCategoryIntegratedStage
from lung
where MCategoryIntegratedStage is not null
and NHSNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement M Category (Final Pretreatment)
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentMCategory' as McategoryFinalPreTreatment,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NHSNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
McategoryFinalPreTreatment
from lung
where McategoryFinalPreTreatment is not null
and NHSNumber is not null;
Comment or raise an issue for this mapping.
COSD V8 Lung Measurement Grade of Differentiation (At Diagnosis)
Source column MeasurementDate. Converts text to dates.
MeasurementDateFor a Primary Pathway, the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed (DATE OF PRIMARY CANCER DIAGNOSIS - CLINICALLY AGREED) is used, whilst for a non-primary pathway, the date where the Non Primary Cancer patient diagnosis was confirmed or agreed (DATE OF NON PRIMARY CANCER DIAGNOSIS - CLINICALLY AGREED) is used DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with lung as (
select
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
Record ->> '$.Lung.LungCore.LungCoreDiagnosis.DiagnosisGradeOfDifferentiation.@code' as GradeOfDifferentiationAtDiagnosis
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select distinct
NHSNumber,
coalesce(ClinicalDateCancerDiagnosis, DateOfNonPrimaryCancerDiagnosisClinicallyAgreed) as MeasurementDate,
GradeOfDifferentiationAtDiagnosis
from lung
where GradeOfDifferentiationAtDiagnosis is not null
and NHSNumber is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement Tumour Laterality
Source column DateOfPrimaryDiagnosisClinicallyAgreed. Converts text to dates.
DateOfPrimaryDiagnosisClinicallyAgreedDATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.TumourLaterality.@code' as TumourLaterality
from omop_staging.cosd_staging_901
where type = 'CO'
and (Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.TumourLaterality.@code') in ('L','R','M','B');
Comment or raise an issue for this mapping.
COSD V9 Measurement TNM Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.TnmStageGroupingIntegrated' as TnmStageGroupingIntegrated
from omop_staging.cosd_staging_901
where type = 'CO'
and TnmStageGroupingIntegrated is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement TNM Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.TnmStageGroupingFinalPretreatment' as TnmStageGroupingFinalPretreatment
from omop_staging.cosd_staging_901
where type = 'CO'
and TnmStageGroupingFinalPretreatment is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement T Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.TCategoryIntegratedStage' as TCategoryIntegratedStage
from omop_staging.cosd_staging_901
where type = 'CO'
and TCategoryIntegratedStage is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement T Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.TCategoryFinalPretreatment' as TcategoryFinalPreTreatment
from omop_staging.cosd_staging_901
where type = 'CO'
and TcategoryFinalPreTreatment is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement Synchronous Tumour Indicator
Source column DateOfPrimaryDiagnosisClinicallyAgreed. Converts text to dates.
DateOfPrimaryDiagnosisClinicallyAgreedDATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Diagnosis.DiagnosisColorectal.SynchronousTumourIndicator.@code' as SynchronousTumourIndicator
from omop_staging.cosd_staging_901
where type = 'CO'
and SynchronousTumourIndicator is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement Primary Pathway Metastasis
Source column DateOfPrimaryDiagnosisClinicallyAgreed. Converts text to dates.
DateOfPrimaryDiagnosisClinicallyAgreedDATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with CO as (
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
unnest(
[
[ Record ->> '$.PrimaryPathway.Diagnosis.MetastaticTypeAndSiteDiagnosis.MetastaticSite.@code' ],
Record ->> '$.PrimaryPathway.Diagnosis.MetastaticTypeAndSiteDiagnosis[*].MetastaticSite.@code'
],
recursive := true
) as MetastaticSite
from omop_staging.cosd_staging_901
where type = 'CO'
)
select distinct
NhsNumber,
DateOfPrimaryDiagnosisClinicallyAgreed,
MetastaticSite
from CO
where MetastaticSite is not null
and MetastaticSite != '97';
Comment or raise an issue for this mapping.
COSD V9 Measurement Non Primary Pathway Recurrence Metastasis
Source column DateOfNonPrimaryCancerDiagnosisClinicallyAgreed. Converts text to dates.
DateOfNonPrimaryCancerDiagnosisClinicallyAgreedIs the date where the Non Primary Cancer PATIENT DIAGNOSIS was confirmed or agreed. DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with CO as (
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.NonPrimaryPathway.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
unnest(
[
[ Record ->> '$.NonPrimaryPathway.Recurrence.MetastaticTypeAndSiteRecurrence.MetastaticSite.@code' ],
Record ->> '$.NonPrimaryPathway.Recurrence.MetastaticTypeAndSiteRecurrence[*].MetastaticSite.@code'
],
recursive := true
) as MetastaticSite
from omop_staging.cosd_staging_901
where type = 'CO'
)
select distinct
NhsNumber,
DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
MetastaticSite
from CO
where MetastaticSite is not null
and MetastaticSite != '97';
Comment or raise an issue for this mapping.
COSD V9 Measurement Non Primary Pathway Progression Metastasis
Source column DateOfNonPrimaryCancerDiagnosisClinicallyAgreed. Converts text to dates.
DateOfNonPrimaryCancerDiagnosisClinicallyAgreedIs the date where the Non Primary Cancer PATIENT DIAGNOSIS was confirmed or agreed. DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with CO as (
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.NonPrimaryPathway.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
unnest(
[
[ Record ->> '$.NonPrimaryPathway.Progression.MetastaticTypeAndSiteProgression.MetastaticSite.@code' ],
Record ->> '$.NonPrimaryPathway.Progression.MetastaticTypeAndSiteProgression[*].MetastaticSite.@code'
],
recursive := true
) as MetastaticSite
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
NhsNumber,
DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
MetastaticSite
from CO
where MetastaticSite is not null
and MetastaticSite != '97';
Comment or raise an issue for this mapping.
COSD V9 Measurement N Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.NCategoryIntegratedStage' as NCategoryIntegratedStage
from omop_staging.cosd_staging_901
where type = 'CO'
and NCategoryIntegratedStage is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement N Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
select distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.NCategoryFinalPretreatment' as NcategoryFinalPreTreatment
from omop_staging.cosd_staging_901
where type = 'CO'
and NcategoryFinalPreTreatment is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement M Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage',
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
Record ->> '$.PrimaryPathway.Staging.MCategoryIntegratedStage' as MCategoryIntegratedStage
from omop_staging.cosd_staging_901
where Type = 'CO'
and MCategoryIntegratedStage is not null;
Comment or raise an issue for this mapping.
COSD V9 Measurement M Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
select
distinct
record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
coalesce(
record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage',
record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed'
) as MeasurementDate,
record ->> '$.PrimaryPathway.Staging.MCategoryFinalPretreatment' as McategoryFinalPreTreatment
from omop_staging.cosd_staging_901
where type = 'CO'
and McategoryFinalPreTreatment is not null
Comment or raise an issue for this mapping.
COSD V9 Measurement Grade of Differentiation (At Diagnosis)
Source column DateOfPrimaryDiagnosisClinicallyAgreed. Converts text to dates.
DateOfPrimaryDiagnosisClinicallyAgreedDATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
select
distinct
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Diagnosis.GradeOfDifferentiationAtDiagnosis.@code' as GradeOfDifferentiationAtDiagnosis,
from omop_staging.cosd_staging_901
where Type = 'CO'
and GradeOfDifferentiationAtDiagnosis is not null
Comment or raise an issue for this mapping.
COSD V8 Measurement Tumour Laterality
Source column MeasurementDate. Converts text to dates.
MeasurementDateFor a Primary Pathway, the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed (DATE OF PRIMARY CANCER DIAGNOSIS - CLINICALLY AGREED) is used, whilst for a non-primary pathway, the date where the Non Primary Cancer patient diagnosis was confirmed or agreed (DATE OF NON PRIMARY CANCER DIAGNOSIS - CLINICALLY AGREED) is used DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.TumourLaterality.@code' as TumourLaterality
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(ClinicalDateCancerDiagnosis, DateOfNonPrimaryCancerDiagnosisClinicallyAgreed) as MeasurementDate,
TumourLaterality
from co
where TumourLaterality is not null
and TumourLaterality in ('L','R','M','B');
Comment or raise an issue for this mapping.
COSD V8 Measurement Tumour Height Above Anal Verge
Source column ClinicalDateCancerDiagnosis. Converts text to dates.
ClinicalDateCancerDiagnosisFor a Primary Pathway, the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.ColorectalDiagnosis.TumourHeightAboveAnalVerge.@value' as TumourHeightAboveAnalVerge
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
ClinicalDateCancerDiagnosis,
TumourHeightAboveAnalVerge
from co
where TumourHeightAboveAnalVerge is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement TNM Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGrouping' as TnmStageGroupingIntegrated,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TnmStageGroupingIntegrated
from co
where TnmStageGroupingIntegrated is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement TNM Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGrouping' as TnmStageGroupingFinalPretreatment,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TnmStageGroupingFinalPretreatment
from co
where TnmStageGroupingFinalPretreatment is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement T Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTCategory' as TCategoryIntegratedStage,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TCategoryIntegratedStage
from co
where TCategoryIntegratedStage is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement T Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTCategory' as TcategoryFinalPreTreatment,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
TcategoryFinalPreTreatment
from co
where TcategoryFinalPreTreatment is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement Synchronous Tumour Indicator
Source column ClinicalDateCancerDiagnosis. Converts text to dates.
ClinicalDateCancerDiagnosisThe date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.ColorectalDiagnosis.SynchronousTumourColonLocation.@code' as SynchronousTumourIndicator
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
ClinicalDateCancerDiagnosis,
SynchronousTumourIndicator
from co
where SynchronousTumourIndicator is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement Primary Pathway Metastasis
Source column ClinicalDateCancerDiagnosis. Converts text to dates.
ClinicalDateCancerDiagnosisDATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with co as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
unnest(
[
[
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.MetastaticSite.@code'
],
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.MetastaticSite[*].@code'
], recursive := true
) as MetastaticSite
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
ClinicalDateCancerDiagnosis,
MetastaticSite
from co
where MetastaticSite is not null
and MetastaticSite != 97;
Comment or raise an issue for this mapping.
COSD V8 Measurement Non Primary Pathway Metastasis
Source column DateOfNonPrimaryCancerDiagnosisClinicallyAgreed. Converts text to dates.
DateOfNonPrimaryCancerDiagnosisClinicallyAgreedIs the date where the Non Primary Cancer PATIENT DIAGNOSIS was confirmed or agreed. DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with co as (
select distinct
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
unnest(
[
[ Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreNonPrimaryCancerPathwayRoute.MetastaticSite.@code' ],
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreNonPrimaryCancerPathwayRoute.MetastaticSite[*].@code'
],
recursive := true
) as MetastaticSite
from omop_staging.cosd_staging_81
where type = 'CO'
)
select distinct
NhsNumber,
DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
MetastaticSite
from co
where MetastaticSite is not null
and MetastaticSite != '97';
Comment or raise an issue for this mapping.
COSD V8 Measurement N Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageNCategory' as NCategoryIntegratedStage,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
NCategoryIntegratedStage
from CO
where NCategoryIntegratedStage is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement N Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentNCategory' as NcategoryFinalPreTreatment,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
NcategoryFinalPreTreatment
from CO
where NcategoryFinalPreTreatment is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement M Category Integrated Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Integrated) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (INTEGRATED)
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageMCategory' as MCategoryIntegratedStage,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as StageDateIntegratedStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateIntegratedStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
MCategoryIntegratedStage
from CO
where MCategoryIntegratedStage is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement M Category Final Pre Treatment Stage
Source column MeasurementDate. Converts text to dates.
MeasurementDateMeasurement Date is the date on which TNM Stage Grouping (Final pre-treatment) was recorded, but if this is not available, then it is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed. DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT)
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentMCategory' as McategoryFinalPreTreatment,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as StageDateFinalPretreatmentStage
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(StageDateFinalPretreatmentStage, ClinicalDateCancerDiagnosis) as MeasurementDate,
McategoryFinalPreTreatment
from CO
where McategoryFinalPreTreatment is not null;
Comment or raise an issue for this mapping.
COSD V8 Measurement Grade of Differentiation (At Diagnosis)
Source column MeasurementDate. Converts text to dates.
MeasurementDateFor a Primary Pathway, the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed (DATE OF PRIMARY CANCER DIAGNOSIS - CLINICALLY AGREED) is used, whilst for a non-primary pathway, the date where the Non Primary Cancer patient diagnosis was confirmed or agreed (DATE OF NON PRIMARY CANCER DIAGNOSIS - CLINICALLY AGREED) is used DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as DateOfNonPrimaryCancerDiagnosisClinicallyAgreed,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.DiagnosisGradeOfDifferentiation.@code' as GradeOfDifferentiationAtDiagnosis
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select distinct
NhsNumber,
coalesce(ClinicalDateCancerDiagnosis, DateOfNonPrimaryCancerDiagnosisClinicallyAgreed) as MeasurementDate,
GradeOfDifferentiationAtDiagnosis
from CO
where GradeOfDifferentiationAtDiagnosis is not null;