Skip to content

Cannot change concept datatype #2192

@brandones

Description

@brandones

Issue tracker is ONLY used for reporting bugs. New features should be discussed with us on OCL Chat or on one our slack channels.

Concept datatype cannot be changed using the Edit Concept endpoint. It seems like it can't be changed in the UI either. Is there any workaround?

Expected Behavior

Concept datatype should change when I make the API call to change it.

Current Behavior

If I POST: 200 with no change. If I PUT or PATCH:

Error: Failed to modify concept: Bad Request
Response body: {"names":["A concept must have at least one name"]}

Possible Solution

Steps to Reproduce

Changing conceptId 7896219 from Coded to Text. Current datatype is Coded. Target datatype is Text.

POST

    const response = await fetch(conceptUrl, {
        method: 'POST',
        headers: {
            'Authorization': `Token ${oclToken}`,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            datatype: datatype
        })
    });

Result:

uvl-ciel 7896219 Text
200 {
  uuid: '7896219',
  extras: {},
  checksums: {
    smart: '17677ccff4e14f6a9cf1b51aca57b55f',
    standard: '291988511925c366ebb34f6a8c3d4f32'
  },
  id: '7896219',
  external_id: 'c87ac09c-a7e3-48b0-91a4-0c5d3c9f1a0d',
  concept_class: 'Test',
  datatype: 'Coded',
  url: '/orgs/UVL-Burundi/sources/uvl-ciel/concepts/7896219/',

It's still Coded!

PUT

    const response = await fetch(conceptUrl, {
        method: 'PUT',
        headers: {
            'Authorization': `Token ${oclToken}`,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            datatype: datatype
        })
    });

Result:

uvl-ciel 7896219 Text
/home/brandon/Code/openmrs/UVL-OCL/concept-import-labs.mts:222
        throw new Error(`Failed to change concept datatype: ${response.statusText}\nResponse body: ${errorBody}`);
              ^


Error: Failed to change concept datatype: Bad Request
Response body: {"names":["A concept must have at least one name"]}

PATCH does the same as PUT.

Context (Environment)

I want to change some concept datatypes.

Detailed Description

Possible Implementation

Metadata

Metadata

Assignees

Labels

type/bugSomething is broken

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions