Skip to content

Commit

Permalink
Merge pull request #133 from x-atlas-consortia/simmons/umls_api_key
Browse files Browse the repository at this point in the history
Simmons/umls api key
  • Loading branch information
yuanzhou authored Jun 11, 2024
2 parents b8d08bf + 710c5c3 commit be9f7e5
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 147 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ If you are working with a local Docker distribution based on from [ubkg-neo4j](h
- USERNAME=neo4j
- PASSWORD= the value of _neo4j_password_ from the common **container.cfg** file.

## Using API keys
Some deployments based on the UBKG API may require that calls to endpoints include an API key in the header.
Because this involves integration with authorization architecture (e.g., API gateways and authorization specific to a
network resource), the configuration of API keys is beyond the scope of the UBKG API.


### Starting your neo4j instance
If you are using a local instance of the UBKG, the instance should be running.
In particular, if you installed a local Docker instance of UBKG, be sure that Docker Desktop is running.
Expand Down
11 changes: 6 additions & 5 deletions dd-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ servers:
- url: https://datadistillery.api.sennetconsortium.org/
description: Production server
security:
- api_key: []
- umls_key: []
paths:
/codes/{code_id}/codes:
get:
Expand Down Expand Up @@ -166,12 +166,12 @@ paths:
description: No Definitions associated with the Concept _query_concept_id_.
'5XX':
description: Unknown error
/concepts/{identifier}/nodeobjects:
/concepts/{concept_id}/nodeobjects:
get:
operationId: concepts_identifier_nodes_get
summary: Returns a set of "Concept Node objects" that "match" an identifier. [A Concept node in the UBKG is the origin of a subgraph that links the Concept node to a set of Code, Term, Definition, and Semantic Type nodes. A "Concept Node object" represents this subgraph as a set of Concept properties--i.e., all of the Concept's linked Codes, terms, definitions, and semantic types. A "match" is an exact match between an identifier and a text-based property in a Concept Node object. Because an identifier may match properties in more than one Concept Node object, the endpoint can return multiple Concept Node objects.]
parameters:
- name: identifier
- name: concept_id
in: path
required: true
description: The string to match against properties related to Concepts. Related properties include the preferred term for the Concept; the CUI for the Concept; the CodeID for a Code linked to the Concept; and terms for a Code linked to a Concept.
Expand Down Expand Up @@ -887,9 +887,10 @@ paths:
description: Unknown error
components:
securitySchemes:
api_key:
umls_key:
type: apiKey
name: X-API-KEY
description: API key for a UMLS licensee account, prefixed with "UMLS-Key "--e.g., "UMLS-Key <my-umls-key>"
name: Authorization
in: header
schemas:
CodesCodesObj: # Schema name
Expand Down
6 changes: 3 additions & 3 deletions tests/python_client_test.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# coding: utf-8

# Simple Python script that demonstrates how to use the API key stored in a file named api.key
# Simple Python script that demonstrates how to use the API key stored in a file named umls.key
# in the application directory to execute an endpoint.

import requests
import os

# Read the API key.
fpath = os.path.dirname(os.getcwd())
fpath = os.path.join(fpath, 'tests', 'api.key')
fpath = os.path.join(fpath, 'tests', 'umls.key')
f = open(fpath, 'r')
apikey = f.read()
f.close()

# Add the API key to authorization for the URL.
headers = {'X-API-KEY': f'{apikey}'}
headers = {'Authorization': f'UMLS-Key {apikey}'}

# Execute the endpoint.

Expand Down
Loading

0 comments on commit be9f7e5

Please sign in to comment.