Skip to content

Support uuid5() function in transformation expressions #116

@amc-corey-cox

Description

@amc-corey-cox

Problem

There's no way to generate deterministic identifiers within expr: fields in transformation specs. This is needed when:

  1. A source entity (e.g., Visit) needs a stable UUID as its id
  2. Other entities (Conditions, Observations, etc.) need to reference that same Visit by its UUID
  3. The Visit spec and the referencing specs are processed independently — there's no cross-spec state

Without deterministic UUID generation, there's no way for independently processed specs to produce matching identifiers.

Proposed solution

Add a uuid5() function available in expr: fields that generates a UUID v5 from a namespace and a name string:

# In visit.yaml
id:
  expr: 'uuid5("https://w3id.org/bdchm/Visit", {participant_id} + ":" + {visit_name})'

# In condition.yaml — produces the same UUID for the same inputs
associated_visit:
  expr: 'uuid5("https://w3id.org/bdchm/Visit", {participant_id} + ":" + {visit_name})'

UUID5 is deterministic — same namespace + same name always produces the same UUID — so specs processed independently will generate matching references without any shared state.

Context

The BioData Catalyst harmonized model (bdchm) requires Visit entities to have URI-based identifiers. Other entities reference Visits via associated_visit (range: Visit). Currently there's no way to mint these IDs during transformation, forcing workarounds like using visit names as temporary IDs.

Ref: linkml/dm-bip#235

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions