Giter Club home page Giter Club logo

geniusrise-healthcare's Introduction

banner

Geniusrise Healthcare APIs

  1. NER using vector knowledge graph search
  2. Semantic similarity to find a consistent set of related conditions, diseases, etc
  3. Graph-based measures to find a consistent set of related conditions, diseases, etc
  4. Various combinations of the above

Usage

HF_HOME=/workspace genius InPatientAPI rise\
    batch \
        --input_s3_bucket geniusrise-test-healthcare \
        --input_s3_folder model \
    batch \
        --output_s3_bucket geniusrise-test-healthcare \
        --output_s3_folder model \
    none \
    listen \
        --args \
            endpoint="*" \
            port=2180 \
            llm_model="/workspace/Llama-2-70B-chat-GPTQ" \
            ner_model="emilyalsentzer/Bio_ClinicalBERT" \
            networkx_graph="./saved/snomed.graph" \
            faiss_index="./saved/faiss.index.Bio_ClinicalBERT" \
            concept_id_to_concept="./saved/concept_id_to_concept.pickle" \
            description_id_to_concept="./saved/description_id_to_concept.pickle" \
            cors_domain="*"

APIs

NER symptoms and diseases

curl -s -X POST \
    -H "Content-Type: application/json" \
    -d '{"user_input": "i feel a bit light headed and have some difficulty breathing and some pain in chest"}' \
    https://yauiuxmk8rlxkj-2180.proxy.runpod.net/api/v1/ner | jq
{
  "query": "i feel a bit light headed and have some difficulty breathing and some pain in chest",
  "symptoms_diseases": ["light headed", "difficulty breathing", "pain in chest"]
}

Semantic search symptoms and diseases in SNOMED-CT

curl -s -X POST \
    -H "Content-Type: application/json" \
    -d '{
      "user_input": "i feel a bit light headed and have some difficulty breathing and some pain in chest",
      "symptoms_diseases": [
      "shortness_of_breath",
      "chest_pain",
      "lightheadedness"
      ],
      "semantic_similarity_cutoff": 0.9
    }' \
    https://yauiuxmk8rlxkj-2180.proxy.runpod.net/api/v1/semantic_search | jq
{
  "query": "i feel a bit light headed and have some difficulty breathing and some pain in chest",
  "symptoms_diseases": [
    "light headed",
    "difficulty breathing",
    "pain in chest"
  ],
  "snomed_concept_ids": [
    [371268001, 22601002, 56242006],
    [230145002, 161945003],
    [29857009, 139228007]
  ],
  "snomed_concepts": [
    ["light", "light (weight)", "light, electromagnetic radiation"],
    ["difficulty breathing", "difficulty breathing"],
    ["chest pain", "chest pain"]
  ]
}

Generate follow up questions

curl -s -X POST \
    -H "Content-Type: application/json" \
    -d '{
      "symptoms_diseases": [
        "light headed",
        "difficulty breathing",
        "pain in chest"
      ],
      "snomed_concept_ids": [
        [
          371268001,
          22601002,
          56242006
        ],
        [
          230145002,
          161945003
        ],
        [
          29857009,
          139228007
        ]
      ]
    }' \
    https://yauiuxmk8rlxkj-2180.proxy.runpod.net/api/v1/follow_up | jq
[
  {
    "snomed_concept_ids": [
      371268001,
      22601002,
      56242006
    ],
    "snomed_concepts": [
      "light",
      "light (weight)",
      "light, electromagnetic radiation"
    ],
    "questions": [
      "Do you feel lightheaded?",
      "Do you feel dizzy?",
      "Do you feel nauseous?"
    ]
  },
  {
    "snomed_concept_ids": [
      230145002,
      161945003
    ],
    "snomed_concepts": [
      "difficulty breathing",
      "difficulty breathing"
    ],
    "questions": [
      "How long have you had difficulty breathing?",
      "Is the pain in your chest constant, or does it come and go?"
    ]
  },
  {
    "snomed_concept_ids": [
      29857009,
      139228007
    ],
    "snomed_concepts": [
      "chest pain",
      "chest pain"
    ],
    "questions": [
      "When did you first notice the symptoms?",
      "Are you allergic to any medication?"
    ]
  }
]

Generate final summary report

curl -s -X POST \
     -H "Content-Type: application/json" \
     -d '{
          "snomed_concept_ids": [
            [
              139200001,
              161945003,
              230145002
            ],
            [
              139228007,
              29857009
            ]
          ],
          "symptoms_diseases": [
            "light headed",
            "difficulty breathing",
            "chest pain"
          ],
          "qa": {
            "Do you feel lightheaded?": "yes",
            "Do you feel dizzy?": "a little bit",
            "Do you feel nauseous?": "no",
            "How long have you had difficulty breathing?": "for the past 2 days",
            "Is the pain in your chest constant, or does it come and go?": "it comes and goes",
            "When did you first notice the symptoms?": "yesterday",
            "Are you allergic to any medication?": "not that i know of"
          }
        }' \
    https://yauiuxmk8rlxkj-2180.proxy.runpod.net/api/v1/summary | jq
{
  "conditions": [
    "difficulty breathing",
    "difficulty breathing",
    "difficulty breathing",
    "chest pain",
    "chest pain"
  ],
  "qa": {
    "Do you feel lightheaded?": "yes",
    "Do you feel dizzy?": "a little bit",
    "Do you feel nauseous?": "no",
    "How long have you had difficulty breathing?": "for the past 2 days",
    "Is the pain in your chest constant, or does it come and go?": "it comes and goes",
    "When did you first notice the symptoms?": "yesterday",
    "Are you allergic to any medication?": "not that i know of"
  },
  "summary": "# In-Patient Report

  ## Summary

  ### Patient's Observations

  The patient presented with the following complaints:

  ['light headed', 'difficulty breathing', 'chest pain']

  of which these are the conditions identified from SNOMED:

  - difficulty breathing
  - difficulty breathing
  - difficulty breathing
  - chest pain
  - chest pain

  ### Questions and Answers

  Subsequently, on further questioning, the patient had these to add on:

  - **Question**: Do you feel lightheaded?
    - **Answer**: yes

  - **Question**: Do you feel dizzy?
    - **Answer**: a little bit

  - **Question**: Do you feel nauseous?
    - **Answer**: no

  - **Question**: How long have you had difficulty breathing?
    - **Answer**: for the past 2 days

  - **Question**: Is the pain in your chest constant, or does it come and go?
    - **Answer**: it comes and goes

  - **Question**: When did you first notice the symptoms?
    - **Answer**: yesterday

  - **Question**: Are you allergic to any medication?
    - **Answer**: not that i know of

  ## Recommended tests

  ### Tests for diagnosis

  - blood test
  - blood test
  - blood test
  - X-ray
  - X-ray
  - X-ray

  ### Tests for exclusion

  - blood test
  - blood test
  - blood test
  - X-ray
  - X-ray
  - X-ray

  ## Diseases to check for and narrow down the cause

  - heart attack
  - heart attack
  - heart attack
  - lung cancer
  - lung cancer
  - lung cancer",
  "speciality": "### Department

  The patient should visit the **Outpatient** department."
}

Generate snomed diagram

http POST https://yauiuxmk8rlxkj-2180.proxy.runpod.net/api/v1/graph snomed_concepts:='
[
  [
    139200001,
    161945003,
    230145002
  ],
  [
    139228007,
    29857009
  ]
]
' --download
Content-Type: multipart/mixed; boundary="===============0359621490805120141=="
MIME-Version: 1.0

--===============0359621490805120141==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

Graph:
dyspnea --[is a]--> difficulty breathing
winded --[is a]--> difficulty breathing
labored breathing --[is a]--> difficulty breathing
respiratory distress --[is a]--> difficulty breathing
cannot blow --[is a]--> difficulty breathing
radiating chest pain --[is a]--> chest pain
microvascular angina --[is a]--> chest pain
pain of breast --[is a]--> chest pain
parasternal pain --[is a]--> chest pain
right sided chest pain --[is a]--> chest pain
assessment of chest pain --[has focus]--> chest pain
left sided chest pain --[is a]--> chest pain
thoracic back pain --[is a]--> chest pain
burning chest pain --[is a]--> chest pain
ischemic chest pain --[is a]--> chest pain
chest pain not present --[associated finding]--> chest pain
chest pain due to pericarditis --[is a]--> chest pain
crushing chest pain --[is a]--> chest pain
chest pain at rest --[is a]--> chest pain
localized chest pain --[is a]--> chest pain
retrosternal pain --[is a]--> chest pain
history of chest pain --[associated finding]--> chest pain
dull chest pain --[is a]--> chest pain
chest pain on breathing --[is a]--> chest pain
chronic chest pain --[is a]--> chest pain
pleuritic pain --[is a]--> chest pain
atypical chest pain --[is a]--> chest pain
musculoskeletal chest pain --[is a]--> chest pain
intercostal neuralgia --[is a]--> chest pain
upper chest pain --[is a]--> chest pain
angina --[is a]--> chest pain
noncardiac chest pain --[is a]--> chest pain
chest wall pain --[is a]--> chest pain
cardiac chest pain --[is a]--> chest pain
pleuropericardial chest pain --[is a]--> chest pain
precordial pain --[is a]--> chest pain
chest pain on exertion --[is a]--> chest pain
squeezing chest pain --[is a]--> chest pain
acute chest pain --[is a]--> chest pain
esophageal chest pain --[is a]--> chest pain

--===============0359621490805120141==
Content-Type: application/octet-stream; Name="image.png"
MIME-Version: 1.0
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAC/QAAAv0CAYAAACNCdhAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90
bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAC4j

--===============0359621490805120141==--

geniusrise-healthcare's People

Contributors

ixaxaar avatar

Stargazers

 avatar

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.