Canonical Resource Management Infrastructure Implementation Guide
1.1.0-cibuild - cibuild International flag

Canonical Resource Management Infrastructure Implementation Guide, published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 1.1.0-cibuild built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/crmi-ig/ and changes regularly. See the Directory of published versions

Library: ANC Cohort

Official URL: http://hl7.org/fhir/uv/crmi/Library/ANCCohort Version: 1.1.0-cibuild
Active as of 2025-02-17 Computable Name: ANCCohort
Other Identifiers: OID:2.16.840.1.113883.4.642.40.38.28.1

Cohort definition for antenatal care

Title: ANC Cohort
Id: ANCCohort
Version: 1.1.0-cibuild
Url: ANC Cohort

urn:oid:2.16.840.1.113883.4.642.40.38.28.1

Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2025-02-17 19:51:07+0000
Publisher: HL7 International / Clinical Decision Support
Description:

Cohort definition for antenatal care

Jurisdiction: 001
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Is pregnancy confirmedboolean01Out
Is Antenatal Care Applicableboolean01Out
Data Requirements:
TypeProfileMSCode Filter
Observation http://hl7.org/fhir/StructureDefinition/Observation ; code filter:
path: code

system: http://hl7.org/fhir/uv/crmi/CodeSystem/publishable-example

code: ANC.B4.DE1

display: Pregnancy confirmed

Content: text/cql
library ANCCohort

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC

codesystem "ANCM Concept Codes": 'http://fhir.org/guides/who/smart-anc-mini/CodeSystem/concept-codes'

code "Pregnancy confirmed": 'ANC.B4.DE1' from "ANCM Concept Codes" display 'Pregnancy confirmed'

define "Is Antenatal Care Applicable":
  "Is pregnancy confirmed" is true


/* Copied from ANCMContactDataElements */
/*
  @dataElement: ANC.B4.DE1 Pregnancy confirmed
  @activity: ANC.B4 Confirm pregnancy
  @description: Pregnancy has been confirmed
*/
define "Is pregnancy confirmed":
  MostRecent(
    Final([Observation: "Pregnancy confirmed"])
  ).value as boolean

/* Copied from WHOCommon */
define function Final(observations List<Observation>):
  observations O
    where O.status in { 'final', 'amended', 'corrected' }
      and Coalesce(ModifierExtension(O, 'who-notDone').value, false) is false
      and O.value is not null

define function MostRecent(observations List<Observation>):
  Last(
    observations O
      sort by issued
  )

/*
@description: Returns any WHO core modifier extensions defined on the given resource with the specified id.
@comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
content that is defined by extensions but not yet surfaced in the
CQL model info.
*/
define function ModifierExtensions(domainResource DomainResource, id String):
  domainResource.modifierExtension E
	  where E.url = ('http://fhir.org/guides/who/core/StructureDefinition/' + id)
		return E

/*
@description: Returns the single WHO core modifier extension (if present) on the given resource with the specified id.
@comment: This function uses singleton from to ensure that a run-time exception is thrown if there
is more than one extension on the given resource with the specified url.
*/
define function ModifierExtension(domainResource DomainResource, id String):
  singleton from ModifierExtensions(domainResource, id)

Content: application/elm+xml
Encoded data (33136 characters)
Content: application/elm+json
Encoded data (57992 characters)