Download the PHP package legit-health/medical-device-sdk without Composer
On this page you can find all versions of the php package legit-health/medical-device-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download legit-health/medical-device-sdk
More information about legit-health/medical-device-sdk
Files in legit-health/medical-device-sdk
Package medical-device-sdk
Short Description SDK for integrate with the Medical Device API
License MIT
Informations about the package medical-device-sdk
PHP SDK for Integrating with Legit.Health's Medical Device API
Official SDK for integrating with Legit.Health's Medical Device API 🩺🤖
Before You Start
Ensure that you have a registered username and password for our API before making any requests.
Instructions
To start sending requests to Legit.Health's Dermatology API, create an instance of the LegitHealth\MedicalDevice\MedicalDeviceClient
class. There are several ways to instantiate this object, but the simplest is by using the createWithBaseUri
method. This static method accepts a single argument: the API's base URL, which varies depending on the environment you're working in. For development purposes, use https://medical-device-pre.legit.health
.
The MedicalDeviceClient
class provides three main methods:
-
login
: Requires your username and password, returning an access token that must be included in subsequent requests. -
diagnosisSupport
: Sends a diagnosis support request to the API. Use this method to analyze a set of images to determine the probability of detected pathologies, or to retrieve metrics such as malignancy or the need for referral. severityAssessment
: Sends a severity assessment request to evaluate the severity of a known condition. For example, you can use this method to assess the severity of a psoriasis lesion and calculate the correspondingAPASI
score
Login Request
Before invoking the diagnosis support or severity assessment methods, you need to obtain an access token. This is done by calling the login
method of the MedicalDeviceClient
class. This method expects a username and a password and returns an AccessToken
object. This object contains the access token and its expiration time in minutes.
Diagnosis Support Request
The diagnosisSupport
method of the MedicalDeviceClient
class accepts three arguments:
- An object of the
DiagnosisSupportArguments
class, containing the images to analyze. Important: The maximum allowed length for themedias
argument is 3. - A bearer token obtained by invoking the
login
method. - An object containing request options such as
timeout
.
Once you've created a DiagnosisSupportArguments
object, you can send the request as follows:
The response object, which is an instance of DiagnosisSupportResponse
, contains several properties with the information returned by the API about the analyzed images:
clinicalIndicators
: an object of theClinicalIndicators
class with the probabilities of different suspicions, such ashasCondition
ormalignancy
.performanceIndicators
: contains the sensitivity, specificity, and entropy values.conclusions
: an array ofConclusion
objects with the detected pathologies and their probabilities. The total probability is distributed among the detected pathologies.imagingStudySeries
: an array ofImagingStudySeriesInstance
objects with information related to each image, such as conclusions, performance indicators, and clinical indicators. It also contains amedia
object that includes the modality of the image and whether it passed our Dermatology Image Quality Assessment (DIQA).analysisDuration
: the time spent by the AI model analyzing the image.effectiveDateTime
: the date and time of the report.
Severity Assessment Requests
The severityAssessment
method of the MedicalDeviceClient
class accepts three arguments:
- An object of the
SeverityAssessmentArguments
class, containing the image whose severity is to be assessed along with the related questionnaires. - A bearer token obtained by invoking the
login
method. - An object containing request options such as
timeout
.
Example: Severity Assessment Request for Psoriasis
Here’s how to send a severity assessment request for a patient diagnosed with psoriasis.
First, create the objects representing the questionnaires used to track the evolution of psoriasis:
Then, create an object of the SeverityAssessmentArguments
class:
Unlike diagnosis support requests, severity assessment requests support the following additional arguments:
-
scoringSystems
: an array of strings with the names of the scoring systems to be calculated. It supports all codes returned by theQuestionnaire
classes within theLegitHealth\MedicalDevice\MedicalDeviceArguments\Params
namespace. questionnaires
: an object of theQuestionnaires
class with the answers required for practitioner or patient input. For psoriasis, thesurface
value is needed when creating anApasiLocalQuestionnaire
object.
Once the SeverityAssessmentArguments
object is created, send the request as follows:
The response object contains several properties with information returned by the API about the analyzed image:
media
: contains the image modality and its validity, including whether it passed the Dermatology Image Quality Assessment (DIQA).patientEvolution
: an array ofPatientEvolutionInstance
objects containing the score for each calculated scoring system along with its corresponding items.analysisDuration
: the time spent by the AI model analyzing the image.
The PatientEvolutionInstance
Class
The PatientEvolutionInstance
contains all the information about a scoring system, for example, APASI_LOCAL
.
You can access the value of a scoring system using the getPatientEvolutionInstance
method:
This object contains the following properties:
scoringSystemCode
score
: the calculated score for the scoring system.items
: an array ofEvolutionItem
objects representing each item used to calculate the scoring system.attachments
: an array of images that contain an overlay with detections made by the AI model.detections
: an array ofDetection
objects representing each box identifying a lesion detected in the image.
Once you have a PatientEvolutionInstance
object, you can access the value of each item using the getEvolutionItem(string $itemCode)
method. Each item contains its code and the calculated value. For example, the APASI_LOCAL
scoring system includes 4 items: desquamation, erythema, induration, and surface.
Full example: