Coder Social home page Coder Social logo

jesseokeya / infermedica Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 2.0 978 KB

Node interface to the infermedica REST API

Home Page: https://www.npmjs.com/package/infermedica

License: MIT License

JavaScript 100.00%
infermedica-api conditions-infermedica symptoms triage infermedica infermedica-npm phrase-infermedica symptoms-infermedica npm

infermedica's Introduction

Infermedica (unofficial)

Node Interface To The Infermedica Rest Api. Npm Package

Description

This is a Node interface to the Infermedica Rest Api.

Installation

npm install infermedica --save

Usage examples

Estimate triage level based on provided patient information

const Infermedica = require('infermedica')
/** 
 * Provide credentials
 * This reference can help you explore the Infermedica API with your own data. 
 * Make sure that your application id and application key are correct and get started. 
 * Below they are passed in as environment variables
 */
const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

const context = {
    sex: "male",
    age: 70,
    evidence: [
        {
            "id": "s_1193",
            "choice_id": "present"
        },
        {
            "id": "s_488",
            "choice_id": "present"
        },
        {
            "id": "s_418",
            "choice_id": "present"
        }
    ]
}

infermedica.postTriage(context).then(res => {
    console.log(res)
})

Infermedica Methods

// Returns a list of all available conditions
infermedica.getConditions()

// Returns details of a single condition specified by id parameter 
infermedica.getCondition(conditionId)

// Suggests possible diagnoses and relevant observations
infermedica.postDiagnosis({ 
    sex, 
    age, 
    evidence, 
    extras, 
    target, 
    evaluated_at 
}) 

// Explains which evidence impact probability of selected condition
infermedica.postExplain({ 
    sex, 
    age, 
    evidence, 
    extras, 
    target, 
    evaluated_at 
})

// Returns information about data used by diagnostic engine
infermedica.getInfo() 

// Returns a list of all available lab tests
infermedica.getLabTests()

// Returns details of a single lab test specified by id parameter
infermedica.getLabTest(labTestId)

// Returns a single observation matching given phrase
infermedica.getLookUp({ phrase, sex })

// Returns list of mentions of observation found in given text
infermedica.postParse({ 
    text, 
    context, 
    concept_types, 
    correct_spelling, 
    include_tokens 
})

// Returns a list of all available risk factors
infermedica.getRiskFactors()

// Returns details of a single risk factor specified by id parameter
infermedica.getRiskFactor(riskFactorId) 

// Returns list of observations matching the given phrase
infermedica.getSearch({ 
    phrase, 
    sex, 
    maxResults, 
    type 
})

// Suggests possible symptoms based on provided patient information
infermedica.postSuggest({ 
    sex, 
    age, 
    evidence, 
    extras, 
    evaluated_at }, max_results)

// Returns a list of all available symptoms
infermedica.getSymptoms()

// Returns details of a single symptom specified by id parameter
infermedica.getSymptom(symptomId)

// Estimates triage level based on provided patient information
infermedica.postTriage({ 
    sex, 
    age, 
    evidence, 
    extras, 
    evaluated_at
})

Actions

getConditions

Returns a list of all available conditions.

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getConditions().then(conditions => {
    console.log(conditions)
})

getCondition

Returns details of a single condition specified by id parameter

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getCondition('c_522').then(condition => {
    console.log(condition)
})

postDiagnosis

Suggests possible diagnoses and relevant observations

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

const context = {
    sex: "male",
    age: 70,
    evidence: [
        {
            "id": "s_1193",
            "choice_id": "present"
        },
        {
            "id": "s_488",
            "choice_id": "present"
        },
        {
            "id": "s_418",
            "choice_id": "present"
        }
    ]
}

infermedica.postDiagnosis(context).then(diagnosis => {
    console.log(diagnosis)
})

postExplain

Explains which evidence impact probability of selected condition

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

const context = {
    sex: "male",
    age: 70,
    target: "c_49",
    evidence: [
        {
            "id": "s_1193",
            "choice_id": "present"
        },
        {
            "id": "s_488",
            "choice_id": "present"
        },
        {
            "id": "s_418",
            "choice_id": "present"
        }
    ]
}

infermedica.postExplain(context).then(explain => {
    console.log(explain)
})

getInfo

Returns information about data used by diagnostic engine

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getInfo().then(info => {
    console.log(info)
})

getLabTests

Returns a list of all available lab tests

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getLabTests().then(labTests => {
    console.log(labTests)
})

getLabTest

Returns details of a single lab test specified by id parameter

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getLabTest('lt_350').then(labTest => {
    console.log(labTest)
})

getLookUp

Returns a single observation matching given phrase

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY
})

const context = {
    sex: "female",
    phrase: "headache"
}

infermedica.getLookUp(context).then(lookUp => {
    console.log(lookUp)
})

postParse

Returns list of mentions of observation found in given text

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

const context = {
    "text": "I feel smoach pain but no couoghing today",
}

infermedica.postParse(context).then(parse => {
    console.log(parse)
})

getRiskFactors

Returns a list of all available risk factors

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getRiskFactors().then(riskFactors => {
    console.log(riskFactors)
})

getRiskFactor

Returns details of a single risk factor specified by id parameter

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getRiskFactor('p_28').then(riskFactor => {
    console.log(riskFactor)
})

getSearch

Returns list of observations matching the given phrase

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

const context = {
    sex: "male",
    phrase: "stomache pain",
    type: "symptom",
    maxResults: 8
}

infermedica.getSearch(context).then(search => {
    console.log(search)
})

postSuggest

Suggests possible symptoms based on provided patient information

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

const context = {
    sex: "male",
    age: 70,
    evidence: [
        {
            "id": "s_1193",
            "choice_id": "present"
        },
        {
            "id": "s_488",
            "choice_id": "present"
        },
        {
            "id": "s_418",
            "choice_id": "present"
        }
    ]
}

const maxResults = 8

infermedica.postSuggest(context, maxResults).then(suggest => {
    console.log(suggest)
})

getSymptoms

Returns a list of all available symptoms

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getSymptoms().then(symptoms => {
    console.log(symptoms)
})

getSymptom

Returns details of a single symptom specified by id parameter

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

infermedica.getSymptom('s_1190').then(symptom => {
    console.log(symptom)
})

postTriage

Estimates triage level based on provided patient information

const Infermedica = require('infermedica')

const infermedica = new Infermedica({ 
    appId: process.env.APP_ID, 
    appKey: process.env.APP_KEY 
})

 const context = {
    sex: "male",
    age: 70,
    evidence: [
        {
            "id": "s_1193",
            "choice_id": "present"
        },
        {
            "id": "s_488",
            "choice_id": "present"
        },
        {
            "id": "s_418",
            "choice_id": "present"
        }
    ]
}

infermedica.postTriage(context).then(triage => {
    console.log(triage)
})

infermedica's People

Contributors

dependabot[bot] avatar jesseokeya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

infermedica's Issues

need to change Infermedica api version

You use Infermedica v2 api. could you please update url and set api v3?
or give us access to change api version when we initialize Infermedica.

ex:
const infermedica = new Infermedica({ appId: process.env.APP_ID, appKey: process.env.APP_KEY, version: 'v3' })

Regarding infermedica-api project

Hi,
Your project seemed interesting to me, but I am bit confused on how to run this code and how the output looks like? Is it a full-stack project? if so, where can I find front-end code? @jesseokeya

Thanks, in advance

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.