Links

BitBucket

Figma

Support

[email protected]


Backend End Documentation

Endpoint URL

Description

This endpoint allows you to diarize a note based on the provided audio file.

Request Method

Request Headers

Query Parameters

Request Body

Example cURL Request

curl -X 'POST' \\
'<https://api.neurocare.ai/api/v1/note/diarize/web/[?user_id=cwfqwfq&email=wqfqwf](https://prod-aizamd-routing.neurocare.ai/api/v1/note/diarize/web/?user_id=cwfqwfq&email=wqfqwf)>' \\
-H 'accept: application/json' \\
-H 'Content-Type: multipart/form-data' \\
-H 'x-api-key: c0b38d8c-7004-4d16-95b9-98934d3a0775' \\
-F '[email protected];type=audio/webm'

The x-api-key provided in the example code above is a generic placeholder. Please substitute it with the specific x-api-key provided to you via email.

Responses

200 - Successful Response

{
"note_id": "string",
"user_id": "string",
"note_title": "string",
"date_modified": "2024-04-17T15:34:42.190Z",
"is_starred": false,
"is_deleted": false,
"raw_note": {},
"ai_improved_note": "This is the field of interest. The SOAP note will go here. You will need to parse desired sections (HPI/Subjective/Objective/Assesment and Plan etc) out using regex or \\
										 simple string splitting mechanism",
"icd10_codes": [
{
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
],
"previous_soap_notes": []
}

Essential Fields in Successful Response for Integration

404 - Not Found

422 - Validation Error

{
"detail": [
{
"loc": ["string", 0],
"msg": "string",
"type": "string"
}
]
}

403 - Not Authenticated


Front End Documentation

Web Technologies [ Angular | React ]

BitBucket Link:

Bitbucket

The detailed description of the web-based on angular and react snippets are as follows:

Angular Snippet

The AppComponent in this Angular application serves to control and manage audio recording operations, as well as interact with an external API to handle recorded data. It features reactive UI changes to provide feedback to the user based on the recording state. Below is the detailed documentation of its setup and functionalities.

Component Overview

Properties

Constructor

Methods

toggleRecording()

This method toggles the recording state. It handles starting and stopping of the audio recording using the MediaRecorder API. It also manages UI updates based on the recording state.

Error Handling

Captures and logs errors, particularly when accessing the microphone is denied or fails.

HTML Template

The template contains a button that toggles the recording state visually using dynamic Angular templates (ngIf, ng-template) to display different icons based on the recording state.

Below the button, a paragraph dynamically displays the current status ('Active', 'Recording', 'Paused') based on the component's state.

Usage

Place this component in any part of your Angular application where you need audio recording functionality, ensuring the necessary assets (images) and endpoints are correctly set up and accessible.

Style

Refer to app.component.css for specific styling details. Ensure loader animations and images are styled to match the application's design requirements.

This component serves as a self-contained unit for managing audio interactions within your Angular application, providing robust functionality paired with a reactive and user-friendly interface.


JS integration snippet

BitBucket Link:

Bitbucket

Overview

This documentation provides an overview of integrating an audio recording functionality using HTML, CSS, and JavaScript. The application allows users to record audio through their web browser's microphone and then send the recorded audio to a server for processing.

Files and Structure

Functionality Details


Twilio Integration

Prerequisites

Installing Twilio Python Library

pip3 install twilio

Test your installation

Configure Webhook in Twilio

screenshot_22052024_141734.png

Stream real-time audio to your Application

import base64
import json
import logging
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
import uvicorn

app = FastAPI()
HTTP_SERVER_PORT = 5000

logging.basicConfig(level=logging.DEBUG)

@app.websocket("/media")
async def websocket_endpoint(websocket: WebSocket):
    await websocket.accept()
    app.logger.info("Connection accepted")
    has_seen_media = False
    message_count = 0

    try:
        while True:
            message = await websocket.receive_text()
            if message is None:
                app.logger.info("No message received...")
                continue

            data = json.loads(message)

            if data['event'] == "connected":
                app.logger.info(f"Connected Message received: {message}")
            elif data['event'] == "start":
                app.logger.info(f"Start Message received: {message}")
            elif data['event'] == "media":
                if not has_seen_media:
                    app.logger.info(f"Media message: {message}")
                    payload = data['media']['payload']
                    app.logger.info(f"Payload is: {payload}")
                    chunk = base64.b64decode(payload)
                    app.logger.info(f"That's {len(chunk)} bytes")
                    app.logger.info("Additional media messages from WebSocket are being suppressed....")
                    has_seen_media = True
            elif data['event'] == "closed":
                app.logger.info(f"Closed Message received: {message}")
                break

            message_count += 1

    except WebSocketDisconnect:
        app.logger.info("Connection closed by the client.")
    except Exception as e:
        app.logger.error(f"Error: {e}")

    app.logger.info(f"Connection closed. Received a total of {message_count} messages")
    await websocket.close()

if __name__ == '__main__':
    uvicorn.run(app, host="0.0.0.0", port=HTTP_SERVER_PORT)

Start Streaming audio

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Start>
        <Stream url="wss://yourdomain/media" />
     </Start>
     <Dial>+15550123456</Dial>
</Response>

You’ll need to update the above sample in two key ways:

Try it out