Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions conf/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,132 @@
"groupName": "Uncertainty tests",
"testName": "TimeDurationBetweenHourDiffPrecision",
"reason": "CQLtoELM - Syntax error at Z"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Abs",
"testName": "AbsLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Add",
"testName": "Add1L2L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Add",
"testName": "Add1L1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "MinValue",
"testName": "LongMinValue",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "MaxValue",
"testName": "LongMaxValue",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Modulo",
"testName": "Modulo4LBy2L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Multiply",
"testName": "Multiply2LBy3L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Multiply",
"testName": "Multiply1By1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Negate",
"testName": "Negate1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Negate",
"testName": "NegateMaxLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Negate",
"testName": "NegateNeg1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Predecessor",
"testName": "PredecessorOf1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Power",
"testName": "Power2LTo2L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Power",
"testName": "Power2LTo3L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Subtract",
"testName": "Subtract1LAnd1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Successor",
"testName": "SuccessorOf1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Truncated Divide",
"testName": "TruncatedDivide10LBy3L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Product",
"testName": "ProductLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Max",
"testName": "MaxTestLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Min",
"testName": "MinTestLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Sum",
"testName": "SumTestLong",
"reason": "FHIR R4 does not support Long/Integer64"
}
]
}
Expand Down
164 changes: 145 additions & 19 deletions conf/localhost.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,150 @@
"Tests": {
"ResultsPath": "./results",
"SkipList": [
{
"testsName": "CqlAggregateTest",
"groupName": "AggregateTests",
"testName": "RolledOutIntervals",
"reason": "CQLtoELM - Could not resolve identifier MedicationRequestIntervals in the current library"
},
{
"testsName": "CqlDateTimeOperatorsTest",
"groupName": "DateTimeComponentFrom",
"testName": "DateTimeComponentFromTimezone",
"reason": "CQLtoElm - Timezone keyword is only valid in 1.3 or lower"
},
{
"testsName": "CqlDateTimeOperatorsTest",
"groupName": "Uncertainty tests",
"testName": "TimeDurationBetweenHourDiffPrecision",
"reason": "CQLtoELM - Syntax error at Z"
}
]
{
"testsName": "CqlAggregateTest",
"groupName": "AggregateTests",
"testName": "RolledOutIntervals",
"reason": "CQLtoELM - Could not resolve identifier MedicationRequestIntervals in the current library"
},
{
"testsName": "CqlDateTimeOperatorsTest",
"groupName": "DateTimeComponentFrom",
"testName": "DateTimeComponentFromTimezone",
"reason": "CQLtoElm - Timezone keyword is only valid in 1.3 or lower"
},
{
"testsName": "CqlDateTimeOperatorsTest",
"groupName": "Uncertainty tests",
"testName": "TimeDurationBetweenHourDiffPrecision",
"reason": "CQLtoELM - Syntax error at Z"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Abs",
"testName": "AbsLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Add",
"testName": "Add1L2L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Add",
"testName": "Add1L1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "MinValue",
"testName": "LongMinValue",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "MaxValue",
"testName": "LongMaxValue",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Modulo",
"testName": "Modulo4LBy2L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Multiply",
"testName": "Multiply2LBy3L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Multiply",
"testName": "Multiply1By1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Negate",
"testName": "Negate1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Negate",
"testName": "NegateMaxLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Negate",
"testName": "NegateNeg1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Predecessor",
"testName": "PredecessorOf1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Power",
"testName": "Power2LTo2L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Power",
"testName": "Power2LTo3L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Subtract",
"testName": "Subtract1LAnd1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Successor",
"testName": "SuccessorOf1L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlArithmeticFunctionsTest",
"groupName": "Truncated Divide",
"testName": "TruncatedDivide10LBy3L",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Product",
"testName": "ProductLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Max",
"testName": "MaxTestLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Min",
"testName": "MinTestLong",
"reason": "FHIR R4 does not support Long/Integer64"
},
{
"testsName": "CqlAggregateFunctionsTest",
"groupName": "Sum",
"testName": "SumTestLong",
"reason": "FHIR R4 does not support Long/Integer64"
}
]
}
}
37 changes: 37 additions & 0 deletions src/extractors/value-type-extractors/long-extractor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { BaseExtractor } from '../base-extractor.js';

const CQL_TYPE_EXTENSION_URL = 'http://hl7.org/fhir/StructureDefinition/cqf-cqlType';

function hasCqlLongType(parameter: any): boolean {
const extensions = Array.isArray(parameter?.extension) ? parameter.extension : [];
return extensions.some(
(extension: any) =>
extension?.url === CQL_TYPE_EXTENSION_URL &&
String(extension?.valueString ?? '').toLowerCase() === 'system.long'
);
}

function parseLong(value: unknown): bigint | undefined {
if (value === undefined || value === null) return undefined;

const text = String(value).trim();
const normalized = text.endsWith('L') || text.endsWith('l') ? text.slice(0, -1) : text;

if (!/^[+-]?\d+$/.test(normalized)) return undefined;

return BigInt(normalized);
}

export class LongExtractor extends BaseExtractor {
protected _process(parameter: any): any {
if (parameter.hasOwnProperty('valueInteger64')) {
return parseLong(parameter.valueInteger64);
}

if (parameter.hasOwnProperty('valueString') && hasCqlLongType(parameter)) {
return parseLong(parameter.valueString);
}

return undefined;
}
}
2 changes: 2 additions & 0 deletions src/server/extractor-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EvaluationErrorExtractor } from '../extractors/evaluation-error-extract
import { NullEmptyExtractor } from '../extractors/null-empty-extractor.js';
import { UndefinedExtractor } from '../extractors/undefined-extractor.js';
import { StringExtractor } from '../extractors/value-type-extractors/string-extractor.js';
import { LongExtractor } from '../extractors/value-type-extractors/long-extractor.js';
import { BooleanExtractor } from '../extractors/value-type-extractors/boolean-extractor.js';
import { IntegerExtractor } from '../extractors/value-type-extractors/integer-extractor.js';
import { DecimalExtractor } from '../extractors/value-type-extractors/decimal-extractor.js';
Expand All @@ -24,6 +25,7 @@ export function buildExtractor(): ResultExtractor {
extractors
.setNextExtractor(new NullEmptyExtractor())
.setNextExtractor(new UndefinedExtractor())
.setNextExtractor(new LongExtractor())
.setNextExtractor(new StringExtractor())
.setNextExtractor(new BooleanExtractor())
.setNextExtractor(new IntegerExtractor())
Expand Down
Loading