@senior-agronegocio/angular-components 0.0.82 → 0.0.83-updated

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.
@@ -2825,6 +2825,101 @@ var AgroArrayUtils = /** @class */ (function () {
2825
2825
  return AgroArrayUtils;
2826
2826
  }());
2827
2827
 
2828
+ var AgroLogics = /** @class */ (function () {
2829
+ function AgroLogics() {
2830
+ }
2831
+ /**
2832
+ * Agrupa o conjunto de dados pelos campos de entidade fornecidos e calcula
2833
+ * a distribuição de probabilidade (frequência e porcentagem).
2834
+ *
2835
+ * @param data - Array de objetos a serem analisados
2836
+ * @param keys - Chaves ou caminhos aninhados para agrupar (ex: ["entity1", "entity2"])
2837
+ * @returns Array de estatísticas agrupadas ordenadas por samplingSuccess (decrescente)
2838
+ */
2839
+ AgroLogics.entityDistributionStats = function (data, keys) {
2840
+ var e_1, _a;
2841
+ var total = data.length;
2842
+ var map = new Map();
2843
+ var _loop_1 = function (item) {
2844
+ var e_2, _a, e_3, _b;
2845
+ var uniqueKey = JSON.stringify(keys.map(function (c) {
2846
+ var e_4, _a;
2847
+ var parts = c.split(".");
2848
+ var value = item;
2849
+ try {
2850
+ for (var parts_2 = (e_4 = void 0, __values(parts)), parts_2_1 = parts_2.next(); !parts_2_1.done; parts_2_1 = parts_2.next()) {
2851
+ var p = parts_2_1.value;
2852
+ value = value === null || value === void 0 ? void 0 : value[p];
2853
+ }
2854
+ }
2855
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
2856
+ finally {
2857
+ try {
2858
+ if (parts_2_1 && !parts_2_1.done && (_a = parts_2.return)) _a.call(parts_2);
2859
+ }
2860
+ finally { if (e_4) throw e_4.error; }
2861
+ }
2862
+ return value;
2863
+ }));
2864
+ if (!map.has(uniqueKey)) {
2865
+ var groupedData = {};
2866
+ try {
2867
+ for (var keys_1 = (e_2 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
2868
+ var c = keys_1_1.value;
2869
+ var parts = c.split(".");
2870
+ var value = item;
2871
+ try {
2872
+ for (var parts_1 = (e_3 = void 0, __values(parts)), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) {
2873
+ var p = parts_1_1.value;
2874
+ value = value === null || value === void 0 ? void 0 : value[p];
2875
+ }
2876
+ }
2877
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
2878
+ finally {
2879
+ try {
2880
+ if (parts_1_1 && !parts_1_1.done && (_b = parts_1.return)) _b.call(parts_1);
2881
+ }
2882
+ finally { if (e_3) throw e_3.error; }
2883
+ }
2884
+ // add the full entity (not only its ID)
2885
+ groupedData[c.toString().split(".")[0]] = value;
2886
+ }
2887
+ }
2888
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2889
+ finally {
2890
+ try {
2891
+ if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
2892
+ }
2893
+ finally { if (e_2) throw e_2.error; }
2894
+ }
2895
+ map.set(uniqueKey, { data: groupedData, count: 0 });
2896
+ }
2897
+ map.get(uniqueKey).count++;
2898
+ };
2899
+ try {
2900
+ for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
2901
+ var item = data_1_1.value;
2902
+ _loop_1(item);
2903
+ }
2904
+ }
2905
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2906
+ finally {
2907
+ try {
2908
+ if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
2909
+ }
2910
+ finally { if (e_1) throw e_1.error; }
2911
+ }
2912
+ var result = Array.from(map.values()).map(function (entry) { return ({
2913
+ data: entry.data,
2914
+ samplingQuantity: entry.count,
2915
+ samplingSuccess: Math.round((entry.count / total) * 100),
2916
+ }); });
2917
+ result.sort(function (a, b) { return b.samplingSuccess - a.samplingSuccess; });
2918
+ return result;
2919
+ };
2920
+ return AgroLogics;
2921
+ }());
2922
+
2828
2923
  var AsyncLock = /** @class */ (function () {
2829
2924
  function AsyncLock() {
2830
2925
  this.queue = [];
@@ -6360,5 +6455,5 @@ var AgroAngularComponentsModule = /** @class */ (function () {
6360
6455
  * Generated bundle index. Do not edit.
6361
6456
  */
6362
6457
 
6363
- export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFormValidator, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, CancelEventDialogComponent, CancelEventDialogModule, Colors, DateComparisonType, E001TnsModule, E001pesModule, E070EmpModule, E070FilModule, E075DerModule, E205depService, EventControlBoardComponent, EventControlBoardModule, EventControlBoardService, EventControlItemModule, EventControlModule, EventStepsComponent, EventStepsModule, ExternalInvoiceModule, FixationModule, HostProjectConfigsInjectionToken, HttpCodes, InvoiceModule, LibTranslatePipe, LibTranslationModule, LibTranslationService, NumberComparisonType, OriginationModule, PaginatorStorageService, PrimitiveManager, ProducerInvoiceModule, RuralEstateModule, SharedModule, TicketModule, TransferModule, UserInformationService, WebsocketModule, WebsocketService, LibTranslationService as ɵa };
6458
+ export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFormValidator, AgroLogics, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, CancelEventDialogComponent, CancelEventDialogModule, Colors, DateComparisonType, E001TnsModule, E001pesModule, E070EmpModule, E070FilModule, E075DerModule, E205depService, EventControlBoardComponent, EventControlBoardModule, EventControlBoardService, EventControlItemModule, EventControlModule, EventStepsComponent, EventStepsModule, ExternalInvoiceModule, FixationModule, HostProjectConfigsInjectionToken, HttpCodes, InvoiceModule, LibTranslatePipe, LibTranslationModule, LibTranslationService, NumberComparisonType, OriginationModule, PaginatorStorageService, PrimitiveManager, ProducerInvoiceModule, RuralEstateModule, SharedModule, TicketModule, TransferModule, UserInformationService, WebsocketModule, WebsocketService, LibTranslationService as ɵa };
6364
6459
  //# sourceMappingURL=senior-agronegocio-angular-components.js.map