FHIR / FHIR/sushi

Improve error output when a contentReference element won't unfold

Open
#1,479 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
188
Forks
64
Avg merge
8d 11h
Merged PRs (30d)
3

Description

Transferred from internal JIRA issue originally created 2023-06-12.

In `ElementDefinition.unfold`, errors may occur if the element specified in a contentReference can’t be found. Currently, the errors are language-level, such as `Cannot read properties of undefined (reading 'length')` rather than SUSHI-specific messages. Update this function so that more useful error messages are produced.

This was found in the HL7/davinci-epdx repository, which uses USCore 3.1.1 as a dependency. The following FSH will cause an error with an unhelpful message:
```
Profile: ProblemProvenance
Parent: us-core-provenance
* entity.agent.role = #12345
```
The contentReference on the `entity.agent` element will not resolve, since it refers to a BackboneElement that does not use the profile element extension.

Contributor guide

Open the contributing guide

Research direction

Start at ElementDefinition.unfold and reproduce the failure with the ProblemProvenance FSH shown in the issue, where entity.agent.role references an unresolved contentReference. Trace the missing element case and make the resulting failure report a useful SUSHI-specific error instead of a language-level exception; the issue does not name a test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.