tango-app-api-audio-analytics 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +41 -0
- package/API_EXAMPLES.md +310 -0
- package/COHORT_API.md +513 -0
- package/COHORT_API_EXAMPLES.sh +235 -0
- package/COHORT_API_IMPLEMENTATION.md +296 -0
- package/COHORT_API_QUICKSTART.md +387 -0
- package/index.js +6 -0
- package/package.json +36 -0
- package/src/controllers/audioAnalytics.controller.js +116 -0
- package/src/controllers/cohort.controller.js +357 -0
- package/src/controllers/cohortAnalytics.controller.js +46 -0
- package/src/controllers/conversationAnalytics.controller.js +92 -0
- package/src/dtos/audioAnalytics.dtos.js +537 -0
- package/src/middlewares/validation.middleware.js +624 -0
- package/src/routes/audioAnalytics.routes.js +18 -0
- package/src/services/cohort.service.js +332 -0
- package/src/validations/cohort.validation.js +113 -0
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
module.exports = {
|
|
3
|
+
'env': {
|
|
4
|
+
'es2021': true,
|
|
5
|
+
'node': true,
|
|
6
|
+
},
|
|
7
|
+
'extends': 'google',
|
|
8
|
+
'overrides': [
|
|
9
|
+
{
|
|
10
|
+
'env': {
|
|
11
|
+
'node': true,
|
|
12
|
+
},
|
|
13
|
+
'files': [
|
|
14
|
+
'.eslintrc.{js,cjs}',
|
|
15
|
+
],
|
|
16
|
+
'parserOptions': {
|
|
17
|
+
'sourceType': 'script',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
'parserOptions': {
|
|
22
|
+
'ecmaVersion': 'latest',
|
|
23
|
+
'sourceType': 'module',
|
|
24
|
+
},
|
|
25
|
+
'rules': {
|
|
26
|
+
'linebreak-style': [ 'error', 'windows' ],
|
|
27
|
+
'require-jsdoc': 'off',
|
|
28
|
+
'arrow-spacing': 'error',
|
|
29
|
+
'key-spacing': [ 'error', { 'beforeColon': false, 'afterColon': true } ],
|
|
30
|
+
'object-curly-spacing': [ 'error', 'always' ],
|
|
31
|
+
'space-in-parens': [ 'error', 'always' ],
|
|
32
|
+
'keyword-spacing': 'error',
|
|
33
|
+
'array-bracket-spacing': [ 'error', 'always' ],
|
|
34
|
+
'spaced-comment': [ 'error', 'always' ],
|
|
35
|
+
'max-len': [ 'error', { 'code': 700 } ],
|
|
36
|
+
'no-unused-vars': 'error',
|
|
37
|
+
'new-cap': [ 'error', { 'newIsCap': true, 'capIsNew': false } ],
|
|
38
|
+
'prefer-const': 'off',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
package/API_EXAMPLES.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Audio Analytics API - Request & Response Examples
|
|
2
|
+
|
|
3
|
+
## Base URL
|
|
4
|
+
```
|
|
5
|
+
https://testtangoretail-api.tangoeye.ai/v3/audio-analitics
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. Get Cohort Analysis
|
|
11
|
+
|
|
12
|
+
### Endpoint
|
|
13
|
+
```
|
|
14
|
+
POST /cohort-analysis
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Request Parameters
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"startDate": "2025-03-07",*
|
|
21
|
+
"endDate": "2025-10-07", *
|
|
22
|
+
"storeId": ["11-10","11-100","11-1001"],*
|
|
23
|
+
"cohortType": ["Photochromatic"],*
|
|
24
|
+
"clientId": ["11"],*
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Response
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"status": "success",
|
|
32
|
+
"data": {
|
|
33
|
+
"cohortAnalysis": {
|
|
34
|
+
"totalAudioAvailable": 100,
|
|
35
|
+
"cohortType": "Photochromatic",
|
|
36
|
+
"dateRange": {
|
|
37
|
+
"startDate": "2025-03-07",
|
|
38
|
+
"endDate": "2025-10-07"
|
|
39
|
+
},
|
|
40
|
+
"greetings": {
|
|
41
|
+
"name":"greetings",
|
|
42
|
+
"greetingValue":[
|
|
43
|
+
{
|
|
44
|
+
"name":"true",
|
|
45
|
+
"count": 41,
|
|
46
|
+
"yesResponses": 41,
|
|
47
|
+
"score": 41
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name":"false",
|
|
51
|
+
"count": 59,
|
|
52
|
+
"yesResponses": 59,
|
|
53
|
+
"score": 41
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
},
|
|
58
|
+
"salesReport": {
|
|
59
|
+
"name":"Sales Report",
|
|
60
|
+
"salesReportValue":[
|
|
61
|
+
{
|
|
62
|
+
"name":"converted",
|
|
63
|
+
"count": 41,
|
|
64
|
+
"yesResponses": 41,
|
|
65
|
+
"score": 41
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name":"notConverted",
|
|
69
|
+
"count": 41,
|
|
70
|
+
"yesResponses": 41,
|
|
71
|
+
"score": 41
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"uniquePitches": [
|
|
76
|
+
{
|
|
77
|
+
"pitchId": "YPA001",
|
|
78
|
+
"description": "Lorem ipsum dolor sit amet consectetur. Neque elementum qua...",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"pitchId": "YPA002",
|
|
82
|
+
"description": "Lorem ipsum dolor sit amet consectetur. Neque elementum qua...",
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"pitchQuality": {
|
|
86
|
+
"name":"Pitch Quality",
|
|
87
|
+
"pitchQualityValue":[
|
|
88
|
+
{
|
|
89
|
+
"name": "One Glass All Needs",
|
|
90
|
+
"count": 41,
|
|
91
|
+
"yesResponses": 41,
|
|
92
|
+
"score": 41
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "Travel Convenience",
|
|
96
|
+
"count": 12,
|
|
97
|
+
"yesResponses": 12,
|
|
98
|
+
"score": 22
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "Light Adaptation",
|
|
102
|
+
"count": 89,
|
|
103
|
+
"yesResponses": 89,
|
|
104
|
+
"score": 35
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "Reduces Eye Strain",
|
|
108
|
+
"count": 73,
|
|
109
|
+
"yesResponses": 73,
|
|
110
|
+
"score": 56
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"timestamp": "2025-03-02T10:30:00Z"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# Audio Analytics API - Conversation Analysis
|
|
122
|
+
|
|
123
|
+
## Conversation Analysis Endpoints
|
|
124
|
+
|
|
125
|
+
### 2. Get Conversations List
|
|
126
|
+
|
|
127
|
+
#### Endpoint
|
|
128
|
+
```
|
|
129
|
+
POST /conversations/list
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Request
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"startDate": "2025-03-01",*
|
|
136
|
+
"endDate": "2025-03-02",*
|
|
137
|
+
"storeId": ["11-10","11-100","11-1001"],*
|
|
138
|
+
"clientId": ["11"],*
|
|
139
|
+
"isAI":true,
|
|
140
|
+
"analyticsType":"audio",
|
|
141
|
+
"searchValue":"The hight duration of details info between lection stores and date",
|
|
142
|
+
"isExport":true,
|
|
143
|
+
"limit":10,
|
|
144
|
+
"offset":0
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Response (200 OK)
|
|
150
|
+
```json
|
|
151
|
+
|
|
152
|
+
if isExport === true,
|
|
153
|
+
download csv file below mentioned keys and value
|
|
154
|
+
{
|
|
155
|
+
"Audio Id":"YPA001",
|
|
156
|
+
"Store Details":"LKST123",
|
|
157
|
+
"Staff Name":"nithya",
|
|
158
|
+
"Date":"23 FEb, 2026",
|
|
159
|
+
"Timestamp":"12:45:00",
|
|
160
|
+
"Duration":"12 min",
|
|
161
|
+
"Summary":"this is denote teh summary part of audio",
|
|
162
|
+
"Full Transcript":"this is the detailed of full transcript of audio",
|
|
163
|
+
"Metrics":"Greetings",
|
|
164
|
+
"Context":"True",
|
|
165
|
+
"Score":"56%",
|
|
166
|
+
"Transcript":"this is trascript",
|
|
167
|
+
}
|
|
168
|
+
else
|
|
169
|
+
{
|
|
170
|
+
"status": "success",
|
|
171
|
+
"data": {
|
|
172
|
+
"count": 6,
|
|
173
|
+
"conversations": [
|
|
174
|
+
{
|
|
175
|
+
"audioId": "YPA001",
|
|
176
|
+
"storeId":"11-1001",
|
|
177
|
+
"storeName": "LKST23",
|
|
178
|
+
"userName":"",
|
|
179
|
+
"location": "Store LAB10 (North Region)",
|
|
180
|
+
"date": "18 Feb, 2026",
|
|
181
|
+
"time":"12:35 PM",
|
|
182
|
+
"duration":"12 min",
|
|
183
|
+
"audioDescription": "Lorem ipsum dolor sit amet consectetur. Neque elementum qua..."
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"audioId": "YPA002",
|
|
187
|
+
"storeId":"11-1001",
|
|
188
|
+
"storeName": "LKST23",
|
|
189
|
+
"userName":"",
|
|
190
|
+
"location": "Store LAB10 (North Region)",
|
|
191
|
+
"date": "18 Feb, 2026",
|
|
192
|
+
"time":"12:35 PM",
|
|
193
|
+
"duration":"12 min",
|
|
194
|
+
"audioDescription": "Lorem ipsum dolor sit amet consectetur. Neque elementum qua..."
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### 3. Get specific Conversation Details
|
|
204
|
+
|
|
205
|
+
#### Endpoint
|
|
206
|
+
```
|
|
207
|
+
POST /conversations/:conversationId
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
#### Request
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"storeId": "11-1001" *
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### Response (200 OK)
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"status": "success",
|
|
221
|
+
"data": {
|
|
222
|
+
"audioId": "YPA001",
|
|
223
|
+
"storeId": "11-1001",
|
|
224
|
+
"storeName": "LKST100",
|
|
225
|
+
"date": "18 Feb, 2026",
|
|
226
|
+
"time": "12:35 PM",
|
|
227
|
+
"duration": "12 min",
|
|
228
|
+
"audioUrl": "https://api.example.com/audio/CONV001.mp4",
|
|
229
|
+
"audioDescription": "Lorem ipsum dolor sit amet consectetur. Neque elementum qua...",
|
|
230
|
+
"metrics": {
|
|
231
|
+
"greetings": [
|
|
232
|
+
{
|
|
233
|
+
"name": "Greetings",
|
|
234
|
+
"score": "true"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"salesReport": [
|
|
238
|
+
{
|
|
239
|
+
"name": "Sales Report",
|
|
240
|
+
"score": "Converted"
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
"pitchQuality": [
|
|
244
|
+
{
|
|
245
|
+
"name": "One Glass All Needs",
|
|
246
|
+
"score": "41 %"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"name": "Travel Convenience",
|
|
250
|
+
"score": "25 %"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "Light Adaptation",
|
|
254
|
+
"score": "37 %"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"name": "Reduces Eye Strain",
|
|
258
|
+
"score": "45 %"
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"UniquePitches": [
|
|
262
|
+
{
|
|
263
|
+
"name": "Unique Pitches",
|
|
264
|
+
"value": [
|
|
265
|
+
"Lorem ipsum dolor sit amet consectetur. Neque elementum quam ultrices bibendum pulvinar amet.",
|
|
266
|
+
"Lorem ipsum dolor sit amet consectetur. Neque elementum quam ultrices bibendum pulvinar amet.",
|
|
267
|
+
"Lorem ipsum dolor sit amet consectetur. Neque elementum quam ultrices bibendum pulvinar amet."
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
"aiInsights": {
|
|
273
|
+
"title": "Tango AI Generated Insights",
|
|
274
|
+
"summary": [
|
|
275
|
+
"Staff demonstrated excellent product knowledge",
|
|
276
|
+
"Customer engaged positively throughout"
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
"conversationDetails": {
|
|
280
|
+
"audioSummary": "Lorem ipsum dolor sit amet consectetur. Neque elementum qua...",
|
|
281
|
+
"transcription": "Lorem ipsum dolor sit amet consectetur. Staff engaged positively with customer discussing lens technology and benefits."
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"timestamp": "2025-03-02T10:30:00Z"
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Error Responses
|
|
289
|
+
|
|
290
|
+
### 400 Bad Request
|
|
291
|
+
```json
|
|
292
|
+
{
|
|
293
|
+
"status": "error",
|
|
294
|
+
"message": "Missing required parameters: startDate, endDate, storeId",
|
|
295
|
+
"code": "MISSING_PARAMETERS",
|
|
296
|
+
"timestamp": "2025-03-02T10:30:00Z"
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### 500 Internal Server Error
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"status": "error",
|
|
304
|
+
"message": "Internal server error",
|
|
305
|
+
"code": "INTERNAL_ERROR",
|
|
306
|
+
"timestamp": "2025-03-02T10:30:00Z"
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
|