All Projects → IBM → Nlc Icd10 Classifier

IBM / Nlc Icd10 Classifier

Licence: apache-2.0
A simple web app that shows how Watson's Natural Language Classifier (NLC) can classify ICD-10 code. The app is written in Python using the Flask framework and leverages the Watson Developer Cloud Python SDK

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Nlc Icd10 Classifier

sms-analysis-with-wks
Analyzing SMS offers for domain specific entities using Watson Knowledge Studio and Watson's Natural Language Understanding
Stars: ✭ 17 (-74.24%)
Mutual labels:  watson, ibmcode
watson-discovery-food-reviews
Combine Watson Knowledge Studio and Watson Discovery to discover customer sentiment from product reviews
Stars: ✭ 36 (-45.45%)
Mutual labels:  watson, ibmcode
pixiedust-facebook-analysis
A Jupyter notebook that uses the Watson Visual Recognition and Natural Language Understanding services to enrich Facebook Analytics and uses Cognos Dashboard Embedded to explore and visualize the results in Watson Studio
Stars: ✭ 42 (-36.36%)
Mutual labels:  watson, ibmcode
watson-document-classifier
Augment IBM Watson Natural Language Understanding APIs with a configurable mechanism for text classification, uses Watson Studio.
Stars: ✭ 41 (-37.88%)
Mutual labels:  watson, ibmcode
watson-vehicle-damage-analyzer
A server and mobile app to send pictures of vehicle damage to IBM Watson Visual Recognition for classification
Stars: ✭ 62 (-6.06%)
Mutual labels:  watson, ibmcode
Allthefeels
Alexa prompts the user how his/her day is going, then depending on the sentiment expressed by the user, it produces a list of regularly-updated Spotify playlists tailored to his/her mood
Stars: ✭ 19 (-71.21%)
Mutual labels:  watson
Laravel Personality Insights
👩 👱 Using IBM Watson Personality Insights Service with Laravel 5
Stars: ✭ 36 (-45.45%)
Mutual labels:  watson
Awesome Gradient Boosting Papers
A curated list of gradient boosting research papers with implementations.
Stars: ✭ 704 (+966.67%)
Mutual labels:  classifier
Build Blockchain Insurance App
Sample insurance application using Hyperledger Fabric
Stars: ✭ 609 (+822.73%)
Mutual labels:  ibmcode
Vehicle Detection And Tracking
Udacity Self-Driving Car Engineer Nanodegree. Project: Vehicle Detection and Tracking
Stars: ✭ 60 (-9.09%)
Mutual labels:  classifier
Tensorflow Kubernetes Art Classification
Train a TensorFlow model on Kubernetes to recognize art culture based on the collection from the Metropolitan Museum of Art
Stars: ✭ 55 (-16.67%)
Mutual labels:  ibmcode
Health Blockchain
A blockchain for fitness data demo
Stars: ✭ 31 (-53.03%)
Mutual labels:  watson
Awesome Fraud Detection Papers
A curated list of data mining papers about fraud detection.
Stars: ✭ 843 (+1177.27%)
Mutual labels:  classifier
Ml Classify Text Js
Machine learning based text classification in JavaScript using n-grams and cosine similarity
Stars: ✭ 38 (-42.42%)
Mutual labels:  classifier
Elasticsearch Spark Recommender
Use Jupyter Notebooks to demonstrate how to build a Recommender with Apache Spark & Elasticsearch
Stars: ✭ 707 (+971.21%)
Mutual labels:  ibmcode
Fasttext.py
A Python interface for Facebook fastText
Stars: ✭ 1,091 (+1553.03%)
Mutual labels:  classifier
Ffdl
Fabric for Deep Learning (FfDL, pronounced fiddle) is a Deep Learning Platform offering TensorFlow, Caffe, PyTorch etc. as a Service on Kubernetes
Stars: ✭ 640 (+869.7%)
Mutual labels:  watson
Machine Learning
Machine learning for Project Cognoma
Stars: ✭ 30 (-54.55%)
Mutual labels:  classifier
Fabricnodesdk Starter
WARNING: This repository is no longer maintained ⚠️ > This repository will not be updated. The repository will be kept available in read-only mode.
Stars: ✭ 51 (-22.73%)
Mutual labels:  ibmcode
Real Time Payments
Code for a Developer Journey that uses the Financial APIs on Bluemix. This application uses this service to send and request payments.
Stars: ✭ 28 (-57.58%)
Mutual labels:  ibmcode

Build Status

DISCLAIMER: This application is used for demonstrative and illustrative purposes only and does not constitute an offering that has gone through regulatory review. It is not intended to serve as a medical application. There is no representation as to the accuracy of the output of this application and it is presented without warranty.

Classify medical diagnosis with ICD-10 code

This application was built to demonstrate IBM's Watson Natural Language Classifier (NLC). The data set we will be using, ICD-10-GT-AA.csv, contains a subset of ICD-10 entries. ICD-10 is the 10th revision of the International Statistical Classification of Diseases and Related Health Problems. In short, it is a medical classification list by the World Health Organization (WHO) that contains codes for: diseases, signs and symptoms, abnormal findings, complaints, social circumstances, and external causes of injury or diseases. Hospitals and insurance companies alike could save time and money by leveraging Watson to properly tag the most accurate ICD-10 codes.

This application is a Python web application based on the Flask microframework, and based on earlier work done by Ryan Anderson. It uses the Watson Python SDK to create the classifier, list classifiers, and classify the input text. We also make use of the freely available ICD-10 API which, given an ICD-10 code, returns a name and description.

When the reader has completed this pattern, they will understand how to:

  • Create a Natural Language Classifier (NLC) service and use it in a Python application.
  • Train a NLC model using csv data.
  • Deploy a web app with Flask to allow the NLC model to be queried.
  • Quickly get a classification of a disease or health issue using the Natural Language Classifier trained model.

Flow

architecture

  1. CSV files are sent to the Natural Language Classifier service to train the model.
  2. The user interacts with the web app UI running either locally or in the cloud.
  3. The application sends the user's input to the Natural Language Classifier model to be classified.
  4. The information containing the classification is returned to the web app.

Included Components

  • Watson Studio: Analyze data using RStudio, Jupyter, and Python in a configured, collaborative environment that includes IBM value-adds, such as managed Spark.
  • Watson Natural Language Classifier: An IBM Cloud service to interpret and classify natural language with confidence.
  • Python: Python is a programming language that lets you work more quickly and integrate your systems more effectively.

Watch the Video

video

Steps

  1. Clone the repo
  2. Create IBM Cloud services
  3. Create a Watson Studio project
  4. Train the NLC model
  5. Run the application

1. Clone the repo

Clone the nlc-icd10-classifier repo locally. In a terminal, run:

git clone https://github.com/IBM/nlc-icd10-classifier
cd nlc-icd10-classifier

2. Create IBM Cloud services

Create the following service:

3. Create a Watson Studio project

  • Log into IBM's Watson Studio. Once in, you'll land on the dashboard.

  • Create a new project by clicking + New project and choosing Data Science:

    studio project

  • Enter a name for the project name and click Create.

  • NOTE: By creating a project in Watson Studio a free tier Object Storage service and Watson Machine Learning service will be created in your IBM Cloud account. Select the Free storage type to avoid fees.

    studio-new-project

  • Upon a successful project creation, you are taken to a dashboard view of your project. Take note of the Assets and Settings tabs, we'll be using them to associate our project with any external assets (datasets and notebooks) and any IBM cloud services.

    studio-project-dashboard

4. Train the NLC model

The data used in this example is part of the ICD-10 data set and a cleaned version we'll use is available in the repo under data/ICD-10-GT-AA.csv. We'll now train an NLC model using this data.

  • From the new project Overview panel, click + Add to project on the top right and choose the Natural Language Classifier asset type.

    add-nlc-asset

  • A new instance of the NLC tool will launch.

    new-nlc-model

  • Add the data to your project by clicking the Browse button in the right-hand Upload to project section and browsing to the cloned repo. Choose the data/ICD-10-GT-AA.csv file.

  • Select the ICD-10-GT-AA.csv file you just uploaded and choose Add to model.

    add-to-model

  • Click the Train model button to begin training. The model will take around an hour to train.

  • To check the status of the model, and access it after it trains, go to your project in the Assets tab of the Models section. The model will show up when it is ready. Double click to see the Overview tab.

    nlc-model-overview

  • The first line of the Overview tab contains the Model ID, remember this value as we'll need it in the next step.

5. Run the application

Follow the steps below for deploying the application:

Run on IBM Cloud

  • Press the Deploy to IBM Cloud button below.

Deploy to IBM Cloud

  • From the IBM Cloud deployment page click the Deploy button.

  • From the Toolchains menu, click the Delivery Pipeline to watch while the app is deployed. Once deployed, the app can be viewed by clicking View app.

  • The app and service can be viewed in the IBM Cloud dashboard. The app will be named nlc-icd10-classifier, with a unique suffix.

  • We now need to add a few environment variables to the application's runtime so the right classifier service and model are used. Click on the application from the dashboard to view its settings.

  • Once viewing the application, click the Runtime option on the menu and navigate to the Environment Variables section.

  • Update the CLASSIFIER_ID, and NATURAL_LANGUAGE_CLASSIFIER_APIKEY variables with your Model ID from Step 4 and NLC API key from Step 2. Click Save.

    env vars

  • After saving the environment variables, the app will restart. After the app restarts you can access it by clicking the Visit App URL button.

Run locally

The general recommendation for Python development is to use a virtual environment (venv). To install and initialize a virtual environment, use the venv module on Python 3 (you install the virtualenv library for Python 2.7):

  • Create the virtual environment using Python. Use one of the two commands depending on your Python version.

    Note: it may be named python3 on your system.

    python -m venv mytestenv       # Python 3.X
    virtualenv mytestenv           # Python 2.X
    
  • Now source the virtual environment. Use one of the two commands depending on your OS.

    source mytestenv/bin/activate  # Mac or Linux
    ./mytestenv/Scripts/activate   # Windows PowerShell
    

    TIP 💡 To terminate the virtual environment use the deactivate command.

  • Rename the env.example file to .env

    mv env.example .env
    
  • Update the .env file with the NLC credentials for either username/password or API key

    # Replace the credentials here with your own using either USERNAME/PASSWORD or IAM_APIKEY
    # Comment out the unset environment variables
    # Rename this file to .env before running app.py.
    
    CLASSIFIER_ID=<add_nlc_classifier_id>
    NATURAL_LANGUAGE_CLASSIFIER_APIKEY=<add_nlc_apikey>
    
  • Install the app dependencies by running:

    pip install -r requirements.txt
    
  • Start the app by running

    python app.py
    
  • Open a browser and point to localhost:5000.

Sample Output

The user inputs information into the Text to classify: text box and the Watson NLC classifier will return ICD10 classifications with confidence scores.

Classification of Gastrointestinal hemorrhage: Sample output

Links

Learn more

  • Artificial Intelligence Code Patterns: Enjoyed this Code Pattern? Check out our other AI Code Patterns.
  • AI and Data Code Pattern Playlist: Bookmark our playlist with all of our Code Pattern videos

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].