Skip to content

gdbassett/Bassett_Deitmen_Diagnostic_MDSS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synopsis

These classes implement the Graph-Based Diagnostic Medical Decision Support System found here

This code implements three novel inventions:

  1. A module for the generation of statistically varying medical records with configurable accuracy, number of signs, and number of symptoms. This is implemented in the synthetic.py module.
  2. An algorithm for training a new machine learning model for analysis of competing hypotheses, (the Bassett-Deitmen Training Algorithm). This is implemented in the model.py module.
  3. An algorithm for querying the model, (the Bassett-Deitman Query Algorithm), is provided for querying trained models. it is also implemented in the model.py module.

In addition to the aforementioned models, a basic web-based user interface is provided in ui.py.

Code Example

from the command line, browse to ~/bassett_deitmen_dmdss/ and run ui.py:

cd ~/bassett_deitmen_dmdss/
python ./ui.py

This will generate training records, train the model on them, and provide a web interface on port 8080. A new record to diagnose can be generated by visiting http://localhost:8080/records/?record_count=1. The diagnostic UI is located at http://localhost:8080/. Enter the signs and symptoms, click the 'diagnose' button, and you should be provided an output similar to: Bassett Deitmen Diagnostic MDSS UI

Motivation

It is the hope of the authors that this model may support the many medical practitioners around the world and help those in need. This project provides a way for less experienced medical practitioners to benefit from the experience of the collective. Additionally it provides a means for experienced medical practitioners to augment their memory to identify outlier cases.

Installation

Install the project dependencies:

pip install numpy scipy.stats py2neo networkx flask flask.ext.restful scipy.optimize pprint imp

Download the project:

git clone https://github.com/gdbassett/Bassett_Deitmen_Diagnostic_MDSS.git

API Reference

Three APIs exist within the UI.

Record Generation API

The record generation API exists at localhost:8080/records/. It takes an argument of record_count with the number of records requested and returns them as a JSON dictionary of the form:

 'signs': {'sign_1404': 0.1},
 'symptoms': {'symptom_11': 0.5,
 'symptom_24': 0.3,
 'symptom_72': 1,
 'symptom_80': 0}},
{'diagnosis': 'diagnosis_4789',
 'signs': {'sign_1071': 0, 'sign_2259': 0.4},
 'symptoms': {'symptom_12': 1,
 'symptom_135': 0.5,
 'symptom_34': 0,
 'symptom_40': -0.22229441461509403,
 'symptom_5': 0.20000000000000001,
 'symptom_96': 0}}

Diagnostic API

The diagnostic API resides at localhost:8080/diagnose. It takes a git request with k:v arguments where the key is a sign or symptom and the value is the value of the sign or symptom. once called, it returns a JSON list of diagnoses in priority order with relatives scores:

{'diagnosis_2287': 0.03583184375312342,
'diagnosis_2497': 0.03916503852085583,
'diagnosis_2635': 0.86711857628206257,
...}

Truth API

The truth API provides a means for identifying what the 'true' signs or symptoms associated with a diagnosis were in the truth data underlying the training data. It may be found at localhost:8080/truth with argument truth with a value of the diagnosis to identify the truth signs and symptoms for. It returns a JSON dictionary of the form:

{'diagnosis_6827': {'signs': {'sign_1534': {'factors': {'inverse': True},
 'function': 'bool',
'function_type': 'categorical'},
 'sign_1939': {'factors': {'inverse': True},
 'function': 'bool',
'function_type': 'categorical'},
 'sign_2345': {'factors': {'inverse': False},
 'function': 'bool',
'function_type': 'categorical'},
 'sign_59': {'factors': {'levels': [0.1,
 0.2,
0.3,
0.4,
...},
 'symptoms': {'symptom_112': {'factors': {'inverse': True},
 'function': 'bool',
'function_type': 'categorical'},
 'symptom_134': {'factors': {'inverse': True},
 'function': 'bool',
 'function_type': 'categorical'},
 'symptom_25': {'factors': {'levels': [1,
 0.5,
 -1]}
 ...}}}

Tests

Example tests may be found in the test.py file in the root of the project

Contributors

Gabriel Bassett Kindall Deitmen

Special thanks to the medical professionals, academics, and especially Jasmine Gordon who helped us in realizing this project.

License

Copyright 2015 Gabriel Bassett

Licensed under the Apache License, Version 2.0 (the "License") for non-commercial use only; you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Code to implement a graph-based medical decision support system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published