Skip to content

add draft for FHIR $add-mapping operation#9

Open
galemsky-hs wants to merge 16 commits intomainfrom
add-mapping-fhir-operation
Open

add draft for FHIR $add-mapping operation#9
galemsky-hs wants to merge 16 commits intomainfrom
add-mapping-fhir-operation

Conversation

@galemsky-hs
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor Author

@galemsky-hs galemsky-hs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very rough so far

Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Comment thread docs/v2-to-fhir-spec/add-mapping-fhir-operation.md Outdated
Copy link
Copy Markdown
Contributor Author

@galemsky-hs galemsky-hs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's much better already! But it raises several design questions we need to address


The `$add-mappings` operation adds one or more mappings to a ConceptMap resource without returning the full resource content.

The [$add](https://hl7.org/fhir/R5/resource-operation-add.html) operation supports only Group and List resources and returns the modified resource. For large ConceptMap resources, returning the full content is not practical.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be moved to the "rationale" section that will not be part of the spec, since it's not really a part of it and I believe it won't be present on the hl7.org page of the operation.


The operation is atomic: if any mapping causes an error, no mappings are added.

All ConceptMap elements outside of `group` are ignored.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make the language closer to the $add spec:

The server SHALL ignore all elements except for the relevant array (e.g., Group.member or List.entry).


- If a mapping does not exist, it is added.
- If a mapping exists with identical values for all fields, no action is taken.
- If a mapping exists with different values (e.g., different `relationship`, `display`, or `comment`), the server SHALL return an error.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmmm... So if there's a collision, it will require a manual intervention, since we don't have $remove-mapping or $insert-mapping operations. It's worth to discuss it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the standard approach for adding multiple elements is making a Bundle which already has the property: type = transaction/batch. It will solve the problem, but will make the solution less elegant. Need to discuss as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add specs:

  1. the current one
  2. add-mapping that behaves like merge ("This instance-level operation merges array entries into an existing ("target") resource, based on values from a supplied ("input") resource, ignoring any values that are already present in the target. ")
  3. merge-mapping that behaves like merge


The [$add](https://hl7.org/fhir/R5/resource-operation-add.html) operation supports only Group and List resources and returns the modified resource. For large ConceptMap resources, returning the full content is not practical.

The server SHALL add mappings from the input `group` elements. Two mappings are considered the same if they share the same `group.source`, `group.target`, `element.code`, and `target.code`.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"SHALL add all mappings" I think

@@ -0,0 +1,96 @@
# Operation $add-mappings on ConceptMap

The `$add-mappings` operation adds one or more mappings to a ConceptMap resource without returning the full resource content.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's better to keep singular name ($add-mapping) even though it can insert many. Looks more aligned with fhir IMO

- If a mapping exists with different values (e.g., different `relationship`, `display`, or `comment`), the server SHALL return an error.
- If a `group` with the specified `source` and `target` does not exist, it is created.

The operation is atomic: if any mapping causes an error, no mappings are added.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, need to check if it aligns with fhir standards


All ConceptMap elements outside of `group` are ignored.

URL: [base]/ConceptMap/[id]/$add-mappings
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be moved to the top


URL: [base]/ConceptMap/[id]/$add-mappings

This is an idempotent operation.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can merge atomic property and this claim into 1 line

@galemsky-hs galemsky-hs force-pushed the add-mapping-fhir-operation branch from dba6eb5 to d8b1735 Compare February 12, 2026 12:27
Seryiza and others added 11 commits February 18, 2026 15:14
- Simplify $add-mapping to merge semantics
- Rename $add-mappings to $add-mapping
- Ignore duplicates instead of returning conflict
- Remove atomicity requirement
- Add OperationDefinition JSON targeting FHIR R6
- Move rationale (why not $add) to separate section
- Use FHIR conformance language ("SHALL ignore")
- Reorder sections to match FHIR spec structure
- Mark as not idempotent
- Restructure document to contain both $add-mapping and $remove-mapping
- Add shared introduction and rationale section
- Add complete $remove-mapping operation with parameters, examples, and
  formal OperationDefinition
- Move rationale to document top, demote Examples/Formal Definition to
  subsections
- Align with FHIR style conventions
@galemsky-hs galemsky-hs force-pushed the add-mapping-fhir-operation branch from 7828a23 to b7fd53f Compare February 18, 2026 09:14
@galemsky-hs galemsky-hs force-pushed the add-mapping-fhir-operation branch from 33aca9a to d1d0f41 Compare February 18, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants