Skip to content

Commit f3f2347

Browse files
authored
Merge pull request #278 from answerdigital/rtds-provider-observation
Rtds - Provider and Observation
2 parents 82945ae + bf9bf7e commit f3f2347

File tree

49 files changed

+2243
-24
lines changed

Some content is hidden

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

49 files changed

+2243
-24
lines changed

OmopTransformer/OmopTransformer.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@
275275
<None Update="RTDS\Location\RtdsLocation.xml">
276276
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
277277
</None>
278+
<None Update="RTDS\Provider\RtdsProvider.xml">
279+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
280+
</None>
278281
<None Update="RTDS\ProcedureOccurrence\RtdsProcedureOccurrence.xml">
279282
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
280283
</None>
@@ -284,6 +287,21 @@
284287
<None Update="RTDS\VisitOccurrence\RtdsVisitOccurrence.xml">
285288
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
286289
</None>
290+
<None Update="RTDS\Observation\RtdsDecisionToPerformDate\RtdsDecisionToPerformDate.xml">
291+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
292+
</None>
293+
<None Update="RTDS\Observation\RtdsExternalBeamEnergy\RtdsExternalBeamEnergy.xml">
294+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
295+
</None>
296+
<None Update="RTDS\Observation\RtdsNumberOfFractions\RtdsNumberOfFractions.xml">
297+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
298+
</None>
299+
<None Update="RTDS\Observation\RtdsReferralDate\RtdsReferralDate.xml">
300+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
301+
</None>
302+
<None Update="RTDS\Observation\RtdsTreatmentAnatomicalSite\RtdsTreatmentAnatomicalSite.xml">
303+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
304+
</None>
287305
<None Update="SACT\Person\SactPerson.xml">
288306
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
289307
</None>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using OmopTransformer.Annotations;
2+
using OmopTransformer.Omop.Observation;
3+
using OmopTransformer.Transformation;
4+
5+
namespace OmopTransformer.RTDS.Observation;
6+
7+
internal class RtdsDecisionToPerformDate : OmopObservation<RtdsDecisionToPerformDateRecord>
8+
{
9+
[CopyValue(nameof(Source.NhsNumber))]
10+
public override string? nhs_number { get; set; }
11+
12+
[ConstantValue(4134859, "Decision to perform date")]
13+
public override int[]? observation_concept_id { get; set; }
14+
15+
[Transform(typeof(DateOnlyConverter), nameof(Source.DateStamp))]
16+
public override DateOnly? observation_date { get; set; }
17+
18+
[Transform(typeof(DateAndTimeCombiner), nameof(Source.DateStamp), nameof(Source.DateStamp))]
19+
public override DateTime? observation_datetime { get; set; }
20+
21+
[ConstantValue(32818, "EHR administration record")]
22+
public override int? observation_type_concept_id { get; set; }
23+
24+
[CopyValue(nameof(Source.DateStamp))]
25+
public override string? value_as_string { get; set; }
26+
27+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Query>
2+
<Sql>
3+
with results as (
4+
select
5+
distinct
6+
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = dc.PatientSer limit 1) as NhsNumber,
7+
dc.DiagnosisCode,
8+
dc.DateStamp,
9+
from omop_staging.RTDS_5_Diagnosis_Course dc
10+
where dc.DiagnosisCode like 'Decision%'
11+
)
12+
select
13+
NhsNumber,
14+
DateStamp
15+
from results
16+
where
17+
NhsNumber is not null
18+
and regexp_matches(NhsNumber, '\d{10}');
19+
</Sql>
20+
<Explanations>
21+
<Explanation columnName="NhsNumber">
22+
<Description>Patient NHS Number</Description>
23+
<Origin>NHS NUMBER</Origin>
24+
</Explanation>
25+
<Explanation columnName="DateStamp">
26+
<Description>Decision date of treatment</Description>
27+
</Explanation>
28+
</Explanations>
29+
</Query>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using OmopTransformer.Annotations;
2+
3+
namespace OmopTransformer.RTDS.Observation;
4+
5+
[DataOrigin("RTDS")]
6+
[Description("RTDS Decision To Perform Date")]
7+
[SourceQuery("RtdsDecisionToPerformDate.xml")]
8+
internal class RtdsDecisionToPerformDateRecord
9+
{
10+
public string? NhsNumber { get; set; }
11+
public string? DateStamp { get; set; }
12+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using OmopTransformer.Annotations;
2+
using OmopTransformer.Omop.Observation;
3+
using OmopTransformer.Transformation;
4+
5+
namespace OmopTransformer.RTDS.Observation;
6+
7+
internal class RtdsExternalBeamEnergy : OmopObservation<RtdsExternalBeamEnergyRecord>
8+
{
9+
[CopyValue(nameof(Source.NhsNumber))]
10+
public override string? nhs_number { get; set; }
11+
12+
[ConstantValue(4045098, "External beam radiation therapy beam energy")]
13+
public override int[]? observation_concept_id { get; set; }
14+
15+
[Transform(typeof(DateOnlyConverter), nameof(Source.Treatmentdatetime))]
16+
public override DateOnly? observation_date { get; set; }
17+
18+
[Transform(typeof(DateAndTimeCombiner), nameof(Source.Treatmentdatetime), nameof(Source.Treatmentdatetime))]
19+
public override DateTime? observation_datetime { get; set; }
20+
21+
[ConstantValue(32818, "EHR administration record")]
22+
public override int? observation_type_concept_id { get; set; }
23+
24+
[Transform(typeof(DoubleParser), nameof(Source.CalculatedNominalEnergy))]
25+
public override double? value_as_number { get; set; }
26+
27+
[CopyValue(nameof(Source.NominalEnergy))]
28+
public override string? value_source_value { get; set; }
29+
30+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<Query>
2+
<Sql>
3+
with results as (
4+
select distinct
5+
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = PatientSer limit 1) as NhsNumber,
6+
Treatmentdatetime,
7+
Cast(NominalEnergy as double) / 1000 as CalculatedNominalEnergy,
8+
NominalEnergy as NominalEnergy
9+
from omop_staging.RTDS_4_Exposures
10+
)
11+
select
12+
NhsNumber,
13+
Treatmentdatetime,
14+
CalculatedNominalEnergy,
15+
NominalEnergy
16+
from results
17+
where
18+
NhsNumber is not null
19+
and regexp_matches(NhsNumber, '\d{10}');
20+
</Sql>
21+
<Explanations>
22+
<Explanation columnName="NhsNumber">
23+
<Description>Patient NHS Number</Description>
24+
<Origin>NHS NUMBER</Origin>
25+
</Explanation>
26+
<Explanation columnName="Treatmentdatetime">
27+
<Description>Start date of treatment</Description>
28+
</Explanation>
29+
<Explanation columnName="NominalEnergy">
30+
<Description>RADIOTHERAPY PRESCRIBED BEAM ENERGY is the prescribed beam energy of a Radiotherapy Exposure used in External Beam Radiotherapy</Description>
31+
<Origin>RADIOTHERAPY PRESCRIBED BEAM ENERGY</Origin>
32+
</Explanation>
33+
<Explanation columnName="CalculatedNominalEnergy">
34+
<Description>RADIOTHERAPY PRESCRIBED BEAM ENERGY is the prescribed beam energy of a Radiotherapy Exposure used in External Beam Radiotherapy</Description>
35+
<Origin>RADIOTHERAPY PRESCRIBED BEAM ENERGY</Origin>
36+
</Explanation>
37+
</Explanations>
38+
</Query>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using OmopTransformer.Annotations;
2+
3+
namespace OmopTransformer.RTDS.Observation;
4+
5+
[DataOrigin("RTDS")]
6+
[Description("RTDS External Beam Radiation Therapy Energy")]
7+
[SourceQuery("RtdsExternalBeamEnergy.xml")]
8+
internal class RtdsExternalBeamEnergyRecord
9+
{
10+
public string? NhsNumber { get; set; }
11+
public string? Treatmentdatetime { get; set; }
12+
public string? NominalEnergy { get; set; }
13+
public string? CalculatedNominalEnergy { get; set; }
14+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using OmopTransformer.Annotations;
2+
using OmopTransformer.Omop.Observation;
3+
using OmopTransformer.Transformation;
4+
5+
namespace OmopTransformer.RTDS.Observation;
6+
7+
internal class RtdsNumberOfFractions : OmopObservation<RtdsNumberOfFractionsRecord>
8+
{
9+
[CopyValue(nameof(Source.NhsNumber))]
10+
public override string? nhs_number { get; set; }
11+
12+
[ConstantValue(4037631, "Number of fractions")]
13+
public override int[]? observation_concept_id { get; set; }
14+
15+
[Transform(typeof(DateOnlyConverter), nameof(Source.StartDateTime))]
16+
public override DateOnly? observation_date { get; set; }
17+
18+
[Transform(typeof(DateAndTimeCombiner), nameof(Source.StartDateTime), nameof(Source.StartDateTime))]
19+
public override DateTime? observation_datetime { get; set; }
20+
21+
[ConstantValue(32818, "EHR administration record")]
22+
public override int? observation_type_concept_id { get; set; }
23+
24+
[Transform(typeof(DoubleParser), nameof(Source.NoFracs))]
25+
public override double? value_as_number { get; set; }
26+
27+
[CopyValue(nameof(Source.NoFracs))]
28+
public override string? value_source_value { get; set; }
29+
30+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Query>
2+
<Sql>
3+
with results as (
4+
select distinct
5+
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = PatientSer limit 1) as NhsNumber,
6+
StartDateTime,
7+
NoFracs
8+
from omop_staging.RTDS_3_Prescription
9+
)
10+
select
11+
NhsNumber,
12+
StartDateTime,
13+
NoFracs
14+
from results
15+
where
16+
NhsNumber is not null
17+
and regexp_matches(NhsNumber, '\d{10}');
18+
</Sql>
19+
<Explanations>
20+
<Explanation columnName="NhsNumber">
21+
<Description>Patient NHS Number</Description>
22+
<Origin>NHS NUMBER</Origin>
23+
</Explanation>
24+
<Explanation columnName="StartDateTime">
25+
<Description>Start date of treatment</Description>
26+
</Explanation>
27+
<Explanation columnName="NoFracs">
28+
<Description>The prescribed number of Radiotherapy Fractions delivered to a PATIENT as described in the Radiotherapy Plan</Description>
29+
<Origin>RADIOTHERAPY PRESCRIBED FRACTIONS</Origin>
30+
</Explanation>
31+
</Explanations>
32+
</Query>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using OmopTransformer.Annotations;
2+
3+
namespace OmopTransformer.RTDS.Observation;
4+
5+
[DataOrigin("RTDS")]
6+
[Description("RTDS Number Of Fractions")]
7+
[SourceQuery("RtdsNumberOfFractions.xml")]
8+
internal class RtdsNumberOfFractionsRecord
9+
{
10+
public string? NhsNumber { get; set; }
11+
public string? StartDateTime { get; set; }
12+
public string? NoFracs { get; set; }
13+
}

0 commit comments

Comments
 (0)