Skip to content

Commit

Permalink
WIP: Update as_fn function
Browse files Browse the repository at this point in the history
  • Loading branch information
projkov committed Dec 22, 2023
1 parent fda4941 commit aae2beb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions fhirpathpy/engine/invocations/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def is_fn(ctx, coll, type_info):


def as_fn(ctx, coll, type_info):
TypeInfo.model = ctx.get("model")
if not coll:
return []
if len(coll) > 1:
Expand Down
5 changes: 3 additions & 2 deletions fhirpathpy/engine/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def get_type_info(self):
if not TypeInfo.model:
return TypeInfo.create_by_value_in_namespace(namespace=namespace, value=self.data)

return TypeInfo(namespace=namespace, name="BackboneElement")
return TypeInfo(namespace=namespace, name=self.path)

def toJSON(self):
return json.dumps(self.data)
Expand All @@ -805,7 +805,8 @@ def is_type(type_name, super_type):
while type_name:
if type_name == super_type:
return True
type_name = TypeInfo.model.get("type2Parent").get(type_name)
# TODO: Double check it
type_name = TypeInfo.model.get("type2Parent").get(type_name) or TypeInfo.model.get("path2Type").get(type_name)
return False

def is_(self, other):
Expand Down

0 comments on commit aae2beb

Please sign in to comment.