Add tests for the CalculateAgeAt operators (clinical operators have none)

オープン 初心者向け
#157 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
領域
testing-qa

調査の方向性

tests/cql/CqlClinicalOperatorsTest.xml で作業し、提案された XML 構造と CalculateAgeAt 式を出発点として使用します。近くにある CQL テストファイルと比較し、新しい clinical-operators 機能がテストスイートで受け入れられることを確認します。完了とは、列挙された precision、birthday、DateTime、null のケースが表現され、検証に合格することです。

索引モデルが issue の本文から書いたものです。

説明

Gap

tests/cql has no test for any operator in Appendix B, section "Clinical Operators": there is no CalculateAge…At expression anywhere in the suite (grep -r CalculateAge tests/cql is empty at 9e92193), and none of the open pull requests adds one. The CalculateAgeAt family is one of the most used operators in real measure logic (every age-band population criterion), and it has its own edge cases (birthday not yet reached in the asOf year, null operands, the coarser-precision uncertainty the specification describes).

Proposal

A new file tests/cql/CqlClinicalOperatorsTest.xml with one group per precision. The values below are for someone born 1976-01-01 as of 2020-01-02: 44 years; 528 months; 16072 days (2296 weeks); 385728 hours, 23143680 minutes, 1388620800 seconds. Following the specification (CQL 1.5.3, Appendix B, "CalculateAgeAt": "if the given birthDate or asOf are not specified to the level of precision corresponding to the operator being invoked, the result will be an uncertainty"), the hour/minute/second cases use full DateTime literals, so their results are single values; the year/month/week/day cases use Date literals, which are precise enough for those precisions.

<?xml version="1.0" encoding="utf-8"?>
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://hl7.org/fhirpath/tests" xsi:schemaLocation="http://hl7.org/fhirpath/tests ../../testSchema/testSchema.xsd"
	name="CqlClinicalOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#clinical-operators-3" version="1.0">
	<capability code="clinical-operators" />
	<group name="CalculateAgeAt" version="1.0" reference="https://cql.hl7.org/09-b-cqlreference.html#calculateageat">
		<capability code="clinical-operators" />
		<test name="CalculateAgeInYearsAtSpecExample" version="1.0">
			<!-- the specification's own example -->
			<expression>CalculateAgeInYearsAt(@2000-01-01, @2015-01-01)</expression>
			<output>15</output>
		</test>
		<test name="CalculateAgeInYearsAt" version="1.0">
			<expression>CalculateAgeInYearsAt(@1976-01-01, @2020-01-02)</expression>
			<output>44</output>
		</test>
		<test name="CalculateAgeInYearsAtDayBeforeBirthday" version="1.0">
			<!-- the birthday in the asOf year has not been reached -->
			<expression>CalculateAgeInYearsAt(@1976-01-02, @2020-01-01)</expression>
			<output>43</output>
		</test>
		<test name="CalculateAgeInYearsAtDateTime" version="1.0">
			<expression>CalculateAgeInYearsAt(@1976-01-01T00:00:00.000, @2020-01-02T00:00:00.000)</expression>
			<output>44</output>
		</test>
		<test name="CalculateAgeInYearsAtNullAsOf" version="1.0">
			<expression>CalculateAgeInYearsAt(@2000-01-01, null)</expression>
			<output>null</output>
		</test>
		<test name="CalculateAgeInYearsAtNullBirthDate" version="1.0">
			<expression>CalculateAgeInYearsAt(null, @2015-01-01)</expression>
			<output>null</output>
		</test>
		<test name="CalculateAgeInMonthsAt" version="1.0">
			<expression>CalculateAgeInMonthsAt(@1976-01-01, @2020-01-02)</expression>
			<output>528</output>
		</test>
		<test name="CalculateAgeInWeeksAt" version="1.0">
			<expression>CalculateAgeInWeeksAt(@1976-01-01, @2020-01-02)</expression>
			<output>2296</output>
		</test>
		<test name="CalculateAgeInDaysAt" version="1.0">
			<expression>CalculateAgeInDaysAt(@1976-01-01, @2020-01-02)</expression>
			<output>16072</output>
		</test>
		<test name="CalculateAgeInHoursAt" version="1.0">
			<expression>CalculateAgeInHoursAt(@1976-01-01T00:00:00.000, @2020-01-02T00:00:00.000)</expression>
			<output>385728</output>
		</test>
		<test name="CalculateAgeInMinutesAt" version="1.0">
			<expression>CalculateAgeInMinutesAt(@1976-01-01T00:00:00.000, @2020-01-02T00:00:00.000)</expression>
			<output>23143680</output>
		</test>
		<test name="CalculateAgeInSecondsAt" version="1.0">
			<expression>CalculateAgeInSecondsAt(@1976-01-01T00:00:00.000, @2020-01-02T00:00:00.000)</expression>
			<output>1388620800</output>
		</test>
	</group>
</tests>

Notes:

  • clinical-operators would be a new capability code; none of the existing codes covers this section.
  • AgeInYearsAt and the other Age… operators without a birth date need a Patient context and a data model, so they are out of reach of this expression-only format; the CalculateAge…At overloads exercise the same duration logic without that dependency.
  • A case where the birth date is 29 February and asOf is 28 February of a non-leap year would exercise the same rule as YearsBetweenLeapYearDatesEquals2; I left it out to keep this proposal independent of that test.

If the committers prefer a pull request, I can open one with this file.

主要言語
言語のデータがありません
スター
8
フォーク
9
平均マージ
4日 2時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cqframework/cql-tests のほかの issue

cqframework/cql-tests の issue をすべて見る

似ている issue

Testing & QA の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。