value_as_string
SUS OP Source Of Referral For Outpatients
-
Value copied from
ReferrerCode -
ReferrerCodeReferrer code is the code of the person making the referral request. REFERRER CODE
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
-
Value copied from
ReferralRequestReceivedDate -
ReferralRequestReceivedDateThe date the Referral request was received by the Health Care Provider. REFERRAL REQUEST RECEIVED DATE
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
-
Value copied from
CarerSupportIndicator -
CarerSupportIndicatorAn indication of whether Carer support is available to the PATIENT at their normal residence. CARER SUPPORT INDICATOR
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 Inpatient Total Previous Pregnancies Observation
-
Value copied from
TotalPreviousPregnancies -
TotalPreviousPregnanciesPREGNANCY TOTAL PREVIOUS PREGNANCIES is the number of previous pregnancies resulting in one or more REGISTRABLE BIRTHS. PREGNANCY TOTAL PREVIOUS PREGNANCIES
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
-
Value copied from
ReferrerCode -
ReferrerCodeReferrer code is the code of the person making the referral request. REFERRER CODE
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
-
Value copied from
ReferralToTreatmentPeriodStartDate -
ReferralToTreatmentPeriodStartDateThe start date of a REFERRAL TO TREATMENT PERIOD . REFERRAL TO TREATMENT PERIOD START DATE
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 Carer Support Indicator Observation
-
Value copied from
CarerSupportIndicator -
CarerSupportIndicatorAn indication of whether Carer support is available to the PATIENT at their normal residence. CARER SUPPORT INDICATOR
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
-
Value copied from
BirthWeight -
BirthWeightBIRTH WEIGHT is the result of the Clinical Investigation which measures the Birth Weight, where the UNIT OF MEASUREMENT is Grams (g). BIRTH WEIGHT
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
-
Value copied from
AnaestheticGivenPostLabourDelivery -
AnaestheticGivenPostLabourDeliveryRecords whether anaesthetic was given after Delivery, and the type used. ANAESTHETIC GIVEN POST LABOUR OR DELIVERY CODE
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
-
Value copied from
AnaestheticDuringLabourDelivery -
AnaestheticDuringLabourDeliveryRecords whether anaesthetic was given during Labour/ Delivery, and the type used. ANAESTHETIC GIVEN DURING LABOUR OR DELIVERY CODE
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
-
Value copied from
SourceofReferralForAE -
SourceofReferralForAEThe source of referral of each Accident and Emergency Episode. SOURCE OF REFERRAL FOR A and E
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
-
Value copied from
AccidentAndEmergencyDiagnosis -
AccidentAndEmergencyDiagnosisACCIDENT AND EMERGENCY DIAGNOSIS is a six character code, comprising: Diagnosis Condition n2 Sub-Analysis n1 ACCIDENT AND EMERGENCY ANATOMICAL AREA n2 ACCIDENT AND EMERGENCY ANATOMICAL SIDE PRIMARY DIAGNOSIS
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
-
Value copied from
AccidentAndEmergencyDiagnosis -
AccidentAndEmergencyDiagnosisACCIDENT AND EMERGENCY DIAGNOSIS is a six character code, comprising: Diagnosis Condition n2 Sub-Analysis n1 ACCIDENT AND EMERGENCY ANATOMICAL AREA n2 ACCIDENT AND EMERGENCY ANATOMICAL SIDE PRIMARY DIAGNOSIS
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.
RTDS Decision To Perform Date
-
Value copied from
DateStamp -
DateStampDecision date of treatment
select distinct
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = dc.PatientSer limit 1) as NhsNumber,
DateStamp
from omop_staging.RTDS_5_Diagnosis_Course dc
where dc.DiagnosisCode like 'Decision%'
and NhsNumber is not null
and regexp_matches(NhsNumber, '\d{10}');
Comment or raise an issue for this mapping.
RTDS Date of Referral
-
Value copied from
DateStamp -
DateStampDecision date of treatment
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%'
and NhsNumber is not null
and regexp_matches(NhsNumber, '\d{10}');
Comment or raise an issue for this mapping.
Oxford Lab General Comment Observation
-
Value copied from
RESULT_VALUE -
RESULT_VALUELab report comment text RESULT VALUE
select
NHS_NUMBER,
EVENT,
EVENT_START_DT_TM,
RESULT_VALUE
from ##duckdb_source##
where lower(EVENT) like '%comment%'
order by all
Comment or raise an issue for this mapping.
CosdV9LungSourceOfReferralForOutpatients
-
Value copied from
SourceOfReferralForOutpatients -
SourceOfReferralForOutpatientsFor specific National Code usage, see SOURCE OF REFERRAL FOR OUT-PATIENTS. SOURCE OF REFERRAL FOR OUT-PATIENTS
with LU 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,
Record ->> '$.Treatment.TreatmentStartDateCancer' as TreatmentStartDateCancer,
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 = 'LU'
)
select
distinct
SourceOfReferralForOutpatients,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(nullif(StageDateIntegratedStage, '') as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from LU 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.
CosdV9LungSourceOfReferralForNonPrimaryCancerPathway
-
Value copied from
SourceOfReferralForNonPrimaryCancerPathway -
SourceOfReferralForNonPrimaryCancerPathwayThe SOURCE OF REFERRAL FOR NON PRIMARY CANCER PATHWAY records source of referral for the non-primary cancer pathway. SOURCE OF REFERRAL FOR NON PRIMARY CANCER PATHWAY
with LU 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,
Record ->> '$.Treatment.TreatmentStartDateCancer' as TreatmentStartDateCancer,
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 = 'LU'
)
select
distinct
SourceOfReferralForNonPrimaryCancerPathway,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(nullif(StageDateIntegratedStage, '') as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from LU 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.
CosdV9LungFamilialCancerSyndromeSubsidiaryComment
-
Value copied from
FamilialCancerSyndromeSubsidiaryComment -
FamilialCancerSyndromeSubsidiaryCommentSubsidiary comment for familial cancer syndrome identification during a Cancer Care Spell. FAMILIAL CANCER SYNDROME (SUBSIDIARY COMMENT)
with LU 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,
Record ->> '$.Treatment.TreatmentStartDateCancer' as TreatmentStartDateCancer,
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 = 'LU'
)
select
distinct
'Familial Cancer Syndrome Subsidiary Comments - ' || FamilialCancerSyndromeSubsidiaryComment as FamilialCancerSyndromeSubsidiaryComment,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(nullif(StageDateIntegratedStage, '') as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from LU 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.
CosdV8LungSourceOfReferralOutPatients
-
Value copied from
SourceOfReferralOutPatients -
SourceOfReferralOutPatientsThe SOURCE OF REFERRAL FOR OUT PATIENTS records source of referral for out patients. SOURCE OF REFERRAL FOR OUT PATIENTS
with LU as (
select
Record ->> '$.Lung.LungCore.LungCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Lung.LungCore.LungCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
unnest ([[Record ->> '$.Lung.LungCore.LungCoreTreatment.CancerTreatmentStartDate'], Record ->> '$.Lung.LungCore.LungCoreTreatment[*].CancerTreatmentStartDate'], recursive := true) as CancerTreatmentStartDate,
Record ->> '$.Lung.LungCore.LungCoreTreatment.LungCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Lung.LungCore.LungCoreReferralAndFirstStageOfPatientPathway.SourceOfReferralOutPatients.@code' as SourceOfReferralOutPatients,
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'LU'
)
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 LU 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.
CosdV8LungSourceOfReferralForOutPatientsNonPrimaryCancerPathway
-
Value copied from
SourceOfReferralOutPatients -
SourceOfReferralOutPatientsThe SOURCE OF REFERRAL FOR NON PRIMARY CANCER PATHWAY records source of referral for the non-primary cancer pathway. SOURCE OF REFERRAL FOR OUT PATIENTS (NON PRIMARY CANCER PATHWAY)
with LU as (
select
Record ->> '$.Lung.LungCore.LungCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Lung.LungCore.LungCoreReferralAndFirstStageOfPatientPathway.SpecialistDateFirstSeen' as SpecialistDateFirstSeen,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Lung.LungCore.LungCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
unnest ([[Record ->> '$.Lung.LungCore.LungCoreTreatment.CancerTreatmentStartDate'], Record ->> '$.Lung.LungCore.LungCoreTreatment[*].CancerTreatmentStartDate'], recursive := true) as CancerTreatmentStartDate,
Record ->> '$.Lung.LungCore.LungCoreTreatment.LungCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
Record ->> '$.Lung.LungCore.LungCoreReferralAndFirstStageOfPatientPathway.SourceOfReferralOutPatients.@code' as SourceOfReferralOutPatients,
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'LU'
)
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 LU 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.
CosdV8LungPersonStatedSexualOrientationCodeAtDiagnosis
-
Value copied from
PersonStatedSexualOrientationCodeAtDiagnosis -
PersonStatedSexualOrientationCodeAtDiagnosisThe sexual orientation of a PERSON at the time of diagnosis. PERSON STATED SEXUAL ORIENTATION CODE AT DIAGNOSIS
with LU as (
select
Record ->> '$.Lung.LungCore.LungCoreDemographics.PersonStatedSexualOrientationCodeAtDiagnosis.@code' as PersonStatedSexualOrientationCodeAtDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Lung.LungCore.LungCoreTreatment.LungCoreSurgeryAndOtherProcedures.ProcedureDate' as ProcedureDate,
unnest ([[Record ->> '$.Lung.LungCore.LungCoreTreatment.CancerTreatmentStartDate'], Record ->> '$.Lung.LungCore.LungCoreTreatment[*].CancerTreatmentStartDate'], recursive := true) as CancerTreatmentStartDate,
Record ->> '$.Lung.LungCore.LungCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'LU'
)
select
distinct
PersonStatedSexualOrientationCodeAtDiagnosis,
NhsNumber,
least(
cast (ClinicalDateCancerDiagnosis as date),
cast (ProcedureDate as date),
cast (CancerTreatmentStartDate as date)
) as Date
from LU o
where o.PersonStatedSexualOrientationCodeAtDiagnosis is not null
and not (
ClinicalDateCancerDiagnosis is null and
ProcedureDate is null and
CancerTreatmentStartDate is null
)
Comment or raise an issue for this mapping.
CosdV9SourceOfReferralForOutpatients
-
Value copied from
SourceOfReferralForOutpatients -
SourceOfReferralForOutpatientsFor specific National Code usage, see SOURCE OF REFERRAL FOR OUT-PATIENTS. SOURCE OF REFERRAL FOR OUT-PATIENTS
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(nullif(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
SourceOfReferralForNonPrimaryCancerPathway -
SourceOfReferralForNonPrimaryCancerPathwaySOURCE OF REFERRAL FOR OUT-PATIENTS (NON PRIMARY CANCER PATHWAY) identifies the source of referral for a Non Primary Cancer Pathway. SOURCE OF REFERRAL FOR OUT-PATIENTS (NON PRIMARY CANCER PATHWAY)
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(nullif(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
PersonSexualOrientationCodeAtDiagnosis -
PersonSexualOrientationCodeAtDiagnosisPERSON STATED SEXUAL ORIENTATION CODE (AT DIAGNOSIS) is the PERSON STATED SEXUAL ORIENTATION CODE at the time of the PATIENT DIAGNOSIS. PERSON STATED SEXUAL ORIENTATION CODE (AT DIAGNOSIS)
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.
CosdV9FamilialCancerSyndromeSubsidiaryComment
-
Value copied from
FamilialCancerSyndromeSubsidiaryComment -
FamilialCancerSyndromeSubsidiaryCommentFAMILIAL CANCER SYNDROME COMMENT is free text further information recorded where the FAMILIAL CANCER SYNDROME INDICATOR is National Code ‘Y - Yes’ or ‘P - Possible’, to identify distinct syndromes which may have different treatment decisions or outcomes that cannot be coded separately during a Cancer Care Spell. FAMILIAL CANCER SYNDROME COMMENT
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
'Familial Cancer Syndrome Subsidiary Comments - ' || FamilialCancerSyndromeSubsidiaryComment as FamilialCancerSyndromeSubsidiaryComment,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(nullif(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.
CosdV8SourceOfReferralOutPatients
-
Value copied from
SourceOfReferralOutPatients -
SourceOfReferralOutPatientsFor specific National Code usage, see SOURCE OF REFERRAL FOR OUT-PATIENTS. SOURCE OF REFERRAL FOR OUT-PATIENTS
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
)
Comment or raise an issue for this mapping.
CosdV8SourceOfReferralForOutPatientsNonPrimaryCancerPathway
-
Value copied from
SourceOfReferralForOutPatientsNonPrimaryCancerPathway -
SourceOfReferralForOutPatientsNonPrimaryCancerPathwaySOURCE OF REFERRAL FOR OUT-PATIENTS (NON PRIMARY CANCER PATHWAY) identifies the source of referral for a Non Primary Cancer Pathway. SOURCE OF REFERRAL FOR OUT-PATIENTS (NON PRIMARY CANCER PATHWAY)
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.ColorectalCoreNonPrimaryCancerPathway.SourceOfReferralForOutPatientsNonPrimaryCancerPathway.@code' as SourceOfReferralForOutPatientsNonPrimaryCancerPathway,
Record ->> '$.Colorectal.ColorectalCore.ColorectalCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'CO'
)
select
distinct
SourceOfReferralForOutPatientsNonPrimaryCancerPathway,
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.SourceOfReferralForOutPatientsNonPrimaryCancerPathway 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
PersonStatedSexualOrientationCodeAtDiagnosis -
PersonStatedSexualOrientationCodeAtDiagnosisPERSON STATED SEXUAL ORIENTATION CODE (AT DIAGNOSIS) is the PERSON STATED SEXUAL ORIENTATION CODE at the time of the PATIENT DIAGNOSIS. PERSON STATED SEXUAL ORIENTATION CODE (AT DIAGNOSIS)
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
)
Comment or raise an issue for this mapping.
CosdV9BreastSourceOfReferralForOutpatients
-
Value copied from
SourceOfReferralForOutpatients -
SourceOfReferralForOutpatientsThe source of referral for a series of attendances at a Consultant led out-PATIENT clinic, or a contact for a domiciliary visit, or a telephone or telemedicine consultation. SOURCE OF REFERRAL FOR OUT-PATIENTS
with BR 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,
-- Quoting is required to handle the hyphen in "SourceOfReferralForOut-patients"
Record ->> '$.PrimaryPathway.ReferralAndFirstStageOfPatientPathway."SourceOfReferralForOut-patients"."@code"' as SourceOfReferralForOutpatients,
Record ->> '$.LinkagePatientId.NhsNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_901
where type = 'BR'
)
select
distinct
SourceOfReferralForOutpatients,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(nullif(StageDateIntegratedStage, '') as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from BR 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.
CosdV9BreastSourceOfReferralForNonPrimaryCancerPathway
-
Value copied from
SourceOfReferralForNonPrimaryCancerPathway -
SourceOfReferralForNonPrimaryCancerPathwayThe source of referral for a PATIENT with a new primary cancer diagnosis. SOURCE OF REFERRAL FOR OUT-PATIENTS (NON PRIMARY CANCER PATHWAY)
with BR 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 = 'BR'
)
select
distinct
SourceOfReferralForNonPrimaryCancerPathway,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(nullif(StageDateIntegratedStage, '') as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from BR 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.
CosdV9BreastFamilialCancerSyndromeSubsidiaryComment
-
Value copied from
FamilialCancerSyndromeSubsidiaryComment -
FamilialCancerSyndromeSubsidiaryCommentFAMILIAL CANCER SYNDROME SUBSIDIARY COMMENT FAMILIAL CANCER SYNDROME SUBSIDIARY COMMENT
with BR 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 = 'BR'
)
select
distinct
'Familial Cancer Syndrome Subsidiary Comments - ' || FamilialCancerSyndromeSubsidiaryComment as FamilialCancerSyndromeSubsidiaryComment,
NhsNumber,
least(
cast(DateFirstSeen as date),
cast(DateFirstSeenCancerSpecialist as date),
cast(DateOfPrimaryDiagnosisClinicallyAgreed as date),
cast(StageDateFinalPretreatmentStage as date),
cast(nullif(StageDateIntegratedStage, '') as date),
cast(TreatmentStartDateCancer as date),
cast(ProcedureDate as date)
) as Date
from BR 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.
COSD V8 Breast Source Of Referral Out Patients
-
Value copied from
SourceOfReferralOutPatients -
SourceOfReferralOutPatientsSource Of Referral Out Patients SourceOfReferralForOut_patients
with BR as (
select
Record ->> '$.Breast.BreastCore.BreastCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Breast.BreastCore.BreastCoreReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as SpecialistDateFirstSeen,
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Breast.BreastCore.BreastCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Breast.BreastCore.BreastCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
coalesce(
Record ->> '$.Breast.BreastCore.BreastCoreTreatment[0].CancerTreatmentStartDate',
Record ->> '$.Breast.BreastCore.BreastCoreTreatment.CancerTreatmentStartDate'
) as CancerTreatmentStartDate,
coalesce(
Record ->> '$.Breast.BreastCore.BreastCoreTreatment[0].BreastCoreSurgery.ProcedureDate',
Record ->> '$.Breast.BreastCore.BreastCoreTreatment.BreastCoreSurgery.ProcedureDate'
) as ProcedureDate,
Record ->> '$.Breast.BreastCore.BreastCoreReferralAndFirstStageOfPatientPathway.SourceOfReferralOutPatients.@code' as SourceOfReferralOutPatients,
Record ->> '$.Breast.BreastCore.BreastCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'BR'
)
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 BR 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.
COSD V8 Breast Source Of Referral For Out Patients Non Primary Cancer Pathway
-
Value copied from
SourceOfReferralOutPatients -
SourceOfReferralOutPatientsSource Of Referral For Out Patients SourceOfReferralForOut_patients
with BR as (
select
Record ->> '$.Breast.BreastCore.BreastCoreReferralAndFirstStageOfPatientPathway.DateFirstSeen' as DateFirstSeen,
Record ->> '$.Breast.BreastCore.BreastCoreReferralAndFirstStageOfPatientPathway.DateFirstSeenCancerSpecialist' as SpecialistDateFirstSeen,
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
Record ->> '$.Breast.BreastCore.BreastCoreStaging.IntegratedStageTNMStageGroupingDate' as IntegratedStageTNMStageGroupingDate,
Record ->> '$.Breast.BreastCore.BreastCoreStaging.FinalPreTreatmentTNMStageGroupingDate' as FinalPreTreatmentTNMStageGroupingDate,
coalesce(
Record ->> '$.Breast.BreastCore.BreastCoreTreatment[0].CancerTreatmentStartDate',
Record ->> '$.Breast.BreastCore.BreastCoreTreatment.CancerTreatmentStartDate'
) as CancerTreatmentStartDate,
coalesce(
Record ->> '$.Breast.BreastCore.BreastCoreTreatment[0].BreastCoreSurgery.ProcedureDate',
Record ->> '$.Breast.BreastCore.BreastCoreTreatment.BreastCoreSurgery.ProcedureDate'
) as ProcedureDate,
Record ->> '$.Breast.BreastCore.BreastCoreReferralAndFirstStageOfPatientPathway.SourceOfReferralOutPatients.@code' as SourceOfReferralOutPatients,
Record ->> '$.Breast.BreastCore.BreastCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'BR'
)
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 BR 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.
COSD V8 Breast Person Stated Sexual Orientation Code At Diagnosis
-
Value copied from
PersonStatedSexualOrientationCodeAtDiagnosis -
PersonStatedSexualOrientationCodeAtDiagnosisPerson Stated Sexual Orientation Code At Diagnosis PersonStatedSexualOrientationCodeAtDiagnosis
with BR as (
select
Record ->> '$.Breast.BreastCore.BreastCoreDemographics.PersonStatedSexualOrientationCodeAtDiagnosis.@code' as PersonStatedSexualOrientationCodeAtDiagnosis,
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as ClinicalDateCancerDiagnosis,
coalesce(
Record ->> '$.Breast.BreastCore.BreastCoreTreatment[0].BreastCoreSurgery.ProcedureDate',
Record ->> '$.Breast.BreastCore.BreastCoreTreatment.BreastCoreSurgery.ProcedureDate'
) as ProcedureDate,
coalesce(
Record ->> '$.Breast.BreastCore.BreastCoreTreatment[0].CancerTreatmentStartDate',
Record ->> '$.Breast.BreastCore.BreastCoreTreatment.CancerTreatmentStartDate'
) as CancerTreatmentStartDate,
Record ->> '$.Breast.BreastCore.BreastCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber
from omop_staging.cosd_staging_81
where Type = 'BR'
)
select
distinct
PersonStatedSexualOrientationCodeAtDiagnosis,
NhsNumber,
least(
cast (ClinicalDateCancerDiagnosis as date),
cast (ProcedureDate as date),
cast (CancerTreatmentStartDate as date)
) as Date
from BR o
where o.PersonStatedSexualOrientationCodeAtDiagnosis is not null
and not (
ClinicalDateCancerDiagnosis is null and
ProcedureDate is null and
CancerTreatmentStartDate is null
);