Azure Cognitive API in action


I did some search and assembled together a POC for a University Health Center and wanted to share details in case others have similar project. The use case involves providing captions in different languages for an interview between a patient and a clinician. The application was being written in Node.js. This is what I did on Azure.

Bing Speech API provides the ability to take an audio recording, specify which language the recording is in, and provide text for the recording in language you want. There is sample code available to show results of this API https://github.com/MicrosoftTranslator/NodeJs-Example. The authentication mechanism in the sample code needed to be changed as now the API keys are available by creating Cognitive Services account in Azure. Please generate the API key as per these steps.

Replace the code in app.js to get token as per below

// get Azure Data Market Access Token

request.post(

'https://api.cognitive.microsoft.com/sts/v1.0/issueToken',

{

headers : {

'Ocp-Apim-Subscription-Key' : '<new Key>',

}

},

// once we get the access token, we hook up the necessary websocket events for sending audio and processing the response

function (error, response, body) {

if (!error && response.statusCode == 200) {

// parse and get the access token

var accessToken = body;

Rest of the code works. I tested by giving  spanish.wav file to get English translation.

Cross platform HTML5 application being developed is written in Node.js & MongoDB. Again there is a sample application available for this tech stack which I deployed on Azure App Service and Database as a Service for MongoDB (This is DocumentDB as a data store for apps written in MongoDB). App Service and DocumentDB bring to the table automated scaling and continuous integration which makes managing this application much easier. Data stored in Azure is covered under HIPAA BAA https://www.microsoft.com/en-us/trustcenter/compliance/hipaa

Customer is happy so far as they are conducting thorough testing to ensure application is viable for production roll out.


Comments (0)

Skip to main content