-
Notifications
You must be signed in to change notification settings - Fork 57
Hook for implicit ID generation #1570
Description
Our project would like to reduce the onus of creating and explicitly setting the ID value, and we are aware that Sushi sets defaults, but uses the Name: as the value. We would like to
- use
kebab-case - have postfixes derived from
- Sushi constructs (e.g.
Profilebeing-pr) for most types - or special conditions on instances (e.g.
Examplebeing-exfor instances withUsage: #example)
We would also like to enforce that the filenames are matching these identifiers (a type of linting).
Since this is pretty specific and opinionated, we would like a hook that sushi will invoke with TS code that is committed along with the project.
Could you:
- point us to the respective entrypoint in the source where the current direct derivation is happening, so we can change it experimentally?
- comment on this proposal?
Alternatively, and more comfortably, we could see a facility where these factors are driven by a table like the one below and a set of clauses in FHIRPath.
Below is some of our thinking.
Moniker Extension Strategy:
Primary Table – FSH Declarations:
Maps FSH declarations (e.g., Profile, Extension, Instance) to short, lowercase monikers (e.g., pro, ext, ins).
See the table below:
| Declaration | Creates… | Data Type | Moniker |
|---|---|---|---|
| Alias | An alias for a URL or OID | expression | ali |
| CodeSystem | A code system | name | cs |
| Extension | An extension | name | ext |
| Instance | An instance | id | ins |
| Invariant | An invariant | id | inv |
| Logical | A logical model | name | log |
| Mapping | A mapping | id | map |
| Profile | A profile | name | pro |
| Resource | A custom resource | name | res |
| RuleSet | A set of rules that can be reused | name | rs |
| ValueSet | A value set | name | vs |
Secondary Table – Usage-Based Instance Types:
For Instance declarations, a secondary extensible table assigns monikers based on the Usage attribute or known patterns.
Examples include:
SearchParameterwithUsage = #definition→sp- Any instance with
Usage = #example→ex - This table is designed to be extensible to accommodate new instance types of interest.
Rationale:
-
Disambiguation:
Assigning unique, descriptive IDs and filenames helps human users quickly identify the purpose and type of each file, especially in large projects with many similarly named resources. -
Brevity and Clarity:
The usage-based moniker system ensures that identifiers remain concise while still conveying meaningful information about the resource type or purpose. -
Extensibility:
The secondary table allows for future growth and adaptation to new FHIR resource types or project-specific conventions.