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

FSH based syntax #4

Open
ir4y opened this issue Nov 1, 2023 · 2 comments
Open

FSH based syntax #4

ir4y opened this issue Nov 1, 2023 · 2 comments

Comments

@ir4y
Copy link
Member

ir4y commented Nov 1, 2023

To simplify the mapper we can leverage FSH to describe a resource like this

Instance: undefined
InstanceOf: Patient
Usage: #example
* birthDate = "{{ QuestionnaireResponse.repeat(item).where(linkId='2').answer.value }}"
* name.given = "{{ QuestionnaireResponse.repeat(item).where(linkId='1').answer.value }}"
* telecom[0].value = "{{ QuestionnaireResponse.repeat(item).where(linkId='phone').answer.value }}"
* telecom[=].system = #phone
* telecom[+].value = "{{ QuestionnaireResponse.repeat(item).where(linkId='email').answer.value }}"
* telecom[=].system = #email

When we need to map a list we can use an extension:

Instance: undefined
InstanceOf: Bundle
Usage: #example
* type = #transaction
* entry.request.url = "{{ '/Patient/' + QuestionnaireResponse.repeat(item).where(linkId='patientId').answer.valueString }}"
* entry.request.method = #PATCH
* entry.resource = Inline-Instance-for-undefined-1

Instance: Inline-Instance-for-undefined-1
InstanceOf: Patient
Usage: #inline
* telecom.extension.url = "data-source"
* telecom.extension.valueExpression.language = #text/fhirpath
* telecom.extension.valueExpression.expression = "QuestionnaireResponse.repeat(item).where(linkId='phone-group')"
* telecom.system = #phone
* telecom.use = #"{{ item.where(linkId='phone-type').answer.valueString }}"
* telecom.value = "{{ item.where(linkId='phone-number').answer.valueString }}"
@ir4y
Copy link
Member Author

ir4y commented May 22, 2024

Example that leverage assign #3 in FSH

Instance: undefined
InstanceOf: Bundle
Usage: #example
* type = #transaction
* entry.request.url = "{{ '/Patient/' + QuestionnaireResponse.repeat(item).where(linkId='patientId').answer.valueString }}"
* entry.request.method = #PATCH
* entry.resource = Inline-Instance-for-undefined-1

Instance: Inline-Instance-for-undefined-1
InstanceOf: Patient
Usage: #inline
* extension.url = "assign"
* extension.extension[+].url = "name"
* extension.extension[=].valueString = "qr"
* extension.extension[+].url = "value"
* extension.extension[=].valueExpression.language = #text/fhirpath
* extension.extension[=].valueExpression.expression = "QuestionnaireResponse.repeat(item)"
* telecom.extension.url = "data-source"
* telecom.extension.valueExpression.language = #text/fhirpath
* telecom.extension.valueExpression.expression = "%qr.where(linkId='phone-group')"
* telecom.system = #phone
* telecom.use = #"{{ item.where(linkId='phone-type').answer.valueString }}"
* telecom.value = "{{ item.where(linkId='phone-number').answer.valueString }}"

@ir4y
Copy link
Member Author

ir4y commented May 22, 2024

Example that leverage assign #3 in FSH and RuleSet

Instance: undefined
InstanceOf: Bundle
Usage: #example
* type = #transaction
* entry.request.url = "{{ '/Patient/' + QuestionnaireResponse.repeat(item).where(linkId='patientId').answer.valueString }}"
* entry.request.method = #PATCH
* entry.resource = Inline-Instance-for-undefined-1

Instance: Inline-Instance-for-undefined-1
InstanceOf: Patient
Usage: #inline
* insert Assign("qr", "{{ QuestionnaireResponse.repeat(item) }}")
* telecom.extension.url = "data-source"
* telecom.extension.valueExpression.language = #text/fhirpath
* telecom.extension.valueExpression.expression = "%qr.where(linkId='phone-group')"
* telecom.system = #phone
* telecom.use = #"{{ item.where(linkId='phone-type').answer.valueString }}"
* telecom.value = "{{ item.where(linkId='phone-number').answer.valueString }}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant