tango-app-api-analysis-zone 3.0.0-alpha.17 → 3.0.0-alpha.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-zone",
3
- "version": "3.0.0-alpha.17",
3
+ "version": "3.0.0-alpha.18",
4
4
  "description": "zone Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -51,6 +51,7 @@ export const zonecards = async ( req, res ) => {
51
51
  return res.sendError( { error: error }, 500 );
52
52
  }
53
53
  };
54
+
54
55
  export const topPerformingZones = async ( req, res ) => {
55
56
  try {
56
57
  let reqestData = req.body;
@@ -84,6 +85,7 @@ export const topPerformingZones = async ( req, res ) => {
84
85
  return res.sendError( { error: error }, 500 );
85
86
  }
86
87
  };
88
+
87
89
  export const topPerformingStores = async ( req, res ) => {
88
90
  try {
89
91
  let reqestData = req.body;
@@ -117,6 +119,7 @@ export const topPerformingStores = async ( req, res ) => {
117
119
  return res.sendError( { error: error }, 500 );
118
120
  }
119
121
  };
122
+
120
123
  export const zoneSummaryTable = async ( req, res ) => {
121
124
  try {
122
125
  let reqestData = req.body;
@@ -327,7 +330,7 @@ export const zoneSummaryTable = async ( req, res ) => {
327
330
  '60 above': 60,
328
331
  'maleCount': 40,
329
332
  'femaleCount': 50,
330
- }
333
+ },
331
334
  ],
332
335
  };
333
336
  return res.sendSuccess( result );
@@ -336,6 +339,7 @@ export const zoneSummaryTable = async ( req, res ) => {
336
339
  return res.sendError( { error: error }, 500 );
337
340
  }
338
341
  };
342
+
339
343
  export const availableZoneNames = async ( req, res ) => {
340
344
  try {
341
345
  let reqestData = req.body;
@@ -371,6 +375,7 @@ export const availableZoneNames = async ( req, res ) => {
371
375
  return res.sendError( { error: error }, 500 );
372
376
  }
373
377
  };
378
+
374
379
  export const zoneConcentrationSummary = async ( req, res ) => {
375
380
  try {
376
381
  let reqestData = req.body;
@@ -458,6 +463,7 @@ export const zoneConcentrationSummary = async ( req, res ) => {
458
463
  return res.sendError( { error: error }, 500 );
459
464
  }
460
465
  };
466
+
461
467
  export const overallStoreConcentrationDates = async ( req, res ) => {
462
468
  try {
463
469
  let reqestData = req.body;
@@ -489,6 +495,7 @@ export const overallStoreConcentrationDates = async ( req, res ) => {
489
495
  return res.sendError( { error: error }, 500 );
490
496
  }
491
497
  };
498
+
492
499
  export const overallStoreConcentrationHeatmap = async ( req, res ) => {
493
500
  try {
494
501
  let reqestData = req.body;
@@ -535,6 +542,7 @@ export const overallStoreConcentrationHeatmap = async ( req, res ) => {
535
542
  return res.sendError( { error: error }, 500 );
536
543
  }
537
544
  };
545
+
538
546
  export const trajectoryAnalysis = async ( req, res ) => {
539
547
  try {
540
548
  let reqestData = req.body;
@@ -555,16 +563,24 @@ export const trajectoryAnalysis = async ( req, res ) => {
555
563
 
556
564
  let result = {
557
565
  'trajectoryAnalysisData': {
558
- 'zoneList': [ 'zone-1', 'zone-2', 'zone-3' ],
566
+ 'zoneList': [
567
+ { 'from': 'Entrance', 'to': 'Vincent Chase', 'value': 10 },
568
+ { 'from': 'Entrance', 'to': 'John Jacobs', 'value': 20 },
569
+ { 'from': 'Entrance', 'to': 'Premium Section', 'value': 10 },
570
+ { 'from': 'Entrance', 'to': 'Billing', 'value': 30 },
571
+ { 'from': 'Entrance', 'to': 'Exit', 'value': 10 },
572
+ ],
559
573
  'otherZone': {
560
574
  'impressionRate': 40.0,
561
575
  'gender': 'Male', // ["Male","Female"]
562
576
  'ageGroup': '20-30',
577
+ 'ageGenderRate': 40,
563
578
  },
564
579
  'currentZone': {
565
580
  'impressionRate': 40.0,
566
581
  'gender': 'Female', // ["Male","Female"]
567
582
  'ageGroup': '20-30',
583
+ 'ageGenderRate': 30,
568
584
  },
569
585
  },
570
586
  };
@@ -574,6 +590,7 @@ export const trajectoryAnalysis = async ( req, res ) => {
574
590
  return res.sendError( { error: error }, 500 );
575
591
  }
576
592
  };
593
+
577
594
  export const customerJourney = async ( req, res ) => {
578
595
  try {
579
596
  let reqestData = req.body;
@@ -593,7 +610,18 @@ export const customerJourney = async ( req, res ) => {
593
610
  }
594
611
 
595
612
  let result = {
596
- 'customerJourneyData': { },
613
+ 'customerJourneyData': {
614
+ 'zoneList': [
615
+ { from: 'Entry (1343)', to: 'Vincent Chase (1343)', value: 20 },
616
+ { from: 'Vincent Chase (1343)', to: 'John Jacobs (1343)', value: 20 },
617
+ { from: 'Entry (1343)', to: 'John Jacobs (1343)', value: 40 },
618
+ { from: 'Entry (1343)', to: 'Premium Section (1343)', value: 20 },
619
+ { from: 'John Jacobs (1343)', to: 'Billing (1343)', value: 20 },
620
+ { from: 'Billing (1343)', to: 'Exit', value: 20 },
621
+ { from: 'Premium Section (1343)', to: 'Exit', value: 20 },
622
+ { from: 'Premium Section (1343)', to: 'Billing (1343)', value: 20 },
623
+ ],
624
+ },
597
625
  };
598
626
  return res.sendSuccess( result );
599
627
  } catch ( error ) {
@@ -601,6 +629,77 @@ export const customerJourney = async ( req, res ) => {
601
629
  return res.sendError( { error: error }, 500 );
602
630
  }
603
631
  };
632
+
633
+ export const customerJourneyTable = async ( req, res ) => {
634
+ try {
635
+ let reqestData = req.body;
636
+ let checkNoData = await returnNoData( reqestData.storeId );
637
+ if ( checkNoData ) {
638
+ return res.sendError( { error: 'No Data Found' }, 204 );
639
+ }
640
+
641
+ let checkInvalidRequest = await returnInvalidRequest( reqestData.storeId );
642
+ if ( checkInvalidRequest ) {
643
+ return res.sendError( { error: 'Invalid Date' }, 400 );
644
+ }
645
+
646
+ let checkServerError = await returnServerError( reqestData.storeId );
647
+ if ( checkServerError ) {
648
+ return res.sendError( { error: 'Server Error' }, 500 );
649
+ }
650
+
651
+ let result = {
652
+ 'totalCount': 300,
653
+ 'customerJourneyTableData': [
654
+ {
655
+ 'zoneName ': 'Entry',
656
+ 'noOfStores': 23,
657
+ 'zoneFF': 234,
658
+ 'impressions': 34,
659
+ 'AvgDwellTime': 24,
660
+ 'concRate': 24,
661
+ },
662
+ {
663
+ 'zoneName ': 'Vincent Chase',
664
+ 'noOfStores': 23,
665
+ 'zoneFF': 234,
666
+ 'impressions': 34,
667
+ 'AvgDwellTime': 24,
668
+ 'concRate': 24,
669
+ },
670
+ {
671
+ 'zoneName ': 'John Jacobs',
672
+ 'noOfStores': 23,
673
+ 'zoneFF': 234,
674
+ 'impressions': 34,
675
+ 'AvgDwellTime': 24,
676
+ 'concRate': 24,
677
+ },
678
+ {
679
+ 'zoneName ': 'Air',
680
+ 'noOfStores': 23,
681
+ 'zoneFF': 234,
682
+ 'impressions': 34,
683
+ 'AvgDwellTime': 24,
684
+ 'concRate': 24,
685
+ },
686
+ {
687
+ 'zoneName ': 'Exit',
688
+ 'noOfStores': 23,
689
+ 'zoneFF': 234,
690
+ 'impressions': 34,
691
+ 'AvgDwellTime': 24,
692
+ 'concRate': 24,
693
+ },
694
+ ],
695
+ };
696
+ return res.sendSuccess( result );
697
+ } catch ( error ) {
698
+ logger.error( { error: error, message: req.query, function: 'customerJourneyData' } );
699
+ return res.sendError( { error: error }, 500 );
700
+ }
701
+ };
702
+
604
703
  async function returnNoData( requestData ) {
605
704
  try {
606
705
  if ( requestData && requestData.includes( '204' ) ) {
@@ -79,7 +79,7 @@ export const topPerformingStoresV1 = async ( req, res ) => {
79
79
  'Store Name': element.storeName,
80
80
  'Zone Name': element.zoneName,
81
81
  'Concentration': element.concentrationRate,
82
- 'AVG DwellTime': element.avgDwellTime,
82
+ 'Avg Dwell Time': element.avgDwellTime,
83
83
  'Zone Footfall': element.zoneFootfall,
84
84
  } );
85
85
  } );
@@ -122,7 +122,7 @@ export const zoneSummaryTableV1 = async ( req, res ) => {
122
122
  'Store Name': element.storeName,
123
123
  'StoreId': element.storeId,
124
124
  'Zone Conc.Rate': element.concentrationRate,
125
- 'AVG.Dwell Time': element.avgDwellTime,
125
+ 'Avg Dwell Time': element.avgDwellTime,
126
126
  'Zone FF': element.footfallCount,
127
127
  'Zone Bounced': element.bouncedCount,
128
128
  'Zone Engagers': element.engagersCount,
@@ -14,6 +14,7 @@ import {
14
14
  overallStoreConcentrationHeatmap,
15
15
  trajectoryAnalysis,
16
16
  customerJourney,
17
+ customerJourneyTable,
17
18
  } from '../controllers/analysisZoneSampleDataV2.controllers.js';
18
19
 
19
20
  analysisZoneV2Router
@@ -26,5 +27,6 @@ analysisZoneV2Router
26
27
  .post( '/overallStoreConcentrationDates', overallStoreConcentrationDates )
27
28
  .post( '/overallStoreConcentrationHeatmap', overallStoreConcentrationHeatmap )
28
29
  .post( '/trajectoryAnalysis', trajectoryAnalysis )
29
- .post( '/customerJourney', customerJourney );
30
+ .post( '/customerJourney', customerJourney )
31
+ .post( '/customerJourneyTable', customerJourneyTable );
30
32
  export default analysisZoneV2Router;