-
Notifications
You must be signed in to change notification settings - Fork 64
mappings
- Overview
- Get a single mapping
- List mappings for a concept
- List mappings for a specific source
- List mappings across sources
- Create a new mapping
- Edit a mapping
- Retire mapping
The API exposes a representation of mappings
to represent relationships between 2 concepts. The type of relationship is defined by the map_type
attribute. Relationships are unidirectional, originating from the from_concept
to the to_concept
, even if the inverse mapping is equivalent (e.g. "Same As" relationship). Note that the inverse mappings can be retrieved from the "to_concept" by setting the "includeInverseMappings" to true
. mappings
are also used to store hierarchical relationships (such as parent/child), and OpenMRS-specific relationships such as Question/Answer and Concept Sets.
The from_concept
must be a concept within an OCL source, while the to_concept
may refer to a concept stored in OCL or to an external code. Regardless, the definition for the source must be defined in OCL. If the to_concept
refers to a concept in OCL, it is referenced using the to_concept_url
field. If the to_concept
refers to an external concept, it is referenced using the to_source_url
, to_concept_code
, and to_concept_name
fields.
Editing of mappings is supported, but edits that substantively change the meaning of a mapping is discouraged. For example, instead of changing the "from" or "to" concept of an existing mapping, retire the mapping and create a new one.
Similar to concepts
, mappings
are owned by sources
, rather than by their from_concept
. Modifications to mappings do not directly effect the concepts to which it is linked. Like concepts
, mappings
will be saved as part of source versions. Mappings may point to concepts from any source, meaning that neither the "from" or "to" concept needs to be in the source that owns the mapping.
However, the from_concept must always be stored in OCL. There are two types of to_concepts:
- Internal - The to concept is stored in OCL
- External - The from source is defined in OCL, but it is just a placeholder
Following are the fields that are required to be set for each type above:
field | type |
---|---|
to_concept_url | 1 |
to_concept_code | 2 |
to_source_url | 2 |
- Based on the new model in which mappings are saved with source versions, it may be necessary to treat versions of mappings exactly the same as versions of concepts, however until that is decided---
- Version history is not stored for
mappings
- edits are in-place and only standard audit information is maintained ("created_on", "created_by", "updated_on", "updated_by")
- Get a single mapping
GET /orgs/:org/sources/:source/mappings/:mapping/
GET /users/:user/sources/:source/mappings/:mapping/
GET /user/sources/:source/mappings/:mapping/
GET /orgs/Regenstrief/sources/loinc2/mappings/8d492ee0-c2cc-11de-8d13-0010c6dffd0f/
- Status: 200 OK
{
"type": "Mapping",
"uuid": "8d492ee0-c2cc-11de-8d13-0010c6dffd0f",
"external_id": "a9d93ffjjen9dnfekd9",
"retired": "false",
"map_type": "Same As",
"from_source_owner": "Regenstrief",
"from_source_owner_type": "Organization",
"from_source_name": "loinc2",
"from_concept_code": "32700-7",
"from_source_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/",
"to_source_owner": "WHO",
"to_source_owner_type": "Organization",
"to_source_name": "ICPC-2",
"to_concept_code": "A73",
"to_concept_name": "Malaria",
"to_source_url": "https://api.openconceptlab.org/v1/orgs/WHO/sources/ICPC-2/",
"source": "loinc2",
"owner": "Regenstrief",
"owner_type": "Organization",
"url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/mappings/8d492ee0-c2cc-11de-8d13-0010c6dffd0f/",
"extras": [],
"created_on": "2008-01-14T04:33:35Z",
"created_by": "johndoe",
"updated_on": "2008-02-18T09:10:16Z",
"updated_by": "johndoe"
}
- List mappings or inverse mappings for a concept
GET /user/sources/:source/concepts/:concept/mappings/
GET /users/:user/sources/:source/concepts/:concept/mappings/
GET /orgs/:org/sources/:source/concepts/:concept/mappings/
- Parameters
- includeRetired (optional) string - default - "false"; set to "true" to return retired mappings
- includeInverseMappings (optional) string - default is "false"; set to "true" to return inverse mappings
- Status: 200 OK
[
{
"map_type": "Same As",
"retired": "false",
"source": "loinc2",
"owner": "Regenstrief",
"owner_type": "Organization",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/",
"to_concept_url": "https://api.openconceptlab.org/v1/orgs/WHO/sources/ICPC-2/concepts/A73/",
"url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/mappings/8d492ee0-c2cc-11de-8d13-0010c6dffd0f/",
},
{
"map_type": "Narrower Than",
"retired": "false",
"source": "loinc2",
"owner": "Regenstrief",
"owner_type": "Organization",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/",
"to_concept_code": "A73",
"to_concept_name": "Malaria",
"to_source_code": "ICPC-2",
"url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/def3fe-c2cc-11de-8d13-asdf9393930/",
},
{
"map_type": "Same As",
"retired": "false",
"source": "loinc2",
"owner": "Regenstrief",
"owner_type": "Organization",
"to_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/WHO/sources/ICPC-2/concepts/A73/",
"url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/mappings/8d492ee0-c2cc-11de-8d13-0010c6dffdea/",
}
]
- List all mappings for an organization or user's source based on its current state - NOTE: Retired mappings are excluded by default
GET /orgs/:org/sources/:source/mappings/
GET /users/:user/sources/:source/mappings/
GET /user/sources/:source/mappings/
- List all mappings for a specific version of a source - NOTE: Retired mappings are excluded by default
GET /orgs/:org/sources/:source/:sourceVersion/mappings/
GET /users/:user/sources/:source/:sourceVersion/mappings/
GET /user/sources/:source/:sourceVersion/mappings/
- Parameters
- q (optional) string - ID of the "from" or "to" concept
- includeRetired (optional) string - default is "false"; set to "true" to return retired mappings
- maptype (optional) string - maptype descriptor, such as "Same As", "Parent", "Child", etc.
- includeInverseMappings (optional) string - "true" or "false"; default is "false"
- Sources
- source (optional) string - comma-separated list of sources for the "from" or "to" source; can be the "code" for the source (e.g. "SNOMED-CT" or "ICPC-2") or the fully specified URL
- from_source (optional) string - comma-separated list of sources for the "from" source; can be the "code" for the source (e.g. "SNOMED-CT" or "ICPC-2") or the fully specified URL
- to_source (optional) string - comma-separated list of sources for the "to" source; can be the "code" for the source (e.g. "SNOMED-CT" or "ICPC-2") or the fully specified URL
- Concepts
- concept (optional) string - comma-separated list of concepts for the "from" or "to" concept; can be the "code" for the concept (e.g. A57) or the fully-specified URL
- from_concept (optional) string - comma-separated list of concepts for the "from" concept; can be the "code" for the concept (e.g. A57) or the fully-specified URL
- to_concept (optional) string - comma-separated list of concepts for the "to" concept; can be the "code" for the concept (e.g. A57) or the fully-specified URL
GET /orgs/Regenstrief/sources/loinc2/mappings/
- Status: 200 OK
[
{
"map_type": "Same As",
"retired": "false",
"source": "loinc2",
"owner": "Regenstrief",
"owner_type": "Organization",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/",
"to_concept_url": "https://api.openconceptlab.org/v1/orgs/WHO/sources/ICPC-2/concepts/A73/",
"url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/mappings/8d492ee0-c2cc-11de-8d13-0010c6dffd0f/",
}
]
- List mappings across all sources
GET /mappings/
- Parameters
- q (optional) string - ID of the "from" or "to" concept
- includeRetired (optional) string - default is "false"; set to "true" to return retired mappings
- maptype (optional) string - map type descriptor, such as "Same As", "Parent", "Child", etc.
- includeInverseMappings (optional) string - "true" or "false"; default is "false"
- Sources
- source (optional) string - comma-separated list of sources for the "from" or "to" source; can be the "code" for the source (e.g. "SNOMED-CT" or "ICPC-2") or the fully specified URL
- from_source (optional) string - comma-separated list of sources for the "from" source; can be the "code" for the source (e.g. "SNOMED-CT" or "ICPC-2") or the fully specified URL
- to_source (optional) string - comma-separated list of sources for the "to" source; can be the "code" for the source (e.g. "SNOMED-CT" or "ICPC-2") or the fully specified URL
- Concepts
- concept (optional) string - comma-separated list of concepts for the "from" or "to" concept; can be the "code" for the concept (e.g. A57) or the fully-specified URL
- from_concept (optional) string - comma-separated list of concepts for the "from" concept; can be the "code" for the concept (e.g. A57) or the fully-specified URL
- to_concept (optional) string - comma-separated list of concepts for the "to" concept; can be the "code" for the concept (e.g. A57) or the fully-specified URL
- Status: 200 OK
[
{
"map_type": "Same As",
"retired": "false",
"source": "loinc2",
"owner": "Regenstrief",
"owner_type": "Organization",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/",
"to_concept_url": "https://api.openconceptlab.org/v1/orgs/WHO/sources/ICPC-2/concepts/A73/",
"url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/mappings/8d492ee0-c2cc-11de-8d13-0010c6dffd0f/",
}
]
- Create a new mapping originating from the specified concept
POST /user/sources/:source/mappings/
POST /users/:user/sources/:source/mappings/
POST /orgs/:org/sources/:source/mappings/
- Input
- Internal Mapping:
to_concept
is stored in OCL- map_type (required) string - map type
- from_concept_url (required) string - URL of the "from" concept
- to_concept_url (required) string - fully specified url for the concept
- External Mapping:
to_concept
is not stored in OCL- map_type (required) string - map type
- from_concept_url (required) string - URL of the "from" concept
- to_source_code (required) string - short-code for the external source
- to_concept_code (required) string - code for the to_concept
- to_concept_name (optional) string - name of the to_concept
- Internal Mapping:
- Internal mapping:
to_concept
is stored in OCL:
{
"map_type": "Same As",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/Columbia/sources/CIEL/concepts/161426/",
"to_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/"
}
- External mapping:
to_concept
is not stored in OCL:
{
"map_type": "Narrower Than",
"from_concept_url": "https://api.openconceptlab.org/v1/orgs/Columbia/sources/CIEL/concepts/116125/",
"to_source_url": "https://api.openconceptlab.org/v1/orgs/WHO/sources/ICPC-2/",
"to_concept_code": "A73",
"to_concept_name": "Malaria"
}
- Status: 201 Created
- Location: https://api.openconceptlab.org/v1/orgs/Columbia/sources/CIEL/mappings/8d492ee0-c2cc-11de-8d13-0010c6dffd0f/
- Returns the JSON representation of the new mapping in the same format as Get a single mapping
- Edit a mapping
POST /user/sources/:source/mappings/:mapping/
POST /users/:user/sources/:source/mappings/:mapping/
POST /orgs/:org/sources/:source/mappings/:mapping/
- Input
- Internal Mapping:
to_concept
is stored in OCL- map_type (optional) string - map type
- from_concept_url (optional) string - URL of the "from" concept
- to_concept_url (optional) string - fully specified url for the concept
- External Mapping:
to_concept
is not stored in OCL- map_type (optional) string - map type
- from_concept_url (optional) string - URL of the "from" concept
- to_source_url (optional) string - fully specified url for the source - note that the source must be defined in OCL
- to_concept_code (optional) string - code for the to_concept
- to_concept_name (optional) string - name of the to_concept
- Internal Mapping:
- Internal Mapping:
to_concept
is stored in OCL
{
"map_type": "Same As",
"to_concept_url": "https://api.openconceptlab.org/v1/orgs/Regenstrief/sources/loinc2/concepts/32700-7/"
}
- External Mapping:
to_concept
is not stored in OCL
{
"map_type": "Narrower Than",
"to_source_code": "ICPC-2",
"to_concept_code": "A73",
"to_concept_name": "Malaria",
}
- Status: 200 OK
- Returns the updated JSON representation of the mapping in the same format as Get a single mapping
- Retire mapping - NOTE that this does not delete the mapping; rather, it sets its "retired" attribute to "true" so that it does not show up by default in results, and it indicates to users that the mappings should no longer be used.
DELETE /user/sources/:source/mappings/:mapping/
DELETE /users/:user/sources/:source/mappings/:mapping/
DELETE /orgs/:org/sources/:source/mappings/:mapping/
- Status: 204 No Content
- Confirm URL parameters supported for searching mappings
- Should add "retire_reason" to indicate why mapping was retired and possibly which mapping to use in its place
Overview
Resources
Import / Export
- CSV Import
- Bulk Import
- Org/Source Import
- Export API
- Subscriptions
- Subscription Client Testing Process
- OpenMRS to OCL Mapping
Troubleshooting & Operations
- Data integrity checks
- Maintaining OCLAPI's Docker containers
- Maintaining MongoDB and Solr
- How to check logs
- NewRelic monitoring setup
- Configuration changes to make tests and import job run faster
- Accessing Solr UI Remotely
- Data Backup and Restore
- SSL Configuration
- Flower
- Switching to Maintenance Mode on Production Server
- Docker networking and Security
Other