Introduction
This section describes the standard objects available to JavaScript callbacks executing in the Smile CDR JavaScript execution environment.
Here is the current list of JavaScript callbacks available in Smile CDR.
Module | Configuration | Functions |
---|---|---|
CDA Exchange | N/A N/A |
generateCdaExchangeComposition(...) |
CDA Exchange | cda_processing_script.text cda_processing_script.file |
onPostImportCDA(...) onPreImportCDA(...) onPostExportCDA(...) |
CDA Exchange+ | cda_processing_script.text cda_processing_script.file |
onPostImportCDA(...) onPreImportCDA(...) onPostExportCDA(...) |
Channel Import | etl_script.text etl_script.file |
handleChannelImportJsonPayload(...) handleChannelImportStringPayload(...) |
ETL Importer | mapping.script mapping.script.file |
handleEtlImportRow(...) |
ETL Importer | parallelism.hashing.script parallelism.hashing.script.file |
hashEtlImportRow(...) |
FHIR REST Endpoint (All FHIR Versions) | consent_service.script.text consent_service.script.file |
consentStartOperation(...) consentCanSeeResource(...) consentWillSeeResource(...) completeOperationSuccess(...) completeOperationFailure(...) |
FHIR Storage | callback_script.text callback_script.file |
fhirResourceCreated(...) fhirResourceDeleted(...) fhirResourcePreCreate(...) fhirResourcePreDelete(...) fhirResourcePreUpdate(...) fhirResourceUpdated(...) |
FHIR Storage | consent_service.script.text consent_service.script.file |
consentStartOperation(...) consentCanSeeResource(...) consentWillSeeResource(...) completeOperationSuccess(...) completeOperationFailure(...) |
FHIR Storage | javascript_repository_validation.script.text javascript_repository_validation.script.file |
repositoryValidationProvideRules(...) |
FHIR Storage | livebundle_service.script.text livebundle_service.script.file |
buildLiveBundleRuleSet(...) |
HL7 v2.x Listening Endpoint | listener_script.text listener_script.file |
onPreConvertHl7V2ToFhir(...) onPostConvertHl7V2ToFhir(...) |
HL7 v2.x Listening Endpoint (Deprecated) | listener_script.text listener_script.file |
onPreConvertHl7V2ToFhir(...) onPostConvertHl7V2ToFhir(...) |
HL7 v2.x Sending Endpoint | mapper_script.text mapper_script.file |
onPostConvertFhirToHl7V2(...) |
Local Inbound Security | callback_script.text callback_script.file |
authenticate(...) onAuthenticateSuccess(...) getUserName(...) onSmartScopeAuthorityNarrowing(...) |
Local Inbound Security | user_self_registration.create_script.text user_self_registration.create_script.file |
onUserSelfRegistrationRequest(...) |
MDM | key_interceptor_script.text key_interceptor_script.file |
mdmGenerateMessageKey(...) |
MDM | survivorship_script.text survivorship_script.file |
|
SMART Outbound Security | codap.auth_script.text codap.auth_script.file |
authenticate(...) |
SMART Outbound Security | post_authorize_script.text post_authorize_script.file |
onAuthenticateSuccessClientCredentials(...) onPostAuthorize(...) onTokenGenerated(...) onTokenGenerating(...) onSmartLoginPreContextSelection(...) onSmartLoginPostContextSelection(...) onSmartScopeAuthorityNarrowing(...) |
Scripted Inbound Security | script.text script.file |
authenticate(...) authenticateAnonymous(...) |
System to System Data Exchange | rule_interceptor_script.text rule_interceptor_script.file |
matchPatient(...) |
Normally, configuration changes are only applied when a module is restarted. This applies to scripts, and other settings. However, in a development environment if you are running a single standalone instance of Smile CDR, you can enable reload_scripts_on_save (in the Smile CDR properties file) to reload scripts automatically in that server process when module configuration changes are saved. This can be useful for quickly testing script changes. These changes will NOT apply to an entire cluster, and is this is not appropriate for use in production.
module.clustermgr.config.reload_scripts_on_save =true
import
statements.
patient.name.family
with patient.name[0].family
string.contains('foo')
with string.includes('foo')
string.replaceAll('foo', 'bar')
with string.split('foo').join('bar')
string.regionMatches(true, 0, 'foo', 0, 3)
with .substring(0, 3).toUpperCase() === '
foo'
==
to ===