Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCL not properly handling some mappings with unusual codes #1161

Closed
bmamlin opened this issue Dec 16, 2021 · 5 comments
Closed

OCL not properly handling some mappings with unusual codes #1161

bmamlin opened this issue Dec 16, 2021 · 5 comments
Assignees
Labels
api2 OCL API v2 bug Something isn't working openmrs

Comments

@bmamlin
Copy link

bmamlin commented Dec 16, 2021

While working through #1159 (Importing CIEL v2021-12-15), one of the mappings in CIEL:

{
  "retired": false,
  "from_concept_url": "/orgs/CIEL/sources/CIEL/concepts/149786/",
  "type": "Mapping",
  "source": "CIEL",
  "to_source_url": "/orgs/WHO/sources/ICD-11-WHO/",
  "owner": "CIEL",
  "map_type": "NARROWER-THAN",
  "owner_type": "Organization",
  "external_id": "290537ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
  "to_concept_code": "DA60.Y&XT5R/DA60.Y/ME24.3Z"
}

wasn't properly handled during the bulk import and it was imported as:

{
  "external_id": "290537ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
  "retired": false,
  "map_type": "NARROWER-THAN",
  "source": "CIEL",
  "owner": "CIEL",
  "owner_type": "Organization",
  "from_concept_code": "149786",
  "from_concept_name": null,
  "from_concept_url": "/orgs/CIEL/sources/CIEL/concepts/149786/",
  "to_concept_code": "DA60.Y&XT5R",
  "to_concept_name": null,
  "to_concept_url": null,
  "from_source_owner": "CIEL",
  "from_source_owner_type": "Organization",
  "from_source_url": "/orgs/CIEL/sources/CIEL/",
  "from_source_name": "CIEL",
  "to_source_owner": "WHO",
  "to_source_owner_type": "Organization",
  "to_source_url": "/orgs/WHO/sources/ICD-11-WHO/",
  "to_source_name": "ICD-11-WHO",
  "url": "/orgs/CIEL/sources/CIEL/mappings/5773756/",
  "version": "5773757",
  "id": "5773756",
  "versioned_object_id": 5773756,
  "versioned_object_url": "/orgs/CIEL/sources/CIEL/mappings/5773756/",
  "is_latest_version": true,
  "update_comment": null,
  "version_url": "/orgs/CIEL/sources/CIEL/mappings/5773756/5773757/",
  "uuid": "5773757",
  "version_created_on": "2021-12-16T15:00:13.028921Z",
  "from_source_version": null,
  "to_source_version": null,
  "from_concept_name_resolved": "Acute gastric ulcer with perforation",
  "extras": {},
  "type": "Mapping",
  "created_on": "2021-12-16T15:00:13.028921Z",
  "updated_on": "2021-12-16T15:00:13.033610Z",
  "created_by": "ocladmin",
  "updated_by": "ocladmin",
  "public_can_view": true
}

where the code DA60.Y&XT5R/DA60.Y/ME24.3Z became DA60.Y&XT5R. There are nearly 50 mappings where the code contains a forward slash, almost 20 containing ampersands, and even 1-2 that contain both ampersand and forward slash, so I'm not sure what's special about this one. Maybe multiple forward slashes?

@bmamlin bmamlin added bug Something isn't working api2 OCL API v2 labels Dec 16, 2021
snyaggarwal added a commit to OpenConceptLab/oclapi2 that referenced this issue Dec 17, 2021
@snyaggarwal
Copy link
Contributor

@bmamlin The is fixed. Applied correct encoding. Will be deploying this soon on Staging.

@bmamlin
Copy link
Author

bmamlin commented Dec 17, 2021

Thanks @snyaggarwal.

I deleted (retired) the erroneous mapping on staging and tried to re-import the mapping, but it failed (task 6f473bc1-efb4-47ae-8947-1a9f78eeaccc-ocladmin~priority).

I tried importing this JSON as ocladmin using parallel mode:

{"retired": false, "from_concept_url": "/orgs/CIEL/sources/CIEL/concepts/149786/", "type": "Mapping", "source": "CIEL", "to_source_url": "/orgs/WHO/sources/ICD-11-WHO/", "owner": "CIEL", "map_type": "NARROWER-THAN", "owner_type": "Organization", "external_id": "290537ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "to_concept_code": "DA60.Y&XT5R/DA60.Y/ME24.3Z"}

and it completed with a ""Parent, map_type, from_concept, to_source, to_concept_code must be unique." error as seen in the report:

{
  "total": 1,
  "processed": 1,
  "created": [],
  "updated": [],
  "invalid": [],
  "exists": [],
  "failed": [
    {
      "retired": false,
      "from_concept_url": "/orgs/CIEL/sources/CIEL/concepts/149786/",
      "type": "Mapping",
      "source": "CIEL",
      "to_source_url": "/orgs/WHO/sources/ICD-11-WHO/",
      "owner": "CIEL",
      "map_type": "NARROWER-THAN",
      "owner_type": "Organization",
      "external_id": "290537ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
      "to_concept_code": "DA60.Y&XT5R/DA60.Y/ME24.3Z",
      "errors": {
        "__all__": [
          "Parent, map_type, from_concept, to_source, to_concept_code must be unique."
        ]
      }
    }
  ],
  "exception": [],
  "deleted": [],
  "others": [],
  "unknown": [],
  "permission_denied": [],
  "elapsed_seconds": 41.726099729537964,
  "start_time": "2021-12-17T15:19:59.806301",
  "child_resource_time_distribution": {
    "mapping": 1.007059097290039
  }
}

After retiring the erroneous mapping, I would expect to be able to import the mapping without an error.

@bmamlin
Copy link
Author

bmamlin commented Dec 17, 2021

FYI – I was able to add the mapping manually through the term browser. This unblocks me, but I think there might still be a bug, since I would expect it to have worked via bulk import.

@snyaggarwal
Copy link
Contributor

@bmamlin This is now deployed on Staging

snyaggarwal added a commit to OpenConceptLab/oclapi2 that referenced this issue Dec 20, 2021
@snyaggarwal
Copy link
Contributor

This is done. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api2 OCL API v2 bug Something isn't working openmrs
Projects
None yet
Development

No branches or pull requests

3 participants