Skip to content

Commit

Permalink
Update ofType
Browse files Browse the repository at this point in the history
  • Loading branch information
atuonufure committed Jan 12, 2024
1 parent 88d3150 commit 3e5fbde
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fhirpathpy/engine/invocations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"single": {"fn": filtering.single_fn},
"first": {"fn": filtering.first_fn},
"last": {"fn": filtering.last_fn},
"ofType": {"fn": filtering.of_type_fn, "arity": {1: ["Identifier"]}},
"ofType": {"fn": filtering.of_type_fn, "arity": {1: ["TypeSpecifier"]}},
"type": {"fn": types.type_fn, "arity": {0: []}},
"is": {"fn": types.is_fn, "arity": {1: ["TypeSpecifier"]}},
"as": {"fn": types.as_fn, "arity": {1: ["TypeSpecifier"]}},
Expand Down
2 changes: 1 addition & 1 deletion fhirpathpy/engine/invocations/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def check_fhir_type(ctx, x, tp):


def of_type_fn(ctx, coll, tp):
return list(filter(lambda x: check_fhir_type(ctx, util.get_data(x), tp), coll))
return [value for value in coll if nodes.TypeInfo.from_value(value).is_(tp)]


def extension(ctx, data, url):
Expand Down
4 changes: 4 additions & 0 deletions fhirpathpy/engine/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,10 @@ def create_by_value_in_namespace(namespace, value):
name = "time"
elif isinstance(value, FP_Quantity):
name = "Quantity"
elif isinstance(value, str):
name = "string"
elif isinstance(value, dict):
name = "object"

if name == "bool":
name = "boolean"
Expand Down

0 comments on commit 3e5fbde

Please sign in to comment.