observation_datetime
SUS OP Source Of Referral For Outpatients
Source columns AppointmentDate, AppointmentTime. Combines a date with a time of day.
-
AppointmentDateEvent date APPOINTMENT DATE -
AppointmentTimeThe time, advised to a PATIENT for when they can expect to see a relevant CARE PROFESSIONAL at an Out-Patient Clinic. APPOINTMENT TIME
select
NHSNumber,
GeneratedRecordIdentifier,
AppointmentDate,
AppointmentTime,
ReferrerCode -- Referrer code is the code of the person making the referral request
from omop_staging.sus_OP
where ReferrerCode is not null
and NHSNumber is not null
and AttendedorDidNotAttend in ('5','6')
order by NHSNumber,
GeneratedRecordIdentifier,
AppointmentDate,
AppointmentTime,
ReferrerCode
Comment or raise an issue for this mapping.
SUS OP Referral Received Date For Outpatients
Source columns AppointmentDate, AppointmentTime. Combines a date with a time of day.
-
AppointmentDateEvent date APPOINTMENT DATE -
AppointmentTimeThe time, advised to a PATIENT for when they can expect to see a relevant CARE PROFESSIONAL at an Out-Patient Clinic. APPOINTMENT TIME
select
op.NHSNumber,
op.AppointmentDate,
op.AppointmentTime,
op.ReferralRequestReceivedDate,
op.GeneratedRecordIdentifier
from omop_staging.sus_OP op
where ReferralRequestReceivedDate is not null
and op.NHSNumber is not null
and AttendedorDidNotAttend in ('5','6')
order by op.NHSNumber,
op.AppointmentDate,
op.AppointmentTime,
op.ReferralRequestReceivedDate,
op.GeneratedRecordIdentifier
Comment or raise an issue for this mapping.
SUS Outpatient Carer Support Indicator Observation
Source column CDSActivityDate. Converts text to dates.
CDSActivityDateEvent date CDS ACTIVITY DATE
select
op.NHSNumber,
max(op.CDSActivityDate) as CDSActivityDate,
op.CarerSupportIndicator,
op.GeneratedRecordIdentifier
from omop_staging.sus_OP op
where op.CarerSupportIndicator is not null
and op.NHSNumber is not null
and AttendedorDidNotAttend in ('5','6')
group by
op.NHSNumber,
op.CarerSupportIndicator,
op.GeneratedRecordIdentifier;
Comment or raise an issue for this mapping.
Sus CCMDS High Cost Drugs
Source columns ObservationDate, ObservationDateTime. Combines a date with a time of day.
-
ObservationDateStart date of the visit CRITICAL CARE START DATE -
ObservationDateTimeStart time of the visit, if exists, else midnight. CRITICAL CARE START TIME
select distinct
apc.NHSNumber,
apc.HospitalProviderSpellNumber,
cc.CriticalCareStartDate as ObservationDate,
coalesce(cc.CriticalCareStartTime, '00:00:00') as ObservationDateTime,
d.CriticalCareHighCostDrugs as ObservationSourceValue
from omop_staging.sus_CCMDS_CriticalCareHighCostDrugs d
inner join omop_staging.sus_CCMDS cc on d.MessageId = cc.MessageId
inner join omop_staging.sus_APC apc on cc.GeneratedRecordID = apc.GeneratedRecordIdentifier
where apc.NHSNumber is not null
Comment or raise an issue for this mapping.
SUS Inpatient Total Previous Pregnancies Observation
Source column observation_date. Converts text to dates.
observation_dateEvent date CDS ACTIVITY DATE
select
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
max(apc.CDSActivityDate) as observation_date,
apc.PregnancyTotalPreviousPregnancies
from omop_staging.sus_APC apc
where apc.NHSNumber is not null
and apc.PregnancyTotalPreviousPregnancies is not null
and apc.CDSActivityDate is not null
and apc.CdsType in ('140', '120')
group by
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
apc.PregnancyTotalPreviousPregnancies;
Comment or raise an issue for this mapping.
SUS APC Source Of Referral For Inpatients
Source columns StartDateHospitalProviderSpell, StartTimeHospitalProviderSpell. Combines a date with a time of day.
-
StartDateHospitalProviderSpellEvent date START DATE (HOSPITAL PROVIDER SPELL) -
StartTimeHospitalProviderSpellRecords whether anaesthetic was given during Labour/ Delivery, and the type used. START TIME (HOSPITAL PROVIDER SPELL)
select
NHSNumber,
GeneratedRecordIdentifier,
StartDateHospitalProviderSpell,
StartTimeHospitalProviderSpell,
ReferrerCode -- Referrer code is the code of the person making the referral request
FROM omop_staging.sus_APC
where NHSNumber is not null
Comment or raise an issue for this mapping.
SUS APC Referral Received Date For Inpatients
Source columns StartDateHospitalProviderSpell, StartTimeHospitalProviderSpell. Combines a date with a time of day.
-
StartDateHospitalProviderSpellSTART DATE (HOSPITAL PROVIDER SPELL) is the Start Date of the Hospital Provider Spell. START DATE (HOSPITAL PROVIDER SPELL) -
StartTimeHospitalProviderSpellSTART TIME (HOSPITAL PROVIDER SPELL) is the Start Time of the Hospital Provider Spell . START TIME (HOSPITAL PROVIDER SPELL)
select
apc.NHSNumber,
apc.StartDateHospitalProviderSpell,
apc.StartTimeHospitalProviderSpell,
apc.ReferralToTreatmentPeriodStartDate,
apc.GeneratedRecordIdentifier
from omop_staging.sus_APC apc
where ReferralToTreatmentPeriodStartDate is not null
and apc.NHSNumber is not null
Comment or raise an issue for this mapping.
SUS Inpatient NumberofBabies Observation
Source column observation_date. Converts text to dates.
observation_dateEvent date CDS ACTIVITY DATE, DELIVERY DATE
select
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
coalesce(max(apc.DeliveryDate), max(apc.CDSActivityDate)) as observation_date,
apc.NumberofBabies
from omop_staging.sus_APC apc
where apc.NHSNumber is not null
and apc.NumberofBabies is not null
and apc.CDSType in ('120','140')
group by
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
apc.DeliveryDate,
apc.NumberofBabies;
Comment or raise an issue for this mapping.
SUS Inpatient Gestation Length Labour Onset Observation
Source column observation_date. Converts text to dates.
observation_dateEvent date CDS ACTIVITY DATE, DELIVERY DATE
select
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
coalesce(max(apc.DeliveryDate), max(apc.CDSActivityDate)) as observation_date,
apc.GestationLengthLabourOnset
from omop_staging.sus_APC as apc
where apc.NHSNumber is not null
and apc.GestationLengthLabourOnset is not null
and apc.CDSType in ('120', '140')
group by
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
apc.DeliveryDate,
apc.GestationLengthLabourOnset;
Comment or raise an issue for this mapping.
SUS Inpatient Carer Support Indicator Observation
Source column CDSActivityDate. Converts text to dates.
CDSActivityDateEvent date CDS ACTIVITY DATE
select
apc.NHSNumber,
max(apc.CDSActivityDate) as CDSActivityDate,
apc.CarerSupportIndicator,
apc.HospitalProviderSpellNumber,
apc.GeneratedRecordIdentifier
from omop_staging.sus_APC apc
where apc.CarerSupportIndicator is not null
and apc.NHSNumber is not null
group by
apc.NHSNumber,
apc.CarerSupportIndicator,
apc.HospitalProviderSpellNumber,
apc.GeneratedRecordIdentifier;
Comment or raise an issue for this mapping.
Sus APC Birth Weight Observation
Source column observation_date. Converts text to dates.
observation_dateEvent date CDS ACTIVITY DATE, DELIVERY DATE
select
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
coalesce(max(apc.DeliveryDate), max(apc.CDSActivityDate)) as observation_date,
b.BirthWeightBaby as BirthWeight
from omop_staging.sus_APC apc
inner join omop_staging.sus_Birth as b
on apc.MessageId = b.MessageId
where b.BirthWeightBaby is not null
and apc.NHSNumber is not null
and apc.CdsType in ('140', '120')
group by
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
apc.DeliveryDate,
b.BirthWeightBaby;
Comment or raise an issue for this mapping.
SUS APC Anaesthetic Given Post Labour Delivery Observation
Source column observation_date. Converts text to dates.
observation_dateEvent date CDS ACTIVITY DATE
select
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
coalesce(max(apc.DeliveryDate), max(apc.CDSActivityDate)) as observation_date,
apc.AnaestheticGivenPostDelivery
from omop_staging.sus_APC as apc
where apc.AnaestheticGivenPostDelivery is not null
and apc.NHSNumber is not null
and apc.CdsType in ('140', '120')
group by
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
apc.DeliveryDate,
apc.AnaestheticGivenPostDelivery;
Comment or raise an issue for this mapping.
SUS APC Anaesthetic During Labour Delivery Observation
Source column observation_date. Converts text to dates.
observation_dateEvent date CDS ACTIVITY DATE, DELIVERY DATE
select
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
coalesce(max(apc.DeliveryDate), max(apc.CDSActivityDate)) as observation_date,
apc.HospitalProviderSpellNumber,
apc.AnaestheticGivenDuringLabourDelivery
from omop_staging.sus_APC as apc
where apc.AnaestheticGivenDuringLabourDelivery is not null
and apc.NHSNumber is not null
and apc.CdsType in ('140', '120')
group by
apc.NHSNumber,
apc.GeneratedRecordIdentifier,
apc.HospitalProviderSpellNumber,
apc.DeliveryDate,
apc.AnaestheticGivenDuringLabourDelivery;
Comment or raise an issue for this mapping.
SUS AE Source Of Referral For AE
Source columns ArrivalDate, ArrivalTime. Combines a date with a time of day.
-
ArrivalDateEvent date ARRIVAL DATE -
ArrivalTimeThe time (using a 24 hour clock) that is of relevance to an ACTIVITY. ARRIVAL TIME AT ACCIDENT AND EMERGENCY DEPARTMENT
select
NHSNumber,
GeneratedRecordIdentifier,
ArrivalDate,
ArrivalTime,
SourceofReferralForAE -- Referrer code is the code of the person making the referral request
from omop_staging.sus_AE
where SourceofReferralForAE is not null
Comment or raise an issue for this mapping.
SUS AE Diabetic Patient
Source columns ArrivalDate, ArrivalTime. Combines a date with a time of day.
-
ArrivalDateEvent date ARRIVAL DATE -
ArrivalTimeThe time (using a 24 hour clock) that is of relevance to an ACTIVITY. ARRIVAL TIME AT ACCIDENT AND EMERGENCY DEPARTMENT
select
distinct
d.AccidentAndEmergencyDiagnosis,
ae.GeneratedRecordIdentifier,
ae.NHSNumber,
ae.ArrivalDate,
ae.ArrivalTime
from omop_staging.sus_AE_diagnosis d
inner join omop_staging.sus_AE ae
on d.MessageId = ae.MessageId
where ae.NHSNumber is not null
and d.AccidentAndEmergencyDiagnosis in ('30','301')
Comment or raise an issue for this mapping.
SUS AE Diabetic Patient
Source columns ArrivalDate, ArrivalTime. Combines a date with a time of day.
-
ArrivalDateEvent date ARRIVAL DATE -
ArrivalTimeThe time (using a 24 hour clock) that is of relevance to an ACTIVITY. ARRIVAL TIME AT ACCIDENT AND EMERGENCY DEPARTMENT
select
distinct
d.AccidentAndEmergencyDiagnosis,
ae.GeneratedRecordIdentifier,
ae.NHSNumber,
ae.ArrivalDate,
ae.ArrivalTime
from omop_staging.sus_AE_diagnosis d
inner join omop_staging.sus_AE ae
on d.MessageId = ae.MessageId
where ae.NHSNumber is not null
and d.AccidentAndEmergencyDiagnosis in ('20','201')
Comment or raise an issue for this mapping.
SACT Adjunctive Therapy Type
Source columns Administration_Date, Administration_Date. Combines a date with a time of day.
-
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE -
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE
select distinct
replace(NHS_Number, ' ', '') as NHSNumber,
Adjunctive_Therapy,
Case
When Adjunctive_Therapy = 1 then concat(Adjunctive_Therapy, ' - Adjuvant Therapy')
When Adjunctive_Therapy = 2 then concat(Adjunctive_Therapy, ' - Neoadjuvant Therapy')
When Intent_Of_Treatment = 3 then concat(Adjunctive_Therapy, ' - Not Applicable (Primary Treatment)')
When Intent_Of_Treatment = 9 then concat(Adjunctive_Therapy, ' - Not Known (Not Recorded)')
else '' end as Source_value,
Administration_Date
from omop_staging.sact_staging
where Adjunctive_Therapy != ''
Comment or raise an issue for this mapping.
SACT Administration Route
Source columns Administration_Date, Administration_Date. Combines a date with a time of day.
-
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE -
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE
select
distinct
replace(NHS_Number, ' ', '') as NHSNumber,
SACT_Administration_Route as Administration_Route,
Administration_Date
from omop_staging.sact_staging
Comment or raise an issue for this mapping.
SACT Clinical Trial
Source columns Administration_Date, Administration_Date. Combines a date with a time of day.
-
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE -
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE
select
distinct
replace(NHS_Number, ' ', '') as NHSNumber,
Clinical_Trial,
Case
When Clinical_Trial = 1 then concat(Clinical_Trial, ' - PATIENT is taking part in a CLINICAL TRIAL')
else '' end as Source_Value,
Administration_Date
from omop_staging.sact_staging
where Clinical_Trial = '1'
Comment or raise an issue for this mapping.
SACT Treatment Intent
Source columns Administration_Date, Administration_Date. Combines a date with a time of day.
-
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE -
Administration_DateSYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE is the date of the Systemic Anti-Cancer Therapy Drug Administration or the date an oral drug was initially dispensed to the PATIENT. SYSTEMIC ANTI-CANCER THERAPY ADMINISTRATION DATE
select distinct
replace(NHS_Number, ' ', '') as NHSNumber,
Intent_Of_Treatment,
Case
When Intent_Of_Treatment = 1 then concat(Intent_Of_Treatment, ' - Curative(aiming to permanently eradicate disease)')
When Intent_Of_Treatment = 2 then concat(Intent_Of_Treatment, ' - Palliative(aiming to extend life expectancy)')
When Intent_Of_Treatment = 3 then concat(Intent_Of_Treatment, ' - Palliative(aiming to relieve and/or control malignancy related symptoms)')
When Intent_Of_Treatment = 4 then concat(Intent_Of_Treatment, ' - Palliative(aiming to achieve remission)')
When Intent_Of_Treatment = 5 then concat(Intent_Of_Treatment, ' - Palliative(aiming to permanently eradicate disease)')
else '' end as Source_value,
Administration_Date
from omop_staging.sact_staging
where Intent_Of_Treatment != ''
Comment or raise an issue for this mapping.
RTDS Decision To Perform Date
Source columns DateStamp, DateStamp. Combines a date with a time of day.
-
DateStampDecision date of treatment -
DateStampDecision date of treatment
with results as (
select
distinct
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = dc.PatientSer limit 1) as NhsNumber,
dc.DiagnosisCode,
dc.DateStamp,
from omop_staging.RTDS_5_Diagnosis_Course dc
where dc.DiagnosisCode like 'Decision%'
)
select
NhsNumber,
DateStamp
from results
where
NhsNumber is not null
and regexp_matches(NhsNumber, '\d{10}');
Comment or raise an issue for this mapping.
RTDS External Beam Radiation Therapy Energy
Source columns Treatmentdatetime, Treatmentdatetime. Combines a date with a time of day.
-
TreatmentdatetimeStart date of treatment -
TreatmentdatetimeStart date of treatment
with results as (
select distinct
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = PatientSer limit 1) as NhsNumber,
Treatmentdatetime,
Cast(NominalEnergy as double) / 1000 as CalculatedNominalEnergy,
NominalEnergy as NominalEnergy
from omop_staging.RTDS_4_Exposures
)
select
NhsNumber,
Treatmentdatetime,
CalculatedNominalEnergy,
NominalEnergy
from results
where
NhsNumber is not null
and regexp_matches(NhsNumber, '\d{10}');
Comment or raise an issue for this mapping.
RTDS Number Of Fractions
Source columns StartDateTime, StartDateTime. Combines a date with a time of day.
-
StartDateTimeStart date of treatment -
StartDateTimeStart date of treatment
with results as (
select distinct
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = PatientSer limit 1) as NhsNumber,
StartDateTime,
NoFracs
from omop_staging.RTDS_3_Prescription
)
select
NhsNumber,
StartDateTime,
NoFracs
from results
where
NhsNumber is not null
and regexp_matches(NhsNumber, '\d{10}');
Comment or raise an issue for this mapping.
RTDS Date of Referral
Source columns DateStamp, DateStamp. Combines a date with a time of day.
-
DateStampDecision date of treatment -
DateStampDecision date of treatment
with results as (
select
distinct
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = dc.PatientSer limit 1) as NhsNumber,
dc.DiagnosisCode,
dc.DateStamp,
from omop_staging.RTDS_5_Diagnosis_Course dc
where dc.DiagnosisCode like 'Referral%'
)
select
NhsNumber,
DateStamp
from results
where
NhsNumber is not null
and regexp_matches(NhsNumber, '\d{10}');
Comment or raise an issue for this mapping.
RTDS Treatment Anatomical Site
Source columns DueDateTime, DueDateTime. Combines a date with a time of day.
-
DueDateTimeDATE WHEN RADIOTHERAPY OCCURRED -
DueDateTimeDATE WHEN RADIOTHERAPY OCCURRED
with results as (
select distinct
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = PatientSer limit 1) as NHSNumber,
AttributeValue,
(select concept_id from cdm.concept where domain_id = 'Spec Anatomic Site'
and concept_code = CASE WHEN length(code) > 3 THEN substr(code, 1, 3) || '.' || substr(code, 4) ELSE code END) as AnatomicalSiteConceptId,
DueDateTime
from omop_staging.RTDS_2b_Plan,
LATERAL (SELECT regexp_extract(AttributeValue, '^([A-Z][0-9A-Z]+)', 1) AS code) AS t
where Description = 'Anatomical Site'
and AttributeValue is not null
and AttributeValue != 'None'
)
select
NhsNumber,
AttributeValue,
AnatomicalSiteConceptId,
DueDateTime
from results
where
NhsNumber is not null
and regexp_matches(NhsNumber, '\d{10}');
Comment or raise an issue for this mapping.
Oxford Lab General Comment Observation
Source column EVENT_START_DT_TM. Converts text to dates.
EVENT_START_DT_TMLab test event start datetime EVENT START DT TM
select
NHS_NUMBER,
EVENT,
EVENT_START_DT_TM,
RESULT_VALUE
from ##duckdb_source##
where lower(EVENT) like '%comment%'
Comment or raise an issue for this mapping.
CosdV9TobaccoSmokingStatus
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.ClinicalNurseSpecialistAndRiskFactorAssessments.TobaccoSmokingStatus.@code' as TobaccoSmokingStatus,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
TobaccoSmokingStatus,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.TobaccoSmokingStatus is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9TobaccoSmokingCessation
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.ClinicalNurseSpecialistAndRiskFactorAssessments.TobaccoSmokingCessation.@code' as TobaccoSmokingCessation,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
TobaccoSmokingCessation,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.TobaccoSmokingCessation is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9SourceOfReferralForOutpatients
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway."SourceOfReferralForOut-patients"."@code"' as SourceOfReferralForOutpatients,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
SourceOfReferralForOutpatients,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.SourceOfReferralForOutpatients is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9SourceOfReferralForNonPrimaryCancerPathway
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.NonPrimaryPathway.NonPrimaryCancerPathwayReferral.SourceOfReferralForNonPrimaryCancerPathway.@code' as SourceOfReferralForNonPrimaryCancerPathway,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
SourceOfReferralForNonPrimaryCancerPathway,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.SourceOfReferralForNonPrimaryCancerPathway is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9PersonSexualOrientationCodeAtDiagnosis
-
Value copied from
Date -
DateObservation date DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.Demographics.PersonSexualOrientationCodeAtDiagnosis.@code' as PersonSexualOrientationCodeAtDiagnosis,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
PersonSexualOrientationCodeAtDiagnosis,
NhsNumber,
least(
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.PersonSexualOrientationCodeAtDiagnosis is not null
and not (
DateOfPrimaryDiagnosisClinicallyAgreed is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9PerformanceStatusAdult
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.PrimaryPathway.Diagnosis.PerformanceStatusAdult.@code' as PerformanceStatusAdult,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
PerformanceStatusAdult,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.PerformanceStatusAdult is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9MenopausalStatus
-
Value copied from
Date -
DateObservation date DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.ClinicalNurseSpecialistAndRiskFactorAssessments.MenopausalStatus.@code' as MenopausalStatus,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
MenopausalStatus,
NhsNumber,
least(
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.MenopausalStatus is not null
and not (
DateOfPrimaryDiagnosisClinicallyAgreed is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9HistoryOfAlcoholPast
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.ClinicalNurseSpecialistAndRiskFactorAssessments.HistoryOfAlcoholPast.@code' as HistoryOfAlcoholPast,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
HistoryOfAlcoholPast,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.HistoryOfAlcoholPast is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9HistoryOfAlcoholCurrent
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.ClinicalNurseSpecialistAndRiskFactorAssessments.HistoryOfAlcoholCurrent.@code' as HistoryOfAlcoholCurrent,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
HistoryOfAlcoholCurrent,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.HistoryOfAlcoholCurrent is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9FamilialCancerSyndrome
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.PrimaryPathway.Diagnosis.DiagnosisAdditionalItems.FamilialCancerSyndrome.@code' as FamilialCancerSyndrome,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
FamilialCancerSyndrome,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.FamilialCancerSyndrome is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9FamilialCancerSyndromeSubsidiaryComment
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$.PrimaryPathway.Diagnosis.DiagnosisAdditionalItems.FamilialCancerSyndromeSubsidiaryComment.#cdata-section' as FamilialCancerSyndromeSubsidiaryComment,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
FamilialCancerSyndromeSubsidiaryComment,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.FamilialCancerSyndromeSubsidiaryComment is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9AsaScore
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
coalesce(Record ->> '$.Treatment[0].Surgery.AsaScore.@code', Record ->> '$.Treatment.Surgery.AsaScore.@code') as AsaScore,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
AsaScore,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.AsaScore is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV9AdultComorbidityEvaluation
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TNM STAGE GROUPING DATE (INTEGRATED), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as DateFirstSeenCancerSpecialist,
Record ->> '$.PrimaryPathway.LinkageDiagnosticDetails.DateOfPrimaryDiagnosisClinicallyAgreed' as DateOfPrimaryDiagnosisClinicallyAgreed,
Record ->> '$.PrimaryPathway.Staging.StageDateFinalPretreatmentStage' as StageDateFinalPretreatmentStage,
Record ->> '$.PrimaryPathway.Staging.StageDateIntegratedStage' as StageDateIntegratedStage,
coalesce(Record ->> '$.Treatment[0].TreatmentStartDateCancer', Record ->> '$.Treatment.TreatmentStartDateCancer') as TreatmentStartDateCancer,
coalesce(Record ->> '$.Treatment[0].Surgery.ProcedureDate', Record ->> '$.Treatment.Surgery.ProcedureDate') as ProcedureDate,
Record ->> '$."CancerCarePlan"."AdultComorbidityEvaluation-27Score"."@code"' as AdultComorbidityEvaluation,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'CO'
)
select
distinct
AdultComorbidityEvaluation,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(StageDateIntegratedStage as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from CO o
where o.AdultComorbidityEvaluation is not null
and not (
DateFirstSeen is null and
DateFirstSeenCancerSpecialist is null and
DateOfPrimaryDiagnosisClinicallyAgreed is null and
StageDateFinalPretreatmentStage is null and
StageDateIntegratedStage is null and
TreatmentStartDateCancer is null and
ProcedureDate is null
);
Comment or raise an issue for this mapping.
CosdV8SourceOfReferralOutPatients
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate' as CancerTreatmentStartDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SourceOfReferralOutPatients.@code' as SourceOfReferralOutPatients,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
SourceOfReferralOutPatients,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.SourceOfReferralOutPatients is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
-- tested
Comment or raise an issue for this mapping.
CosdV8SourceOfReferralForOutPatientsNonPrimaryCancerPathway
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
coalesce(Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment[0].CancerTreatmentStartDate', Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate') as CancerTreatmentStartDate,
coalesce(Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment[0].ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate', Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate') as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SourceOfReferralOutPatients.@code' as SourceOfReferralOutPatients,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
SourceOfReferralOutPatients,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.SourceOfReferralOutPatients is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
Comment or raise an issue for this mapping.
CosdV8SmokingStatusCode
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
coalesce(Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment[0].CancerTreatmentStartDate', Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate') as CancerTreatmentStartDate,
coalesce(Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment[0].ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate', Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate') as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreClinicalNurseSpecialistAndRiskFactorAssessments.SmokingStatusCode.@code' as SmokingStatusCode,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
SmokingStatusCode,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.SmokingStatusCode is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
Comment or raise an issue for this mapping.
CosdV8PersonStatedSexualOrientationCodeAtDiagnosis
-
Value copied from
Date -
DateObservation date DIAGNOSIS DATE, TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDemographics.PersonStatedSexualOrientationCodeAtDiagnosis.@code' as PersonStatedSexualOrientationCodeAtDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate' as CancerTreatmentStartDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
PersonStatedSexualOrientationCodeAtDiagnosis,
NhsNumber,
least(
cast (ClinicalDateCancerDiagnosis as date),
cast (ProcedureDate as date),
cast (CancerTreatmentStartDate as date)
) as Date
from CO o
where o.PersonStatedSexualOrientationCodeAtDiagnosis is not null
and not (
ClinicalDateCancerDiagnosis is null and
ProcedureDate is null and
CancerTreatmentStartDate is null
)
--tested
Comment or raise an issue for this mapping.
CosdV8FamilialCancerSyndromeIndicator
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate' as CancerTreatmentStartDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.ColorectalCoreDiagnosisAdditionalItems.FamilialCancerSyndromeIndicator.@code' as FamilialCancerSyndromeIndicator,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
FamilialCancerSyndromeIndicator,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.FamilialCancerSyndromeIndicator is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
Comment or raise an issue for this mapping.
CosdV8AlcoholHistoryCancerInLastThreeMonths
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate' as CancerTreatmentStartDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreClinicalNurseSpecialistAndRiskFactorAssessments.AlcoholHistoryCancerInLastThreeMonths.@code' as AlcoholHistoryCancerInLastThreeMonths,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
AlcoholHistoryCancerInLastThreeMonths,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.AlcoholHistoryCancerInLastThreeMonths is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
Comment or raise an issue for this mapping.
CosdV8AlcoholHistoryCancerBeforeLastThreeMonths
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate' as CancerTreatmentStartDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreClinicalNurseSpecialistAndRiskFactorAssessments.AlcoholHistoryCancerBeforeLastThreeMonths.@code' as AlcoholHistoryCancerBeforeLastThreeMonths,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
AlcoholHistoryCancerBeforeLastThreeMonths,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.AlcoholHistoryCancerBeforeLastThreeMonths is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
Comment or raise an issue for this mapping.
CosdV8AdultPerformanceStatus
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
coalesce(Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment[0].CancerTreatmentStartDate', Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate') as CancerTreatmentStartDate,
coalesce(Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment[0].ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate', Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate') as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreDiagnosis.AdultPerformanceStatus.@code' as AdultPerformanceStatus,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
AdultPerformanceStatus,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.AdultPerformanceStatus is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
Comment or raise an issue for this mapping.
CosdV8AdultComorbidityEvaluation
-
Value copied from
Date -
DateObservation date DATE FIRST SEEN, DATE FIRST SEEN (CANCER SPECIALIST), DIAGNOSIS DATE, TNM STAGE GROUPING DATE (INTEGRATED), TNM STAGE GROUPING DATE (FINAL PRETREATMENT), TREATMENT START DATE (CANCER), PROCEDURE DATE
with CO as (
select
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.CancerTreatmentStartDate' as CancerTreatmentStartDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreTreatment.ColorectalCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreCancerCarePlan.AdultComorbidityEvaluation.@code' as AdultComorbidityEvaluation,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
AdultComorbidityEvaluation,
NhsNumber,
least(
cast (DateFirstSeen as date),
cast (SpecialistDateFirstSeen as date),
cast (ClinicalDateCancerDiagnosis as date),
cast (IntegratedStageTNMStageGroupingDate as date),
cast (FinalPreTreatmentTNMStageGroupingDate as date),
cast (CancerTreatmentStartDate as date),
cast (ProcedureDate as date)
) as Date
from CO o
where o.AdultComorbidityEvaluation is not null
and not (
DateFirstSeen is null and
SpecialistDateFirstSeen is null and
ClinicalDateCancerDiagnosis is null and
IntegratedStageTNMStageGroupingDate is null and
FinalPreTreatmentTNMStageGroupingDate is null and
CancerTreatmentStartDate is null and
ProcedureDate is null
)
--tested