Skip to content

Commit

Permalink
Merge branch 'develop-2.0' into dependabot/nuget/Serilog.Extensions.L…
Browse files Browse the repository at this point in the history
…ogging-9.0.0
  • Loading branch information
baseTwo authored Dec 20, 2024
2 parents 80345e5 + d190621 commit 9e0e6b2
Show file tree
Hide file tree
Showing 81 changed files with 23,550 additions and 22,791 deletions.
11 changes: 5 additions & 6 deletions Cql-Sdk-All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00 MSBuild Tooling", "00 MS
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10 Demo Projects", "10 Demo Projects", "{85401759-2C64-414D-9882-4DB1EA41C2ED}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10 Demo Projects", "10 Demo Projects", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -425,10 +423,10 @@ Global
{50590B39-F376-4E96-92CF-67F84C149E86} = {97D67019-21A7-4591-A216-1B76BD0E68A4}
{FEF0C134-505D-4206-8630-569A6762F787} = {97D67019-21A7-4591-A216-1B76BD0E68A4}
{1C19BCFA-9965-49EC-952B-DBC753E219A2} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{A7111722-6C8F-42AA-8CDD-732D34FB678A} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{A7111722-6C8F-42AA-8CDD-732D34FB678A} = {85401759-2C64-414D-9882-4DB1EA41C2ED}
{12BB22FD-E576-44A9-AE74-A5A673715870} = {7D787B73-D44A-4B65-B83F-4AF4A752F26C}
{7D787B73-D44A-4B65-B83F-4AF4A752F26C} = {B00E560D-AE0C-48E1-9013-57115AF05F41}
{B1161915-FFB0-412A-9C65-2F4E046FA9B8} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{B1161915-FFB0-412A-9C65-2F4E046FA9B8} = {85401759-2C64-414D-9882-4DB1EA41C2ED}
{ED703B53-BF12-4F55-B35A-F8290F542E16} = {314A4A1E-1671-4F4C-BA1F-DEE73D584677}
{314A4A1E-1671-4F4C-BA1F-DEE73D584677} = {4B5D75F5-E2FC-4CCB-90EF-6DC4A0193032}
{DEA0937C-6F6B-4B25-8F9B-0ABE82978321} = {B00E560D-AE0C-48E1-9013-57115AF05F41}
Expand All @@ -437,7 +435,7 @@ Global
{D0F1B9D3-DD8C-4F25-B7AF-0C2EB4E17AC3} = {4B5D75F5-E2FC-4CCB-90EF-6DC4A0193032}
{97D67019-21A7-4591-A216-1B76BD0E68A4} = {4B5D75F5-E2FC-4CCB-90EF-6DC4A0193032}
{B574B177-48B2-455B-BEF8-B7D6DB5C3015} = {97D67019-21A7-4591-A216-1B76BD0E68A4}
{C5C0F7CF-D0A4-41F5-B426-D99F40EC0379} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{C5C0F7CF-D0A4-41F5-B426-D99F40EC0379} = {85401759-2C64-414D-9882-4DB1EA41C2ED}
{A2259B13-A115-4EA3-9DFB-5411DB88EA6F} = {4B5D75F5-E2FC-4CCB-90EF-6DC4A0193032}
{AF223BDF-576D-45FD-9A33-483BAFE1BB75} = {A2259B13-A115-4EA3-9DFB-5411DB88EA6F}
{BF2C14B3-EF9B-4BE9-A843-EAA05368BD5A} = {A2259B13-A115-4EA3-9DFB-5411DB88EA6F}
Expand All @@ -451,9 +449,10 @@ Global
{584116D7-4E88-401E-8089-BAA6A35DB591} = {1AF2E4B2-99C5-4678-B926-D224CC83A8F7}
{B4C6C534-15E6-4364-A68C-286EB0EFAD50} = {314A4A1E-1671-4F4C-BA1F-DEE73D584677}
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {B00E560D-AE0C-48E1-9013-57115AF05F41}
{85401759-2C64-414D-9882-4DB1EA41C2ED} = {B00E560D-AE0C-48E1-9013-57115AF05F41}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {366252DE-C2FB-4EAC-96EE-22210BD43DE2}
FileExplorer = |build\|docs\|LibrarySets\|submodules\Firely.Cql.Sdk.Integration.Runner\NodeJsUtils\
SolutionGuid = {366252DE-C2FB-4EAC-96EE-22210BD43DE2}
EndGlobalSection
EndGlobal
10,257 changes: 5,194 additions & 5,063 deletions Cql/CoreTests/CSharp/FHIRConversionTest-2023.0.0.g.cs

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions Cql/CoreTests/CSharp/FHIRHelpers-4.0.1.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,16 @@ CqlConcept a_()
List<Coding> b_ = concept?.Coding;
CqlCode c_(Coding C)
{
CqlCode g_ = this.ToCode(context, C);
CqlCode h_ = this.ToCode(context, C);

return g_;
return h_;
};
IEnumerable<CqlCode> d_ = context.Operators.Select<Coding, CqlCode>((IEnumerable<Coding>)b_, c_);
FhirString e_ = concept?.TextElement;
string f_ = e_?.Value;
IEnumerable<CqlCode> e_ = context.Operators.Distinct<CqlCode>(d_);
FhirString f_ = concept?.TextElement;
string g_ = f_?.Value;

return new CqlConcept(d_, f_);
return new CqlConcept(e_, g_);
}
};

Expand Down
22 changes: 22 additions & 0 deletions Cql/CoreTests/CSharp/TestRetrieve-1.0.1.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,26 @@ public Patient Patient(CqlContext context)
return b_;
}


[CqlDeclaration("InDemographic")]
public IEnumerable<Patient> InDemographic(CqlContext context)
{
IEnumerable<Patient> a_ = context.Operators.Retrieve<Patient>(new RetrieveParameters(default, default, default, "http://hl7.org/fhir/StructureDefinition/Patient"));

return a_;
}


[CqlDeclaration("SexuallyActive")]
public bool? SexuallyActive(CqlContext context)
{
IEnumerable<Condition> a_ = context.Operators.Retrieve<Condition>(new RetrieveParameters(default, default, default, "http://hl7.org/fhir/StructureDefinition/Condition"));
bool? b_ = context.Operators.Exists<Condition>(a_);
IEnumerable<ServiceRequest> c_ = context.Operators.Retrieve<ServiceRequest>(new RetrieveParameters(default, default, default, "http://hl7.org/fhir/StructureDefinition/ServiceRequest"));
bool? d_ = context.Operators.Exists<ServiceRequest>(c_);
bool? e_ = context.Operators.Or(b_, d_);

return e_;
}

}
9 changes: 9 additions & 0 deletions Cql/CoreTests/CSharp/TestRetrieveInclude-1.0.1.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ public CqlValueSet Inflammatory_Diseases_of_Female_Reproductive_Organs(CqlContex
public CqlValueSet Chlamydia(CqlContext context) =>
new CqlValueSet("2.16.840.1.113883.3.464.1003.112.12.1003", default);


[CqlDeclaration("InDemographic")]
public IEnumerable<Observation> InDemographic(CqlContext context)
{
IEnumerable<Observation> a_ = context.Operators.Retrieve<Observation>(new RetrieveParameters(default, default, default, "http://hl7.org/fhir/StructureDefinition/Observation"));

return a_;
}

}
2 changes: 1 addition & 1 deletion Cql/CoreTests/CoreTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
Expand Down
4 changes: 3 additions & 1 deletion Cql/CoreTests/Elm/TestDataRequirementsAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public void ConvertRetrievesToDataRequirements()

// Assert
var actual = dataRequirements.Select(dr => dr.Type).Distinct().ToArray();
actual.Should().BeEquivalentTo([FHIRAllTypes.Patient]);

// Condition+Patient+ServiceRequest is from TestRetrieve, Observation is from TestRetrieveInclude
actual.Should().BeEquivalentTo([FHIRAllTypes.Patient, FHIRAllTypes.ServiceRequest, FHIRAllTypes.Condition, FHIRAllTypes.Observation]);
}
}
18 changes: 2 additions & 16 deletions Cql/CoreTests/Input/ELM/HL7/TestRetrieve.cql
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,7 @@ parameter MeasurementPeriod default Interval[DateTime(2013, 1, 1, 0, 0, 0, 0), D

context Patient

define "InDemographic":
AgeInYearsAt(start of MeasurementPeriod) >= 16 and AgeInYearsAt(start of MeasurementPeriod) < 24
and "Patient"."gender" in test."Female Administrative Sex"
define "InDemographic": ["Patient"]

define "SexuallyActive":
exists (["Condition": test."Other Female Reproductive Conditions"] C where Interval[C.onset, C.abatement] overlaps MeasurementPeriod)
or exists (["Condition": test."Genital Herpes"] C where Interval[C.onset, C.abatement] overlaps MeasurementPeriod)
or exists (["Condition": onset = 'HIV'] C where Interval[C.onset, C.abatement] overlaps MeasurementPeriod)
or exists (["ServiceRequest": status in {'a','b'}] O where O.authoredOn during MeasurementPeriod)

define "InInitialPopulation":
"InDemographic" and "SexuallyActive"

define "InDenominator":
true

define "InNumerator":
exists (["DiagnosticReport": "Chlamydia Screening"] R where R.effective during MeasurementPeriod and R."result" is not null)
exists (["Condition"]) or exists (["ServiceRequest"])
92 changes: 92 additions & 0 deletions Cql/CoreTests/Input/ELM/HL7/TestRetrieve.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,98 @@
"type" : "Retrieve"
}
}
}, {
"locator" : "30:1-30:35",
"name" : "InDemographic",
"context" : "Patient",
"accessLevel" : "Public",
"resultTypeSpecifier" : {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}Patient",
"type" : "NamedTypeSpecifier"
}
},
"expression" : {
"locator" : "30:25-30:35",
"dataType" : "{http://hl7.org/fhir}Patient",
"templateId" : "http://hl7.org/fhir/StructureDefinition/Patient",
"type" : "Retrieve",
"resultTypeSpecifier" : {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}Patient",
"type" : "NamedTypeSpecifier"
}
}
}
}, {
"locator" : "32:1-33:57",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}Boolean",
"name" : "SexuallyActive",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"locator" : "33:5-33:57",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}Boolean",
"type" : "Or",
"signature" : [ {
"name" : "{urn:hl7-org:elm-types:r1}Boolean",
"type" : "NamedTypeSpecifier"
}, {
"name" : "{urn:hl7-org:elm-types:r1}Boolean",
"type" : "NamedTypeSpecifier"
} ],
"operand" : [ {
"locator" : "33:5-33:26",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}Boolean",
"type" : "Exists",
"signature" : [ {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}Condition",
"type" : "NamedTypeSpecifier"
}
} ],
"operand" : {
"locator" : "33:12-33:26",
"dataType" : "{http://hl7.org/fhir}Condition",
"templateId" : "http://hl7.org/fhir/StructureDefinition/Condition",
"type" : "Retrieve",
"resultTypeSpecifier" : {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}Condition",
"type" : "NamedTypeSpecifier"
}
}
}
}, {
"locator" : "33:31-33:57",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}Boolean",
"type" : "Exists",
"signature" : [ {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}ServiceRequest",
"type" : "NamedTypeSpecifier"
}
} ],
"operand" : {
"locator" : "33:38-33:57",
"dataType" : "{http://hl7.org/fhir}ServiceRequest",
"templateId" : "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
"type" : "Retrieve",
"resultTypeSpecifier" : {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}ServiceRequest",
"type" : "NamedTypeSpecifier"
}
}
}
} ]
}
} ]
}
}
Expand Down
4 changes: 4 additions & 0 deletions Cql/CoreTests/Input/ELM/HL7/TestRetrieveInclude.cql
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
library TestRetrieveInclude version '1.0.1'

using FHIR version '4.0.1'

valueset "Female Administrative Sex": '2.16.840.1.113883.3.560.100.2'
valueset "Other Female Reproductive Conditions": '2.16.840.1.113883.3.464.1003.111.12.1006'
valueset "Genital Herpes": '2.16.840.1.113883.3.464.1003.110.12.1049'
valueset "Genococcal Infections and Venereal Diseases": '2.16.840.1.113883.3.464.1003.112.12.1001'
valueset "Inflammatory Diseases of Female Reproductive Organs": '2.16.840.1.113883.3.464.1003.112.12.1004'
valueset "Chlamydia": '2.16.840.1.113883.3.464.1003.112.12.1003'

define "InDemographic": ["Observation"]
45 changes: 39 additions & 6 deletions Cql/CoreTests/Input/ELM/HL7/TestRetrieveInclude.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,79 @@
"def" : [ {
"localIdentifier" : "System",
"uri" : "urn:hl7-org:elm-types:r1"
}, {
"locator" : "3:1-3:26",
"localIdentifier" : "FHIR",
"uri" : "http://hl7.org/fhir",
"version" : "4.0.1"
} ]
},
"valueSets" : {
"def" : [ {
"locator" : "3:1-3:69",
"locator" : "5:1-5:69",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}ValueSet",
"name" : "Female Administrative Sex",
"id" : "2.16.840.1.113883.3.560.100.2",
"accessLevel" : "Public"
}, {
"locator" : "4:1-4:91",
"locator" : "6:1-6:91",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}ValueSet",
"name" : "Other Female Reproductive Conditions",
"id" : "2.16.840.1.113883.3.464.1003.111.12.1006",
"accessLevel" : "Public"
}, {
"locator" : "5:1-5:69",
"locator" : "7:1-7:69",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}ValueSet",
"name" : "Genital Herpes",
"id" : "2.16.840.1.113883.3.464.1003.110.12.1049",
"accessLevel" : "Public"
}, {
"locator" : "6:1-6:98",
"locator" : "8:1-8:98",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}ValueSet",
"name" : "Genococcal Infections and Venereal Diseases",
"id" : "2.16.840.1.113883.3.464.1003.112.12.1001",
"accessLevel" : "Public"
}, {
"locator" : "7:1-7:106",
"locator" : "9:1-9:106",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}ValueSet",
"name" : "Inflammatory Diseases of Female Reproductive Organs",
"id" : "2.16.840.1.113883.3.464.1003.112.12.1004",
"accessLevel" : "Public"
}, {
"locator" : "8:1-8:64",
"locator" : "10:1-10:64",
"resultTypeName" : "{urn:hl7-org:elm-types:r1}ValueSet",
"name" : "Chlamydia",
"id" : "2.16.840.1.113883.3.464.1003.112.12.1003",
"accessLevel" : "Public"
} ]
},
"statements" : {
"def" : [ {
"locator" : "12:1-12:39",
"name" : "InDemographic",
"context" : "Patient",
"accessLevel" : "Public",
"resultTypeSpecifier" : {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}Observation",
"type" : "NamedTypeSpecifier"
}
},
"expression" : {
"locator" : "12:25-12:39",
"dataType" : "{http://hl7.org/fhir}Observation",
"templateId" : "http://hl7.org/fhir/StructureDefinition/Observation",
"type" : "Retrieve",
"resultTypeSpecifier" : {
"type" : "ListTypeSpecifier",
"elementType" : {
"name" : "{http://hl7.org/fhir}Observation",
"type" : "NamedTypeSpecifier"
}
}
}
} ]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Cql/CoreTests/QueriesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void Query_source_using_define()
});
ctx = GetNewContext(bundle);
result = QueriesDefinitions.Invoke<IEnumerable<Observation>>(QueriesLibrary, "Query source using define", ctx);
Assert.AreEqual(2, result.Count());
Assert.AreEqual(1, result.Count());
}

[TestMethod]
Expand Down Expand Up @@ -380,7 +380,7 @@ public void Retrieve_with_all_null_query_source()
var ctx = GetNewContext(bundle);
// type of the query source is List<Any>
var result = QueriesDefinitions.Invoke<IEnumerable<object>>(QueriesLibrary, "Retrieve with all null query source", ctx);
Assert.AreEqual(3, result.Count());
Assert.AreEqual(1, result.Count());
}

[TestMethod]
Expand Down
6 changes: 6 additions & 0 deletions Cql/Cql.Compiler/ExpressionBuilderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,12 @@ void PushScopes(
var selectLambda = Expression.Lambda(selectBody, scopeParameter);
var callSelect = BindCqlOperator(nameof(ICqlOperators.Select), @return, selectLambda);
@return = callSelect;
if (query.@return.distinct)
{
var qt = query.GetTypeSpecifier();
var t = TypeFor(qt, false);
@return = BindCqlOperator(nameof(ICqlOperators.Distinct), [@return]);
}
}
}

Expand Down
Loading

0 comments on commit 9e0e6b2

Please sign in to comment.