Skip to content

Commit

Permalink
[IngestionClient] Refactor transcription analytics (#1961)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryvanderVegte authored May 30, 2023
1 parent a278cfa commit 2fd035a
Show file tree
Hide file tree
Showing 16 changed files with 390 additions and 303 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace Connector.Enums
{
public enum TranscriptionAnalyticsJobStatus
{
None,
NotSubmitted,
Running,
Completed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public TextAnalyticsRequests(
IEnumerable<TextAnalyticsRequest> audioLevelRequests,
IEnumerable<TextAnalyticsRequest> conversationRequests)
{
this.UtteranceLevelRequests = utteranceLevelRequests;
this.AudioLevelRequests = audioLevelRequests;
this.ConversationRequests = conversationRequests;
this.UtteranceLevelRequests = utteranceLevelRequests ?? new List<TextAnalyticsRequest>();
this.AudioLevelRequests = audioLevelRequests ?? new List<TextAnalyticsRequest>();
this.ConversationRequests = conversationRequests ?? new List<TextAnalyticsRequest>();
}

public IEnumerable<TextAnalyticsRequest> UtteranceLevelRequests { get; }
public IEnumerable<TextAnalyticsRequest> UtteranceLevelRequests { get; set; }

public IEnumerable<TextAnalyticsRequest> AudioLevelRequests { get; }
public IEnumerable<TextAnalyticsRequest> AudioLevelRequests { get; set; }

public IEnumerable<TextAnalyticsRequest> ConversationRequests { get; }
public IEnumerable<TextAnalyticsRequest> ConversationRequests { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

using FetchTranscription.Database;
using FetchTranscription;

using Microsoft.Azure.WebJobs.Hosting;

[assembly: WebJobsStartup(typeof(DatabaseInitializationService), "DatabaseInitialize")]

namespace FetchTranscription.Database
namespace FetchTranscription
{
using Connector.Database;

using FetchTranscriptionFunction;

using Microsoft.Azure.WebJobs.Description;
using Microsoft.Azure.WebJobs.Host.Config;
using Microsoft.EntityFrameworkCore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

using FetchTranscription.Database;
using FetchTranscription;

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Hosting;

[assembly: WebJobsStartup(typeof(DatabaseInitializationService), "DatabaseInitialize")]

namespace FetchTranscription.Database
namespace FetchTranscription
{
public class DatabaseInitializationService : IWebJobsStartup
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscriptionFunction
namespace FetchTranscription
{
using System;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscriptionFunction
namespace FetchTranscription
{
using System;
using Connector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace FetchTranscription

using Connector.Database;

using FetchTranscriptionFunction;

using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <copyright file="ITranscriptionAnalyticsProvider.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscription
{
using System.Collections.Generic;
using System.Threading.Tasks;

using Connector;
using Connector.Enums;
using Connector.Serializable.TranscriptionStartedServiceBusMessage;

public interface ITranscriptionAnalyticsProvider
{
/// <summary>
/// Gets the status of the transcription analytics jobs that are monitored by the provider
/// </summary>
/// <param name="audioFileInfos">The audio file infos with transcription analytics jobs info</param>
/// <returns>The overall status of all jobs monitored by the provider</returns>
Task<TranscriptionAnalyticsJobStatus> GetTranscriptionAnalyticsJobStatusAsync(IEnumerable<AudioFileInfo> audioFileInfos);

/// <summary>
/// Submits transcription analytics jobs based on the transcript in speechtranscript and sets the job ids in the corresponding audio file infos.
/// </summary>
/// <param name="speechTranscriptMappings">The mapping from audio file info to transcript</param>
/// <returns>The errors if any.</returns>
Task<IEnumerable<string>> SubmitTranscriptionAnalyticsJobsAsync(Dictionary<AudioFileInfo, SpeechTranscript> speechTranscriptMappings);

/// <summary>
/// Fetches the transcription analytics results and adds them to the corresponding speech transcript
/// </summary>
/// <param name="speechTranscriptMappings">The mapping from audio file info to transcript</param>
/// <returns>The errors if any.</returns>
Task<IEnumerable<string>> AddTranscriptionAnalyticsResultsToTranscriptsAsync(Dictionary<AudioFileInfo, SpeechTranscript> speechTranscriptMappings);
}
}
Loading

0 comments on commit 2fd035a

Please sign in to comment.