REFERENCE_REQUIRED_EXCEMPTIONS = ['Patient', 'ResearchStudy', 'Substance'] # this is not an exhaustive list
if parse_result.resource.resource_type not in REFERENCE_REQUIRED_EXCEMPTIONS and len(nested_references) == 0:
parse_result.exception = Exception(
f"Resource has no references {parse_result.resource.resource_type}/{parse_result.resource.id}"
)
exceptions.append(parse_result)
Improvement would flag these types of structures as invalid
See https://github.com/ACED-IDP/gen3_util/blob/9317dd9001b0a9db1b64b7f9a404370f5e15c721/gen3_util/meta/validator.py#L93
Pseudo-code: