in bulkExport/glueScripts/export-script.py [0:0]
def is_included_in_group_export(resource, group_member_ids, group_patient_ids, compartment_search_params, server_url, transitive_reference_ids=set()):
# Check if resource is part of the group
if resource['id'] in group_member_ids or resource['id'] in transitive_reference_ids:
return True
# Check if resource is part of the patient compartment
if resource['resourceType'] in compartment_search_params:
# Get inclusion criteria paths for the resource
inclusion_paths = compartment_search_params[resource['resourceType']]
for path in inclusion_paths:
reference = deep_get(resource, path.split("."))
for ref in reference:
if is_internal_reference(ref['reference'], server_url) and ref['reference'].split('/')[-1] in group_patient_ids:
return True
return False