Skip to content

Commit d53f004

Browse files
committed
Update readme
1 parent a03e054 commit d53f004

1 file changed

Lines changed: 49 additions & 5 deletions

File tree

README.md

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,13 @@ and other usage in [unit tests](https://github.com/beda-software/FHIRPathMapping
575575

576576
## Reference implementation
577577

578+
## Strict mode
579+
580+
FHIRPath provides a way of accessing the `resource` variables without the percent sign. It potentially leads to the issues made by typos in the variable names.
581+
582+
See the particular implementation for details of usage.
583+
584+
578585
### TypeScript
579586

580587
TypeScript implementation that supports all the specification is already available [in this repository](https://github.com/beda-software/FHIRPathMappingLanguage/tree/main/ts/server).
@@ -603,12 +610,9 @@ POST /r4/parse-template
603610

604611
#### Strict mode
605612

606-
FHIRPath provides a way of accessing the `resource` variables without the percent sign. It potentially leads to the issues made by typos in the variable names.
607-
608-
There's a runtime flag, called `strict` that is set to `false` by default. If it set to `true`, all accesses to the variables without the percent sign will be rejected and exception will be thrown.
613+
There's a flag, called `strict` that is set to `false` by default. If it set to `true`, all accesses to the variables without the percent sign will be rejected and exception will be thrown.
609614

610-
611-
The previous example should be re-written as
615+
The previous example using strict mode:
612616

613617
POST /r4/parse-template?strict=true
614618

@@ -670,3 +674,43 @@ result = resolve_template(resource, template, context)
670674
print(result)
671675
# {'resourceType': 'Patient', 'name': 'Name'}
672676
```
677+
678+
#### Strict mode
679+
680+
There's a flag, called `strict` that is set to `false` by default. If it set to `true`, all accesses to the variables without the percent sign will be rejected and exception will be thrown.
681+
682+
Example:
683+
684+
```python
685+
result = resolve_template(
686+
resource,
687+
template,
688+
context,
689+
strict=True
690+
)
691+
```
692+
693+
694+
695+
#### User-defined functions
696+
697+
There's an ability to pass user-defined functions through fp_options
698+
699+
Example:
700+
701+
```python
702+
user_invocation_table = {
703+
"pow": {
704+
"fn": lambda inputs, exp=2: [i**exp for i in inputs],
705+
"arity": {0: [], 1: ["Integer"]},
706+
}
707+
}
708+
709+
result = resolve_template(
710+
resource,
711+
template,
712+
context,
713+
fp_options={'userInvocationTable': user_invocation_table}
714+
)
715+
```
716+

0 commit comments

Comments
 (0)