Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CRMI Effective Data Requirements Extension to CDS on FHIR Service Discovery #5876

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
type: add
issue: 5873
title: "Added support for CDS on FHIR PlanDefinitions that use the CRMI Effective Data Requirements extension when
creating the JSON for the Service Discovery. Also added support for use of the FHIR Query Pattern extension when
generating Prefetch Templates for Service Discovery. If a DataRequirement has FHIR Query Pattern extensions they
will be used, otherwise Prefetch Templates will be generated."
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ To create CDS Services from PlanDefinitions the dependencies for a FHIR Storage

Any PlanDefinition resource with an action that has a trigger of type [named-event](http:https://hl7.org/fhir/R4/codesystem-trigger-type.html#trigger-type-named-event) will have a CDS Service created using the PlanDefinition.id as the service id and the name of the trigger as the hook that the service is created for per the [CDS on FHIR Specification](https://hl7.org/fhir/clinicalreasoning-cds-on-fhir.html#surfacing-clinical-decision-support).

The [CRMI Effective Data Requirements](https://hl7.org/fhir/uv/crmi/1.0.0-snapshot/StructureDefinition-crmi-effectiveDataRequirements.html) extension, if present, will be used to determine the library to use when creating the prefetch templates. Otherwise, the primary library of the PlanDefinition will be used.

CDS Services created this way will show up as registered services and can be called just as other services are called. The CDS Service request will be converted into parameters for the [$apply operation](/docs/clinical_reasoning/plan_definitions.html#apply), the results of which are then converted into a CDS Response per the [CDS on FHIR Specification](https://hl7.org/fhir/clinicalreasoning-cds-on-fhir.html#consuming-decision-support).

These CDS Services will take advantage of the [Auto Prefetch](/docs/cds_hooks/#auto-prefetch) feature. Prefetch data is included as a Bundle in the `data` parameter of the $apply call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
package ca.uhn.hapi.fhir.cdshooks.svc.cr;

public class CdsCrConstants {
private CdsCrConstants() {}

public static final String CDS_CR_MODULE_ID = "CR";

public static final String CRMI_EFFECTIVE_DATA_REQUIREMENTS =
"http:https://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements";

public static final String CQF_FHIR_QUERY_PATTERN = "http:https://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern";

// CDS Hook field names
public static final String CDS_PARAMETER_USER_ID = "userId";
public static final String CDS_PARAMETER_PATIENT_ID = "patientId";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*-
* #%L
* HAPI FHIR - CDS Hooks
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.cdshooks.svc.cr.discovery;

import org.opencds.cqf.fhir.api.Repository;

public abstract class BasePrefetchTemplateBuilder {
protected final String PATIENT_ID_CONTEXT = "{{context.patientId}}";
protected final int DEFAULT_MAX_URI_LENGTH = 8000;
protected int myMaxUriLength;

protected final Repository myRepository;

public BasePrefetchTemplateBuilder(Repository theRepository) {
myRepository = theRepository;
myMaxUriLength = DEFAULT_MAX_URI_LENGTH;
}
}
Loading
Loading