Skip to content

Commit 1bf2358

Browse files
authored
Merge pull request #1027 from FirelyTeam/alexzautke-patch-1
Change CQL Long mapping to return String for R4
2 parents b0e9aca + b33dbc0 commit 1bf2358

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

Cql/CoreTests/Packaging/CqlTypeToFhirTypeMapperTests.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ public void TypeEntryFor_CqlPrimitiveTypeListWithoutElementType_ThrowsArgumentNu
4444
mapper.TypeEntryFor(CqlPrimitiveType.List);
4545
}
4646

47-
[TestMethod]
48-
[ExpectedException(typeof(NotSupportedException))]
49-
public void TypeEntryFor_CqlPrimitiveTypeLong_ThrowsNotSupportedException()
50-
{
51-
// Arrange
52-
var typeResolver = new FhirTypeResolver(ModelInfo.ModelInspector);
53-
var mapper = new CqlTypeToFhirTypeMapper(typeResolver);
54-
55-
// Act
56-
mapper.TypeEntryFor(CqlPrimitiveType.Long);
57-
}
58-
5947
[TestMethod]
6048
public void TypeEntryFor_CqlPrimitiveTypeListWithElementType_ReturnsFhirList()
6149
{
@@ -109,4 +97,20 @@ public void TypeEntryFor_CqlValueTupleType_ReturnsFhirBasic()
10997
Assert.AreEqual(FHIRAllTypes.Basic, result.FhirType);
11098
Assert.AreEqual(CqlPrimitiveType.Tuple, result.CqlType);
11199
}
100+
101+
[TestMethod]
102+
public void TypeEntryFor_CqlLongTypeTuple_ReturnsFhirString()
103+
{
104+
// Arrange
105+
var typeResolver = new FhirTypeResolver(ModelInfo.ModelInspector);
106+
var mapper = new CqlTypeToFhirTypeMapper(typeResolver);
107+
108+
// Act
109+
var result = mapper.TypeEntryFor(CqlPrimitiveType.Long);
110+
111+
// Assert
112+
Assert.IsNotNull(result);
113+
Assert.AreEqual(FHIRAllTypes.String, result.FhirType);
114+
Assert.AreEqual(CqlPrimitiveType.Long, result.CqlType);
115+
}
112116
}

Cql/Cql.Packaging/CqlTypeToFhirTypeMapper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public CqlTypeToFhirTypeMapper(TypeResolver typeResolver, ModelInspector modelIn
131131
return new CqlTypeToFhirMapping(FHIRAllTypes.DateTime, cqlType);
132132
case CqlPrimitiveType.Long:
133133
#if FhirReleaseR4
134-
// integer64 only supported in R5. Compare https://hl7.org/fhir/R4/datatypes.html vs https://hl7.org/fhir/R5/datatypes.html
135-
throw new NotSupportedException("No mapping from CQL Long to FHIR in release 4 (see https://hl7.org/fhir/R4/datatypes.html)");
134+
return new CqlTypeToFhirMapping(FHIRAllTypes.String, cqlType);
136135
//#else FhirReleaseR5
137136
// return new CqlTypeToFhirMapping(FHIRAllTypes.Integer64, cqlType);
138137
#endif
@@ -383,4 +382,4 @@ public record CqlTypeToFhirMapping(
383382
CqlPrimitiveType? CqlType,
384383
CqlTypeToFhirMapping? ElementType = null
385384
);
386-
}
385+
}

0 commit comments

Comments
 (0)