Generating a Report
Implementing the Pop-up: Code and Data Handling
Once you have the access token, you need to launch the pop-up window within your application using the following logic:
const response = await login(); // The login() function simulates obtaining the token.
const data = {
view: "analysis",
token: response.access_token, // Get the token from the login response.
doctorId: "", // Enter the ID of the doctor generating the report.
appointmentId: "", // Enter the ID of the medical appointment for which the report is being generated.
};
// Create a URLSearchParams object to send the data within the URL.
const urlParams = new URLSearchParams(data);
// Recommended dimensions for the Pop-up.
const width = 800;
const height = 600;
const left = (window.screen.width - width) / 2;
const top = (window.screen.height - height) / 2.5;
// Define the Speaknosis Pop-up URL. Replace with the appropriate URL for your environment.
const urlPopUp = "YOUR_SPEAKNOSIS_POPUP_URL"; //e.g., https://portal.speaknosis.com/#/pop-up/
// Open the modal using window.open
const popup = window.open(
`${urlPopUp}?${urlParams}`, // Add the Speaknosis Pop-up URL plus the object created with the appointment data.
"PopUp",
`width=${width},height=${height},top=${top},left=${left}` // Provide Pop-up dimensions.
);
// Validation to check if the Pop-up opened correctly.
if (!popup) {
console.error("Failed to open the pop-up");
}
Method for Receiving the Report
Custom Endpoint
To receive the report directly in your system, you must set up a custom endpoint that uses an API KEY. Share the URL of this endpoint with the Speaknosis support team, along with the desired JSON format for the response. We will configure the Pop-up to send the report information directly to the URL you provide. This allows you to efficiently integrate the reporting flow with your system. Contact Speaknosis support for details on setting up the custom endpoint and API KEY.
Using and Operating the Pop-up
If the Pop-up received the appointment data (token
, doctorId
, and appointmentId
) correctly, the Pop-up component should be displayed.
You can use your phone as an external microphone by scanning the QR code displayed in the pop-up:
Reference image:
Once the Pop-up is open, you can start an audio recording using your computer's microphone or your phone as an external microphone. When the audio recording begins, two new buttons will be enabled: the pause/resume recording button ( / ) and the stop recording button ().
Reference image:
Once the audio recording is finished (by pressing the stop button), a new section will be displayed where you must select the template to use to generate the medical report.
Reference image:
Select the desired template from the dropdown menu and then click the "Generate Report" button.
Reference image:
Once you start generating the report (by clicking the button), you will see an animation indicating that the report is being generated. The next image shows an example:
Reference image:
After that, you will be able to view, edit, and approve the medical report. If you start a new recording after stopping a previous one, the previous recording will be permanently deleted.
If the report is approved, the process of obtaining codes/catalogs will start, based on what has been configured in the administration panel, in addition to a report in JSON format with the response structure you need for use in your application.
Example Response (Codes/Catalogs + JSON report):
{
"jsonReport": {
"surgery": "",
"symptoms": "",
"allergies": "",
"diagnosis": "",
"referrals": "",
"familyHistory": "",
"medicalControl": "",
"requestedTests": "",
"personalHistory": "",
"medicalPrescription": "",
"physicalExamination": "",
"prescribedTreatment": "",
"reasonForConsultation": ""
},
"catalogs": {
"ICD_10": [
[
{
"code": "G43,G00-G99,G40-G47",
"description": "Migraine"
},
{
"code": "G433,G00-G99,G40-G47,G43",
"description": "Complicated migraine"
},
{
"code": "G438,G00-G99,G40-G47,G43",
"description": "Other migraines"
}
]
],
"medicaments": [
{
"code": "UC16TC",
"subCode": "UC16TC-M",
"description": "PARACETAMOL 500mg"
},
{
"code": "A02BC02",
"subCode": "A02BC02-P",
"description": "ZOLTUM 20 mg x 14 TABLETS, PANTOPRAZOL"
}
]
}
}
jsonReport
: Object containing the report in JSON format with the requested structure.catalogs
: Object containing all the different codes/catalogs detected from the medical consultation audio.
Once the Pop-up sends the jsonReport
and catalogs
data back to your application, it will close automatically, and you can use this data in your application.