Skip to content

Commit 289e6ab

Browse files
authored
Merge pull request #304 from answerdigital/feature/cosd-breast-mappings
COSD breast condition / procedure mappings
2 parents 5bc1946 + 7742208 commit 289e6ab

File tree

94 files changed

+6093
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6093
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using OmopTransformer.Annotations;
2+
using OmopTransformer.Omop.ConditionOccurrence;
3+
using OmopTransformer.Transformation;
4+
5+
namespace OmopTransformer.COSD.Breast.ConditionOccurrence.CosdV8BreastConditionOccurrencePrimaryDiagnosis;
6+
7+
[Notes(
8+
"Assumptions",
9+
"* Any changes in a Diagnosis that may occur in later submissions, for the same Diagnosis date, is taken to be an additional diagnosis as opposed to a change (hence removal of the original)",
10+
"* If the same Diagnosis occurs but we have 2 separate \"basis of diagnosis\" values, then the first one will be taken only")]
11+
internal class CosdV8BreastConditionOccurrencePrimaryDiagnosis : OmopConditionOccurrence<CosdV8BreastConditionOccurrencePrimaryDiagnosisRecord>
12+
{
13+
[CopyValue(nameof(Source.NhsNumber))]
14+
public override string? nhs_number { get; set; }
15+
16+
[Transform(typeof(DateConverter), nameof(Source.DiagnosisDate))]
17+
public override DateTime? condition_start_date { get; set; }
18+
19+
[ConstantValue(32828, "`EHR episode record`")]
20+
public override int? condition_type_concept_id { get; set; }
21+
22+
[Transform(typeof(DataDictionaryBasisOfDiagnosisCancerLookup), nameof(Source.BasisOfDiagnosisCancer))]
23+
public override int? condition_status_concept_id { get; set; }
24+
25+
[CopyValue(nameof(Source.BasisOfDiagnosisCancer))]
26+
public override string? condition_status_source_value { get; set; }
27+
28+
[Transform(typeof(Icd10StandardNonStandardSelector), nameof(Source.CancerDiagnosis))]
29+
public override int? condition_source_concept_id { get; set; }
30+
31+
[Transform(typeof(StandardConditionConceptSelector), useOmopTypeAsSource: true, nameof(condition_source_concept_id))]
32+
public override int[]? condition_concept_id { get; set; }
33+
34+
[CopyValue(nameof(Source.CancerDiagnosis))]
35+
public override string? condition_source_value { get; set; }
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<Query>
2+
<Sql>
3+
with BR as (
4+
select
5+
Record ->> '$.Breast.BreastCore.BreastCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
6+
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as DiagnosisDate,
7+
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
8+
Record ->> '$.Breast.BreastCore.BreastCoreDiagnosis.MorphologyICDODiagnosis.@code' as CancerHistology,
9+
Record ->> '$.Breast.BreastCore.BreastCoreDiagnosis.TopographyICDO.@code' as CancerTopography,
10+
Record ->> '$.Breast.BreastCore.BreastCoreDiagnosis.BasisOfCancerDiagnosis.@code' as BasisOfDiagnosisCancer,
11+
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.PrimaryDiagnosis.@code' as CancerDiagnosis
12+
from omop_staging.cosd_staging_81
13+
where Type = 'BR'
14+
)
15+
select
16+
distinct
17+
NhsNumber,
18+
coalesce (DiagnosisDate, NonPrimaryDiagnosisDate) as DiagnosisDate,
19+
BasisOfDiagnosisCancer,
20+
CancerDiagnosis
21+
from BR
22+
where NhsNumber is not null and
23+
(
24+
DiagnosisDate is not null or
25+
NonPrimaryDiagnosisDate is not null
26+
);
27+
</Sql>
28+
<Explanations>
29+
<Explanation columnName="NhsNumber">
30+
<Description>Patient NHS Number</Description>
31+
<Origin>NHS NUMBER</Origin>
32+
</Explanation>
33+
<Explanation columnName="DiagnosisDate">
34+
<Description>DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed.</Description>
35+
<Origin>DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)</Origin>
36+
<Origin>DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)</Origin>
37+
</Explanation>
38+
<Explanation columnName="BasisOfDiagnosisCancer">
39+
<Description>The basis of how a PATIENT DIAGNOSIS relating to cancer was identified.</Description>
40+
<Origin>BASIS OF DIAGNOSIS (CANCER)</Origin>
41+
</Explanation>
42+
<Explanation columnName="CancerDiagnosis">
43+
<Description>PRIMARY DIAGNOSIS (ICD) is the International Classification of Diseases (ICD) code used to identify the PRIMARY DIAGNOSIS.</Description>
44+
<Origin>PRIMARY DIAGNOSIS (ICD)</Origin>
45+
</Explanation>
46+
</Explanations>
47+
</Query>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using OmopTransformer.Annotations;
2+
3+
namespace OmopTransformer.COSD.Breast.ConditionOccurrence.CosdV8BreastConditionOccurrencePrimaryDiagnosis;
4+
5+
[DataOrigin("COSD")]
6+
[Description("Cosd V8 Breast Condition Occurrence Primary Diagnosis")]
7+
[SourceQuery("CosdV8BreastConditionOccurrencePrimaryDiagnosis.xml")]
8+
internal class CosdV8BreastConditionOccurrencePrimaryDiagnosisRecord
9+
{
10+
public string? NhsNumber { get; set; }
11+
public string? DiagnosisDate { get; set; }
12+
public string? BasisOfDiagnosisCancer { get; set; }
13+
public string? CancerDiagnosis { get; set; }
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using OmopTransformer.Annotations;
2+
using OmopTransformer.Omop.ConditionOccurrence;
3+
using OmopTransformer.Transformation;
4+
5+
namespace OmopTransformer.COSD.Breast.ConditionOccurrence.CosdV8BreastConditionOccurrencePrimaryDiagnosisHistologyTopography;
6+
7+
[Notes(
8+
"Assumptions",
9+
"* For a given Diagnosis date, all valid combinations of Histology and Topography are added (thereby giving us an ICD-O-3 condition) as well as the ICD10 Diagnosis.",
10+
"* Any changes in a Diagnosis that may occur in later submissions, for the same Diagnosis date, is taken to be an additional diagnosis as opposed to a change (hence removal of the original)",
11+
"* If the same Diagnosis occurs but we have 2 separate \"basis of diagnosis\" values, then the first one will be taken only")]
12+
internal class CosdV8BreastConditionOccurrencePrimaryDiagnosisHistologyTopography : OmopConditionOccurrence<CosdV8BreastConditionOccurrencePrimaryDiagnosisHistologyTopographyRecord>
13+
{
14+
[CopyValue(nameof(Source.NhsNumber))]
15+
public override string? nhs_number { get; set; }
16+
17+
[Transform(typeof(DateConverter), nameof(Source.DiagnosisDate))]
18+
public override DateTime? condition_start_date { get; set; }
19+
20+
[ConstantValue(32828, "`EHR episode record`")]
21+
public override int? condition_type_concept_id { get; set; }
22+
23+
[Transform(typeof(DataDictionaryBasisOfDiagnosisCancerLookup), nameof(Source.BasisOfDiagnosisCancer))]
24+
public override int? condition_status_concept_id { get; set; }
25+
26+
[CopyValue(nameof(Source.BasisOfDiagnosisCancer))]
27+
public override string? condition_status_source_value { get; set; }
28+
29+
[Transform(typeof(Icdo3Selector), nameof(Source.CancerHistology), nameof(Source.CancerTopography))]
30+
public override int? condition_source_concept_id { get; set; }
31+
32+
[Transform(typeof(StandardConditionConceptSelector), useOmopTypeAsSource: true, nameof(condition_source_concept_id))]
33+
public override int[]? condition_concept_id { get; set; }
34+
35+
[Transform(typeof(TextDeliminator), nameof(Source.CancerHistology), nameof(Source.CancerTopography))]
36+
public override string? condition_source_value { get; set; }
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<Query>
2+
<Sql>
3+
with BR as (
4+
select
5+
Record ->> '$.Breast.BreastCore.BreastCoreLinkagePatientId.NHSNumber.@extension' as NhsNumber,
6+
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.ClinicalDateCancerDiagnosis' as DiagnosisDate,
7+
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
8+
Record ->> '$.Breast.BreastCore.BreastCoreDiagnosis.MorphologyICDODiagnosis.@code' as CancerHistology,
9+
Record ->> '$.Breast.BreastCore.BreastCoreDiagnosis.TopographyICDO.@code' as CancerTopography,
10+
Record ->> '$.Breast.BreastCore.BreastCoreDiagnosis.BasisOfCancerDiagnosis.@code' as BasisOfDiagnosisCancer,
11+
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.PrimaryDiagnosis.@code' as CancerDiagnosis
12+
from omop_staging.cosd_staging_81
13+
where Type = 'BR'
14+
)
15+
select
16+
distinct
17+
NhsNumber,
18+
coalesce (DiagnosisDate, NonPrimaryDiagnosisDate) as DiagnosisDate,
19+
BasisOfDiagnosisCancer,
20+
CancerHistology,
21+
CancerTopography
22+
from BR
23+
where NhsNumber is not null and
24+
(
25+
DiagnosisDate is not null or
26+
NonPrimaryDiagnosisDate is not null
27+
)
28+
and (CancerHistology is not null and CancerTopography is not null)
29+
</Sql>
30+
<Explanations>
31+
<Explanation columnName="NhsNumber">
32+
<Description>Patient NHS Number</Description>
33+
<Origin>NHS NUMBER</Origin>
34+
</Explanation>
35+
<Explanation columnName="DiagnosisDate">
36+
<Description>DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date the Primary Cancer was confirmed or the Primary Cancer diagnosis was agreed.</Description>
37+
<Origin>DATE OF PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)</Origin>
38+
<Origin>DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)</Origin>
39+
</Explanation>
40+
<Explanation columnName="CancerHistology">
41+
<Description>MORPHOLOGY (ICD-O CANCER TRANSFORMATION) is the morphology code of the Cancer Transformation using the ICD-O CODE.</Description>
42+
<Origin>MORPHOLOGY (ICD-O CANCER TRANSFORMATION)</Origin>
43+
</Explanation>
44+
<Explanation columnName="CancerTopography">
45+
<Description>TOPOGRAPHY (ICD-O) is the topographical site of the Tumour using the ICD-O CODE.</Description>
46+
<Origin>TOPOGRAPHY (ICD-O)</Origin>
47+
</Explanation>
48+
<Explanation columnName="BasisOfDiagnosisCancer">
49+
<Description>The basis of how a PATIENT DIAGNOSIS relating to cancer was identified.</Description>
50+
<Origin>BASIS OF DIAGNOSIS (CANCER)</Origin>
51+
</Explanation>
52+
</Explanations>
53+
</Query>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using OmopTransformer.Annotations;
2+
3+
namespace OmopTransformer.COSD.Breast.ConditionOccurrence.CosdV8BreastConditionOccurrencePrimaryDiagnosisHistologyTopography;
4+
5+
[DataOrigin("COSD")]
6+
[Description("Cosd V8 Breast Condition Occurrence Primary Diagnosis Histology Topography")]
7+
[SourceQuery("CosdV8BreastConditionOccurrencePrimaryDiagnosisHistologyTopography.xml")]
8+
internal class CosdV8BreastConditionOccurrencePrimaryDiagnosisHistologyTopographyRecord
9+
{
10+
public string? NhsNumber { get; set; }
11+
public string? DiagnosisDate { get; set; }
12+
public string? BasisOfDiagnosisCancer { get; set; }
13+
public string? CancerHistology { get; set; }
14+
public string? CancerTopography { get; set; }
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using OmopTransformer.Annotations;
2+
using OmopTransformer.Omop.ConditionOccurrence;
3+
using OmopTransformer.Transformation;
4+
5+
namespace OmopTransformer.COSD.Breast.ConditionOccurrence.CosdV8BreastConditionOccurrenceProgression;
6+
7+
[Notes(
8+
"Assumptions",
9+
"* Any changes in a Diagnosis that may occur in later submissions, for the same Diagnosis date, is taken to be an additional diagnosis as opposed to a change (hence removal of the original)",
10+
"* If the same Diagnosis occurs but we have 2 separate \"basis of diagnosis\" values, then the first one will be taken only")]
11+
internal class CosdV8BreastConditionOccurrenceProgression : OmopConditionOccurrence<CosdV8BreastConditionOccurrenceProgressionRecord>
12+
{
13+
[CopyValue(nameof(Source.NhsNumber))]
14+
public override string? nhs_number { get; set; }
15+
16+
[Transform(typeof(DateConverter), nameof(Source.NonPrimaryDiagnosisDate))]
17+
public override DateTime? condition_start_date { get; set; }
18+
19+
[ConstantValue(32828, "`EHR episode record`")]
20+
public override int? condition_type_concept_id { get; set; }
21+
22+
[Transform(typeof(Icd10StandardNonStandardSelector), nameof(Source.NonPrimaryProgressionOriginalDiagnosis))]
23+
public override int? condition_source_concept_id { get; set; }
24+
25+
[Transform(typeof(StandardConditionConceptSelector), useOmopTypeAsSource: true, nameof(condition_source_concept_id))]
26+
public override int[]? condition_concept_id { get; set; }
27+
28+
[CopyValue(nameof(Source.NonPrimaryProgressionOriginalDiagnosis))]
29+
public override string? condition_source_value { get; set; }
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Query>
2+
<Sql>
3+
with BR as (
4+
select
5+
Record ->> '$.Breast.BreastCore.BreastCoreLinkagePatientId.NHSNumber.@extension' as NHSNumber,
6+
Record ->> '$.Breast.BreastCore.BreastCoreLinkageDiagnosticDetails.DateOfNonPrimaryCancerDiagnosisClinicallyAgreed' as NonPrimaryDiagnosisDate,
7+
Record ->> '$.Breast.BreastCore.BreastCoreNonPrimaryCancerPathwayRoute.CancerProgressionICD.@code' as NonPrimaryProgressionOriginalDiagnosis
8+
from omop_staging.cosd_staging_81
9+
where type = 'BR'
10+
)
11+
select distinct
12+
NHSNumber,
13+
NonPrimaryDiagnosisDate,
14+
NonPrimaryProgressionOriginalDiagnosis
15+
from BR
16+
where NonPrimaryProgressionOriginalDiagnosis is not null
17+
and NonPrimaryDiagnosisDate is not null
18+
and NHSNumber is not null;
19+
</Sql>
20+
<Explanations>
21+
<Explanation columnName="NhsNumber">
22+
<Description>Patient NHS Number</Description>
23+
<Origin>NHS NUMBER</Origin>
24+
</Explanation>
25+
<Explanation columnName="NonPrimaryDiagnosisDate">
26+
<Description>DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED) is the date where the Non Primary Cancer PATIENT DIAGNOSIS was confirmed or agreed.</Description>
27+
<Origin>DATE OF NON PRIMARY CANCER DIAGNOSIS (CLINICALLY AGREED)</Origin>
28+
</Explanation>
29+
<Explanation columnName="NonPrimaryProgressionOriginalDiagnosis">
30+
<Description>CANCER PROGRESSION (ICD ORIGINAL) is the International Classification of Diseases (ICD) code of the original PATIENT DIAGNOSIS of the Cancer Progression.</Description>
31+
<Origin>CANCER PROGRESSION (ICD ORIGINAL)</Origin>
32+
</Explanation>
33+
</Explanations>
34+
</Query>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using OmopTransformer.Annotations;
2+
3+
namespace OmopTransformer.COSD.Breast.ConditionOccurrence.CosdV8BreastConditionOccurrenceProgression;
4+
5+
[DataOrigin("COSD")]
6+
[Description("COSD V8 Breast Condition Occurrence Progression")]
7+
[SourceQuery("CosdV8BreastConditionOccurrenceProgression.xml")]
8+
internal class CosdV8BreastConditionOccurrenceProgressionRecord
9+
{
10+
public string? NhsNumber { get; set; }
11+
public string? NonPrimaryDiagnosisDate { get; set; }
12+
public string? NonPrimaryProgressionOriginalDiagnosis { get; set; }
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using OmopTransformer.Annotations;
2+
using OmopTransformer.Omop.ConditionOccurrence;
3+
using OmopTransformer.Transformation;
4+
5+
namespace OmopTransformer.COSD.Breast.ConditionOccurrence.CosdV9BreastConditionOccurrencePrimaryDiagnosis;
6+
7+
[Notes(
8+
"Assumptions",
9+
"* Any changes in a Diagnosis that may occur in later submissions, for the same Diagnosis date, is taken to be an additional diagnosis as opposed to a change (hence removal of the original)",
10+
"* If the same Diagnosis occurs but we have 2 separate \"basis of diagnosis\" values, then the first one will be taken only")]
11+
internal class CosdV9BreastConditionOccurrencePrimaryDiagnosis : OmopConditionOccurrence<CosdV9BreastConditionOccurrencePrimaryDiagnosisRecord>
12+
{
13+
[CopyValue(nameof(Source.NhsNumber))]
14+
public override string? nhs_number { get; set; }
15+
16+
[Transform(typeof(DateConverter), nameof(Source.DateOfPrimaryDiagnosisClinicallyAgreed))]
17+
public override DateTime? condition_start_date { get; set; }
18+
19+
[ConstantValue(32828, "`EHR episode record`")]
20+
public override int? condition_type_concept_id { get; set; }
21+
22+
[Transform(typeof(DataDictionaryBasisOfDiagnosisCancerLookup), nameof(Source.BasisOfDiagnosisCancer))]
23+
public override int? condition_status_concept_id { get; set; }
24+
25+
[CopyValue(nameof(Source.BasisOfDiagnosisCancer))]
26+
public override string? condition_status_source_value { get; set; }
27+
28+
[Transform(typeof(Icd10StandardNonStandardSelector), nameof(Source.CancerDiagnosis))]
29+
public override int? condition_source_concept_id { get; set; }
30+
31+
[Transform(typeof(StandardConditionConceptSelector), useOmopTypeAsSource: true, nameof(condition_source_concept_id))]
32+
public override int[]? condition_concept_id { get; set; }
33+
34+
[CopyValue(nameof(Source.CancerDiagnosis))]
35+
public override string? condition_source_value { get; set; }
36+
}

0 commit comments

Comments
 (0)