Skip to content

Add concept name-update command - #9

Open
jamlung-ri wants to merge 1 commit into
mainfrom
feat/concept-name-update
Open

Add concept name-update command#9
jamlung-ri wants to merge 1 commit into
mainfrom
feat/concept-name-update

Conversation

@jamlung-ri

Copy link
Copy Markdown
Member

Summary

  • Adds concept name-update OWNER SOURCE CONCEPT_ID NAME_UUID command to update an existing concept name's text, locale, type, locale-preferred flag, or external ID
  • Updates concept names --verbose to include a UUID column so users can look up the UUID required for name-update
  • Adds OCLAPIClient.update_concept_name() in api_client.py (issues PUT to .../names/{uuid}/)

Usage

# Find the UUID of the name to update
ocl concept names OWNER SOURCE CONCEPT_ID --verbose

# Update only the fields you want to change
ocl concept name-update OWNER SOURCE CONCEPT_ID NAME_UUID --name "New text"
ocl concept name-update OWNER SOURCE CONCEPT_ID NAME_UUID --locale fr --name-type Synonym
ocl concept name-update OWNER SOURCE CONCEPT_ID NAME_UUID --locale-preferred
ocl concept name-update OWNER SOURCE CONCEPT_ID NAME_UUID --no-locale-preferred

Test plan

  • ocl concept names OWNER SOURCE CONCEPT_ID --verbose shows a UUID column
  • ocl concept name-update ... --name "..." updates the name text and prints the updated name
  • ocl concept name-update ... with no options prints an error and exits non-zero
  • -j flag returns raw JSON from the API
  • Invalid UUID returns a clear API error

🤖 Generated with Claude Code

- `concept name-update OWNER SOURCE CONCEPT_ID NAME_UUID` updates an existing name's text, locale, type, locale-preferred flag, or external ID using a PUT to the names sub-resource
- `concept names --verbose` now includes a UUID column so users can look up the UUID required for name-update
- `OCLAPIClient.update_concept_name()` added alongside `add_concept_name()` in api_client.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@paynejd

paynejd commented Aug 25, 2026

Copy link
Copy Markdown
Member

Thanks @jamlung-ri — I reviewed this against the API and it's in good shape. I confirmed the update endpoint (ConceptNameRetrieveUpdateDestroyView in oclapi2) forces partial=True, so issuing a PUT with only the changed fields is safe — it won't wipe the untouched ones. The new UUID column on names --verbose is a nice touch for finding the value name-update needs, and this rounds out the existing name-add well.

Two things before I merge:

  1. Add a test. Add concept list command #10 (just merged) introduced a lightweight pattern for exactly this in tests/test_concept_commands.py — a CliRunner with a fake client, asserting the command calls the client method with the expected kwargs. A short mirror of that for name-update (including the "no fields → non-zero exit" case) would cover it.
  2. File a tracking ticket in OpenConceptLab/ocl_issues and link it here. Heads up that we hadn't actually written "every PR links an issue" down in this repo — that's on us, and I'm fixing the docs — but going forward we'd like each PR to reference one.

(README is already updated 👍 — an optional one-line entry in docs/demos/ would round it out.)

Once the test's in, I'll merge. Thanks!

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