resume-client-socket.io
Version:
Resume Client API for Socket.IO and Node.JS - Medical Speech to Summarized Text
95 lines (86 loc) • 3.99 kB
JavaScript
/** @module ResumeCommonFormat */
/**
* @file Resume-REST-API-Connect.js - Node.JS module for HTTPS RESTful Resume API Client
* @author Tanapat Kahabodeekanokkul
* @copyright Tanapat Kahabodeekanokkul 2021
* @license Tanapat-Kahabodeekanokkul
*/
/**
* Response data in ResumeSessionResponse
* @typedef ResumeNewSessionData
* @property {string} session_id Session ID of Resume Transcription API
* @property {string|int} section_id Section ID given by user, response for feedback checking
*/
/**
* Object contains keys - part of document following Terminology of "C-CDA 1.1.0 on FHIR resource profile" (see README.md), and values - array of sentences or pharse (join into one string). `{"problem_section":["This is sentence one.","more pharse here..."]}`
* @summary Object contains keys - part of document (as C-CDA on FHIR), and values - array of string.
* @typedef GroupText
* @type {Object.<string,string[]>}
*/
/**
* Transcript response of sent sound from Resume API
* @typedef Transcript
* @type {object}
* @property {Array.<string[]>} [RawTxt] - array of sentence. Each sentence is array of word. `[["This","is","first","sentence","."],["...","next","and","more"]]`
* @property {int[]} [RawSpk] - array of speaker index correlated with sentence in RawTxt, starting from zero.
* @property {GroupText} [MlGroupTxt] - object of formatted and groupped text by Resume API Algorithm
* @property {GroupText} [TagRawTxt] - object of raw sentence groupped by client tag (`ResumeOne.tag`).
* @property {GroupText} [user_transcript] - object of user-input form data
*/
/**
* Main format for sound chunk request and Transcript response of sent sound from Resume API
* @typedef ResumeSoundInfo
* @type {object}
* @property {Array.<string[]>} [RawTxt] array of sentence. Each sentence is array of word. `[["This","is","first","sentence","."],["...","next","and","more"]]`
* @property {Date} datetime datetime that Resume.js send chunk of sound
* @property {Boolean} is_end true if user or Resume.js end the transcription Resume session
* @property {string} [tag] tag (form input name) used in Dictation or Combination mode should correlate Terminology of "C-CDA 1.1.0 on FHIR resource profile" (see README.md)
* @property {int[]} [_id] array of sound chunk index
* @property {GroupText} [user_transcript] object of user-input form data
*/
/**
* Returns from newSession method
* @typedef ResumeSessionResponse
* @property {int} status HTTP response status
* @property {ResumeNewSessionData} data response from Resume API containing session id and its information
* @property {Date} clientStartTime time that function called in server-sided Node.JS (client of API)
* @property {Date} userStartTime time that user (client-sided JavaScript) requests new Resume Session ID
* @property {string} [pseudoIdentifier] fake (pseudo) identifier generated by Resume REST API Client and sent to server
* @property {string} cookies HTTP header-encoded cookies string that Resume API responses. It must be included in consequenct resquest in same Session ID. Because it is important for API server routing.
*/
/*
{
status: res.status,
data: res.data,
clientStartTime: time,
userStartTime: userStartTime,
pseudoIdentifier: pseudoIden,
cookies: setCookie.parse(res, { decodeValues: false }).map((cookie) => {
console.log('Cookie:', JSON.stringify(cookie));
return cookie.name + '=' + cookie.value
}).join('; ')
}
*/
module.exports = {
/**
* ResumeNewSessionData
* @type {ResumeNewSessionData}
*/
ResumeNewSessionData: {},
/**
* @type {GroupText}
*/
GroupText: {},
/**
* @type {Transcript}
*/
Transcript: {},
/**
* @type {ResumeSoundInfo}
*/
ResumeSoundInfo: {},
/**
* @type {ResumeSessionResponse}
*/
ResumeSessionResponse: {}
}