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 CQL operation for returning resources with subset of fields/properties #1218

Open
JPercival opened this issue Sep 26, 2023 · 2 comments
Open
Labels
cql The issue relates to or requires a change or clarification on the CQL specification enhancement

Comments

@JPercival
Copy link
Contributor

Being able to manipulate the values of individual elements in a return, rather than having to re-state the entire resource.

define function "MedicationRequestResource"(medicationRequest MedicationRequest, profileURLs List<FHIR.canonical>):
  medicationRequest m
  return MedicationRequest{
    id: FHIR.id {value: 'LCR-' + m.id},
    meta: MetaElement(medicationRequest, profileURLs),
    extension: m.extension,
    identifier: m.identifier,
    status: m.status,
    statusReason: m.statusReason,
    intent: m.intent,
    category: m.category,
    priority: m.priority,
    doNotPerform: m.doNotPerform,
    reported: m.reported,
    medication: m.medication,
    subject: m.subject,
    encounter: m.encounter,
    supportingInformation: m.supportingInformation,
    authoredOn: m.authoredOn,
    requester: m.requester,
    performer: m.performer,
    performerType: m.performerType,
    recorder: m.recorder,
    reasonCode: m.reasonCode,
    reasonReference: m.reasonReference,
    instantiatesCanonical: m.instantiatesCanonical,
    instantiatesUri: m.instantiatesUri,
    basedOn: m.basedOn,
    groupIdentifier: m.groupIdentifier,
    courseOfTherapyType: m.courseOfTherapyType,
    insurance: m.insurance,
    note: m.note,
    dosageInstruction: m.dosageInstruction,
    dispenseRequest: m.dispenseRequest,
    substitution: m.substitution,
    priorPrescription: m.priorPrescription,
    detectedIssue: m.detectedIssue,
    eventHistory: m.eventHistory
  }
@JPercival
Copy link
Contributor Author

JPercival commented Sep 27, 2023

@brynrhodes - Looks to me that this is a request that would require updating the CQL spec. I don't think CQL has a story for this currently. Something like:

define "Clones":
  [Encounter] E return E.Clone({ id:  'Prefix-' + E.id})

Where the parameters are the set of key-value pairs to override. I think doing this in a type-safe way for arbitrary data types requires higher-kinded type parameters, which CQL doesn't support. The non-type-safe equivalent could result in runtime errors.

@JPercival JPercival added the cql The issue relates to or requires a change or clarification on the CQL specification label Sep 28, 2023
@JPercival
Copy link
Contributor Author

Discussed with Bryn on a side-channel. This would require a change to the CQL specification and will be under consideration for the CQL 2.0 spec. So while it's not being closed forever, it'll be on the backlog a while before we decide what to do with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cql The issue relates to or requires a change or clarification on the CQL specification enhancement
Projects
None yet
Development

No branches or pull requests

1 participant