Giter VIP home page Giter VIP logo

umls-api's Introduction

umls-api

Python client for the UMLS REST API https://documentation.uts.nlm.nih.gov/rest/home.html

Installation

pip install umls-api

Example Usage

Get CUI.

import umls_api

resp = umls_api.API(api_key='<UMLS_API_KEY_HERE>').get_cui(cui='C0007107')
print(res)
{
	'pageCount': 1,
	'pageNumber': 1,
	'pageSize': 25,
	'result': {
		'atomCount': 247,
		'atoms': 'https://uts-ws.nlm.nih.gov/rest/content/2020AB/CUI/C0007107/atoms',
		'attributeCount': 0,
		'classType': 'Concept',
		'cvMemberCount': 0,
		'dateAdded': '09-30-1990',
		'defaultPreferredAtom': 'https://uts-ws.nlm.nih.gov/rest/content/2020AB/CUI/C0007107/atoms/preferred',
		'definitions': 'https://uts-ws.nlm.nih.gov/rest/content/2020AB/CUI/C0007107/definitions',
		'majorRevisionDate': '06-25-2020',
		'name': 'Malignant neoplasm of larynx',
		'relationCount': 17,
		'relations': 'https://uts-ws.nlm.nih.gov/rest/content/2020AB/CUI/C0007107/relations',
		'semanticTypes': [{
			'name': 'Neoplastic Process',
			'uri': 'https://uts-ws.nlm.nih.gov/rest/semantic-network/2020AB/TUI/T191'
		}],
		'status': 'R',
		'suppressible': False,
		'ui': 'C0007107'
	}

Get TUI.

import umls_api

resp = umls_api.API(api_key='<UMLS_API_KEY_HERE>').get_tui(cui='T047')
print(resp)
{
	'pageCount': 1,
	'pageNumber': 1,
	'pageSize': 25,
	'result': {
		'abbreviation': 'dsyn',
		'childCount': 2,
		'classType': 'SemanticType',
		'definition': 'A condition which alters or interferes with a '
		'normal process, state, or activity of an organism. '
		'It is usually characterized by the abnormal '
		"functioning of one or more of the host's systems, "
		'parts, or organs. Included here is a complex of '
		'symptoms descriptive of a disorder.',
		'example': 'NONE',
		'name': 'Disease or Syndrome',
		'nonHuman': 'NONE',
		'semanticTypeGroup': {
			'abbreviation': 'DISO',
			'classType': 'SemanticGroup',
			'expandedForm': 'Disorders',
			'semanticTypeCount': 12
		},
		'treeNumber': 'B2.2.1.2.1',
		'ui': 'T047',
		'usageNote': 'Any specific disease or syndrome that is modified by '
		'such modifiers as "acute", "prolonged", etc. will '
		'also be assigned to this type. If an anatomic '
		'abnormality has a pathologic manifestation, then it '
		'will be given this type as well as a type from the '
		"'Anatomical Abnormality' hierarchy, e.g., "
		'"Diabetic Cataract" will be double-typed for this '
		'reason.'
	}
}

If you wish to add support for other API endpoints on UMLS, they are very simple to add.

Pull requests (with tests) are very welcome.

Running the tests

pip install -r requirements-dev.txt
pytest src/tests
flake8

umls-api's People

Contributors

richardarpanet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

umls-api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.