@gen3/core 0.11.29 → 0.11.30

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/dist/cjs/index.js CHANGED
@@ -6,8 +6,9 @@ var cookiesNext = require('cookies-next');
6
6
  var query = require('@reduxjs/toolkit/query');
7
7
  var reactRedux = require('react-redux');
8
8
  var React = require('react');
9
- var lodash = require('lodash');
9
+ var nanoid$1 = require('nanoid');
10
10
  var useSWR = require('swr');
11
+ var lodash = require('lodash');
11
12
  var flat = require('flat');
12
13
  var Papa = require('papaparse');
13
14
  var jsonpathPlus = require('jsonpath-plus');
@@ -864,7 +865,8 @@ const newCohort = ({ filters = {}, customName })=>{
864
865
  counts: {}
865
866
  };
866
867
  };
867
- const createCohortId = ()=>toolkit.nanoid();
868
+ const nanoid = nanoid$1.customAlphabet('1234567890abcdef', 16);
869
+ const createCohortId = ()=>nanoid();
868
870
  const cohortsAdapter = toolkit.createEntityAdapter({
869
871
  sortComparer: (a, b)=>{
870
872
  if (a.modifiedDatetime <= b.modifiedDatetime) return 1;
@@ -1087,6 +1089,21 @@ const getCurrentCohortId = (state)=>state.currentCohortId;
1087
1089
  }
1088
1090
  });
1089
1091
  },
1092
+ updateCohortIndexCountById: (state, action)=>{
1093
+ const { index, cohortId, counts } = action.payload;
1094
+ const cohort = state.entities[cohortId];
1095
+ cohortsAdapter.updateOne(state, {
1096
+ id: cohortId,
1097
+ changes: {
1098
+ counts: {
1099
+ ...cohort.counts,
1100
+ ...{
1101
+ [index]: counts
1102
+ }
1103
+ }
1104
+ }
1105
+ });
1106
+ },
1090
1107
  setCurrentCohortId: (state, action)=>{
1091
1108
  state.currentCohortId = action.payload;
1092
1109
  },
@@ -1108,7 +1125,7 @@ const getCurrentCohortId = (state)=>state.currentCohortId;
1108
1125
  * @hidden
1109
1126
  */ const cohortSelectors = cohortsAdapter.getSelectors((state)=>state.cohorts.cohortManager);
1110
1127
  // Filter actions: addFilter, removeFilter, updateFilter
1111
- const { createNewCohort, updateCohortFilter, setCohortFilter, setCohortIndexFilters, duplicateCohort, removeCohortFilter, clearCohortFilters, removeCohort, setCurrentCohortId, updateCohortName, updateCohortCounts, setCohortList } = cohortManagerSlice.actions;
1128
+ const { createNewCohort, updateCohortFilter, setCohortFilter, setCohortIndexFilters, duplicateCohort, removeCohortFilter, clearCohortFilters, removeCohort, setCurrentCohortId, updateCohortName, updateCohortCounts, updateCohortIndexCountById, setCohortList } = cohortManagerSlice.actions;
1112
1129
  const cohortReducer = cohortManagerSlice.reducer;
1113
1130
 
1114
1131
  const initialState$2 = {};
@@ -1693,81 +1710,6 @@ const trimFirstFieldNameToTitle = (fieldName, trim = false)=>{
1693
1710
  ];
1694
1711
  };
1695
1712
 
1696
- const { selectAll: selectAllCohorts, selectTotal: selectTotalCohorts, selectById: selectCohortById, selectIds: selectCohortIds } = cohortsAdapter.getSelectors((state)=>state.cohorts.cohortManager);
1697
- /**
1698
- * Internally used selector for the exported selectora
1699
- * @param state
1700
- */ const getCurrentCohortFromCoreState = (state)=>{
1701
- return state.cohorts.cohortManager.currentCohortId;
1702
- };
1703
- const selectCohortFilters = (state)=>{
1704
- const currentCohortId = getCurrentCohortFromCoreState(state);
1705
- return state.cohorts.cohortManager.entities[currentCohortId]?.filters;
1706
- };
1707
- const selectCurrentCohortFilters = (state)=>{
1708
- const currentCohortId = getCurrentCohortFromCoreState(state);
1709
- return state.cohorts.cohortManager.entities[currentCohortId]?.filters;
1710
- };
1711
- const selectCurrentCohortId = (state)=>{
1712
- return state.cohorts.cohortManager.currentCohortId;
1713
- };
1714
- const selectCurrentCohort = (state)=>cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
1715
- const selectCurrentCohortName = (state)=>cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state)).name;
1716
- /**
1717
- * Select a filter by its name from the current cohort. If the filter is not found
1718
- * returns undefined.
1719
- * @param state - Core
1720
- * @param index which cohort index to select from
1721
- * @param name name of the filter to select
1722
- */ const selectIndexedFilterByName = (state, index, name)=>{
1723
- return cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state)).filters[index]?.root[name];
1724
- };
1725
- /**
1726
- * Returns all the cohorts in the state
1727
- * @param state - the CoreState
1728
- *
1729
- * @category Cohort
1730
- * @category Selectors
1731
- */ const selectAvailableCohorts = (state)=>cohortSelectors.selectAll(state);
1732
- /**
1733
- * Returns if the current cohort is modified
1734
- * @param state - the CoreState
1735
- * @category Cohort
1736
- * @category Selectors
1737
- * @hidden
1738
- */ const selectCurrentCohortModified = (state)=>{
1739
- const cohort = cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
1740
- return cohort?.modified;
1741
- };
1742
- /**
1743
- * Returns if the current cohort has been saved
1744
- * @param state - the CoreState
1745
- * @category Cohort
1746
- * @category Selectors
1747
- * @hidden
1748
- */ const selectCurrentCohortSaved = (state)=>{
1749
- const cohort = cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
1750
- return cohort?.saved;
1751
- };
1752
- /**
1753
- * Select a filter by its name from the current cohort. If the filter is not found
1754
- * returns undefined.
1755
- * @param state - Core
1756
- * @param name name of the filter to select
1757
- */ const selectAvailableCohortByName = (state, name)=>cohortSelectors.selectAll(state).find((cohort)=>cohort.name === name);
1758
- /**
1759
- * Select a filter from the index.
1760
- * returns undefined.
1761
- * @param state - Core
1762
- * @param index which cohort index to select from
1763
- */ const selectIndexFilters = (state, index)=>{
1764
- const cohort = cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
1765
- if (!cohort) {
1766
- console.error('No Cohort Defined');
1767
- }
1768
- return cohort?.filters?.[index] ?? EmptyFilterSet;
1769
- };
1770
-
1771
1713
  /**
1772
1714
  * Flattens a deep nested JSON object skipping
1773
1715
  * the first level to avoid potentially flattening
@@ -2135,6 +2077,15 @@ const useGetStatus = ()=>{
2135
2077
  const fetcher = ()=>fetchJson(`${GEN3_GUPPY_API}${statusEndpoint}`);
2136
2078
  return useSWR('explorerStatus', fetcher);
2137
2079
  };
2080
+ const explorerTags = guppyApi.enhanceEndpoints({
2081
+ addTagTypes: [
2082
+ 'AGGS',
2083
+ 'COUNTS',
2084
+ 'STATS',
2085
+ 'TABLE_DATA',
2086
+ 'RAW_DATA'
2087
+ ]
2088
+ });
2138
2089
  /**
2139
2090
  * The main endpoint used in templating Exploration page queries.
2140
2091
  * Includes table, filter and aggregation query types and leverages guppyApi defined in ./gupplApi.ts
@@ -2152,7 +2103,7 @@ const useGetStatus = ()=>{
2152
2103
  * @param getSubAggs - TODO: not sure what this one does. Looks like nested aggregation
2153
2104
  * @param getCounts - Returns total counts of a vertex type
2154
2105
  * @returns: A guppy API endpoint for templating queryable data displayed on the exploration page
2155
- */ const explorerApi = guppyApi.injectEndpoints({
2106
+ */ const explorerApi = explorerTags.injectEndpoints({
2156
2107
  endpoints: (builder)=>({
2157
2108
  getAllFieldsForType: builder.query({
2158
2109
  query: (type)=>({
@@ -2163,11 +2114,11 @@ const useGetStatus = ()=>{
2163
2114
  }
2164
2115
  }),
2165
2116
  getAccessibleData: builder.query({
2166
- query: ({ type, fields, accessType })=>{
2117
+ query: ({ type, fields, accessibility })=>{
2167
2118
  const fieldParts = fields.map((field)=>`${field} { histogram { key count } }`);
2168
2119
  return {
2169
2120
  query: `_aggregation {
2170
- ${type} (accessibility: ${accessType}) {
2121
+ ${type} (accessibility: ${accessibility}) {
2171
2122
  ${fieldParts.join(',')}
2172
2123
  }
2173
2124
  }`
@@ -2229,11 +2180,15 @@ const useGetStatus = ()=>{
2229
2180
  query,
2230
2181
  variables
2231
2182
  };
2232
- }
2183
+ },
2184
+ providesTags: [
2185
+ 'RAW_DATA',
2186
+ 'TABLE_DATA'
2187
+ ]
2233
2188
  }),
2234
2189
  getAggs: builder.query({
2235
- query: ({ type, fields, filters, accessibility = Accessibility.ALL })=>{
2236
- return buildGetAggregationQuery(type, fields, filters, accessibility, false);
2190
+ query: ({ type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false })=>{
2191
+ return buildGetAggregationQuery(type, fields, filters, accessibility, filterSelf);
2237
2192
  },
2238
2193
  transformResponse: (response, _meta, args)=>{
2239
2194
  const buckets = processHistogramResponse(response?.data?._aggregation[args.type] ?? {});
@@ -2248,41 +2203,39 @@ const useGetStatus = ()=>{
2248
2203
  ],
2249
2204
  ...buckets
2250
2205
  };
2251
- }
2252
- }),
2253
- getAggsNoFilterSelf: builder.query({
2254
- query: ({ type, fields, filters, accessibility = Accessibility.ALL })=>{
2255
- return buildGetAggregationQuery(type, fields, filters, accessibility, true);
2256
2206
  },
2257
- transformResponse: (response, _meta, args)=>{
2258
- return processHistogramResponse(response?.data?._aggregation[args.type] ?? {});
2259
- }
2207
+ providesTags: [
2208
+ 'AGGS'
2209
+ ]
2260
2210
  }),
2261
2211
  getStatsAggregations: builder.query({
2262
- query: ({ type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false })=>{
2263
- return buildGetStatsAggregationQuery(type, fields, filters, accessibility, filterSelf);
2212
+ query: ({ type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false, queryId = undefined })=>{
2213
+ return buildGetStatsAggregationQuery(type, fields, filters, accessibility, filterSelf, queryId);
2264
2214
  },
2265
2215
  transformResponse: (response, _meta, args)=>{
2266
2216
  return processHistogramResponse(response?.data?._aggregation[args.type] ?? {});
2267
- }
2217
+ },
2218
+ providesTags: [
2219
+ 'STATS'
2220
+ ]
2268
2221
  }),
2269
2222
  getSubAggs: builder.query({
2270
- query: ({ type, mainField, termsFields = undefined, missingFields = undefined, numericAggAsText = false, gqlFilter = undefined, accessibility = Accessibility.ALL })=>{
2223
+ query: ({ type, mainField, termsFields = undefined, missingFields = undefined, numericAggAsText = false, filters = undefined, accessibility = Accessibility.ALL })=>{
2271
2224
  const nestedAggFields = {
2272
2225
  termsFields: termsFields,
2273
2226
  missingFields: missingFields
2274
2227
  };
2275
- const query = `query getSubAggs ( ${gqlFilter ?? '$filter: JSON,'} $nestedAggFields: JSON) {
2228
+ const query = `query getSubAggs ( ${filters ?? '$filter: JSON,'} $nestedAggFields: JSON) {
2276
2229
  _aggregation {
2277
- ${type} ( ${gqlFilter ?? 'filter: $filter, filterSelf: false,'} nestedAggFields: $nestedAggFields, accessibility: ${accessibility}) {
2230
+ ${type} ( ${filters ?? 'filter: $filter, filterSelf: false,'} nestedAggFields: $nestedAggFields, accessibility: ${accessibility}) {
2278
2231
  _totalCounts
2279
2232
  ${nestedHistogramQueryStrForEachField(mainField, numericAggAsText)}
2280
2233
  }`;
2281
2234
  return {
2282
2235
  query: query,
2283
2236
  variables: {
2284
- ...gqlFilter && {
2285
- filter: convertFilterSetToGqlFilter(gqlFilter)
2237
+ ...filters && {
2238
+ filter: convertFilterSetToGqlFilter(filters)
2286
2239
  },
2287
2240
  nestedAggFields: nestedAggFields
2288
2241
  }
@@ -2290,12 +2243,15 @@ const useGetStatus = ()=>{
2290
2243
  },
2291
2244
  transformResponse: (response, _meta, args)=>{
2292
2245
  return processHistogramResponse(response?.data?._aggregation[args.type] ?? {});
2293
- }
2246
+ },
2247
+ providesTags: [
2248
+ 'AGGS'
2249
+ ]
2294
2250
  }),
2295
2251
  getCounts: builder.query({
2296
- query: ({ type, filters, accessibility = Accessibility.ALL })=>{
2252
+ query: ({ type, filters, accessibility = Accessibility.ALL, queryId = undefined })=>{
2297
2253
  const gqlFilters = convertFilterSetToGqlFilter(filters);
2298
- const queryLine = `query totalCounts ${gqlFilters ? '($filter: JSON)' : ''}{`;
2254
+ const queryLine = `query totalCounts${queryId ? `_${queryId}` : ''} ${gqlFilters ? '($filter: JSON)' : ''}{`;
2299
2255
  const typeAggsLine = `${type} ${gqlFilters ? '(filter: $filter, ' : '('} accessibility: ${accessibility}) {`;
2300
2256
  const query = `${queryLine} _aggregation {
2301
2257
  ${typeAggsLine}
@@ -2320,7 +2276,10 @@ const useGetStatus = ()=>{
2320
2276
  throw new Error(`Invalid response: Missing expected key '${args.type}' in _aggregation`);
2321
2277
  }
2322
2278
  return response.data._aggregation[args.type]._totalCount ?? 0;
2323
- }
2279
+ },
2280
+ providesTags: [
2281
+ 'COUNTS'
2282
+ ]
2324
2283
  }),
2325
2284
  getFieldCountSummary: builder.query({
2326
2285
  query: ({ type, field, filters, accessibility = Accessibility.ALL })=>{
@@ -2383,8 +2342,6 @@ const useGetStatus = ()=>{
2383
2342
  })
2384
2343
  })
2385
2344
  });
2386
- // query for aggregate data
2387
- // convert the function below to typescript
2388
2345
  const histogramQueryStrForEachField = (field)=>{
2389
2346
  const splittedFieldArray = field.split('.');
2390
2347
  const splittedField = splittedFieldArray.shift();
@@ -2467,9 +2424,9 @@ const useGetIndexFields = (index)=>{
2467
2424
  const { data } = useGetFieldsForIndexQuery(index);
2468
2425
  return data ?? [];
2469
2426
  };
2470
- const buildGetAggregationQuery = (type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false)=>{
2427
+ const buildGetAggregationQuery = (type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false, queryId = undefined)=>{
2471
2428
  const queryStart = isFilterEmpty(filters) ? `
2472
- query getAggs {
2429
+ query getAggs${queryId ? `_${queryId}` : ''} {
2473
2430
  _aggregation {
2474
2431
  ${type} (accessibility: ${accessibility}) {` : `query getAggs ($filter: JSON) {
2475
2432
  _aggregation {
@@ -2488,11 +2445,11 @@ const buildGetAggregationQuery = (type, fields, filters, accessibility = Accessi
2488
2445
  };
2489
2446
  return queryBody;
2490
2447
  };
2491
- const buildGetStatsAggregationQuery = (type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false)=>{
2448
+ const buildGetStatsAggregationQuery = (type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false, queryId = undefined)=>{
2492
2449
  const queryStart = isFilterEmpty(filters) ? `
2493
- query getAggs {
2450
+ query getStatsAggs${queryId ? `_${queryId}` : ''} {
2494
2451
  _aggregation {
2495
- ${type} (accessibility: ${accessibility}) {` : `query getAggs ($filter: JSON) {
2452
+ ${type} (accessibility: ${accessibility}) {` : `query getStatsAggs${queryId ? `_${queryId}` : ''} ($filter: JSON) {
2496
2453
  _aggregation {
2497
2454
  ${type} (filter: $filter, filterSelf: ${filterSelf ? 'true' : 'false'}, accessibility: ${accessibility}) { _totalCount`;
2498
2455
  const query = `${queryStart}
@@ -2508,49 +2465,29 @@ const buildGetStatsAggregationQuery = (type, fields, filters, accessibility = Ac
2508
2465
  };
2509
2466
  return queryBody;
2510
2467
  };
2511
- const { useGetRawDataAndTotalCountsQuery, useGetAccessibleDataQuery, useGetAllFieldsForTypeQuery, useGetAggsQuery, useGetAggsNoFilterSelfQuery, useLazyGetAggsQuery, useLazyGetAggsNoFilterSelfQuery, useGetStatsAggregationsQuery, useLazyGetStatsAggregationsQuery, useGetSubAggsQuery, useGetCountsQuery, useGetFieldCountSummaryQuery, useGetFieldsForIndexQuery, useGetSharedFieldsForIndexQuery, useGeneralGQLQuery, useLazyGeneralGQLQuery } = explorerApi;
2468
+ const { useGetRawDataAndTotalCountsQuery, useGetAccessibleDataQuery, useGetAllFieldsForTypeQuery, useGetAggsQuery, useLazyGetAggsQuery, useGetStatsAggregationsQuery, useLazyGetStatsAggregationsQuery, useGetSubAggsQuery, useGetCountsQuery, useLazyGetCountsQuery, useGetFieldCountSummaryQuery, useGetFieldsForIndexQuery, useGetSharedFieldsForIndexQuery, useGeneralGQLQuery, useLazyGeneralGQLQuery } = explorerApi;
2512
2469
 
2513
- const isPayloadActionWithObject = (action)=>{
2514
- return typeof action === 'object' && action !== null && 'type' in action && 'payload' in action && typeof action.payload === 'object';
2515
- };
2516
2470
  /**
2517
2471
  * Defines coreListeners for adding middleware.
2518
2472
  * used to update the current Cohort Case count
2519
2473
  */ const coreStoreListenerMiddleware = toolkit.createListenerMiddleware();
2520
2474
  const startCoreListening = coreStoreListenerMiddleware.startListening;
2521
- startCoreListening({
2522
- matcher: toolkit.isAnyOf(updateCohortFilter, removeCohortFilter, clearCohortFilters),
2523
- effect: async (_, listenerApi)=>{
2524
- const currentCohortId = selectCurrentCohortId(listenerApi.getState());
2525
- // need to pass the current cohort id to the case count fetcher because it is possible that
2526
- // the current cohort will be different when the fetch is fulfilled
2527
- if (currentCohortId) console.log('currentCohortId', currentCohortId);
2528
- }
2529
- });
2530
- startCoreListening({
2531
- matcher: toolkit.isAnyOf(explorerApi.endpoints.getAggs.matchFulfilled),
2532
- effect: async (action, listenerApi)=>{
2533
- if (isPayloadActionWithObject(action)) {
2534
- const root = action.payload;
2535
- const counts = root?._totalCount.reduce((acc, curr)=>{
2536
- const { key, count } = curr;
2537
- acc[key] = count;
2538
- return acc;
2539
- }, {});
2540
- if (counts) {
2541
- listenerApi.dispatch(updateCohortCounts(counts ?? {}));
2542
- }
2543
- }
2544
- }
2545
- });
2546
- startCoreListening({
2475
+ /**
2476
+ * When a getCounts is requested, it might be for a cohort.
2477
+ * If so, then update the cohort's counts for that index
2478
+ */ startCoreListening({
2547
2479
  matcher: toolkit.isAnyOf(explorerApi.endpoints.getCounts.matchFulfilled),
2548
2480
  effect: async (action, listenerApi)=>{
2549
2481
  const counts = action.payload;
2550
- const index = action?.meta?.arg?.originalArgs?.index;
2551
- if (index) listenerApi.dispatch(updateCohortCounts({
2552
- [index]: counts
2553
- }));
2482
+ const index = action?.meta?.arg?.originalArgs?.type; // note this is the guppy index name
2483
+ const cohortId = action?.meta?.arg?.originalArgs?.queryId;
2484
+ if (cohortId && index) {
2485
+ listenerApi.dispatch(updateCohortIndexCountById({
2486
+ index,
2487
+ cohortId,
2488
+ counts
2489
+ }));
2490
+ }
2554
2491
  }
2555
2492
  });
2556
2493
 
@@ -3459,6 +3396,81 @@ class CohortStorage {
3459
3396
  }
3460
3397
  }
3461
3398
 
3399
+ const { selectAll: selectAllCohorts, selectTotal: selectTotalCohorts, selectById: selectCohortById, selectIds: selectCohortIds } = cohortsAdapter.getSelectors((state)=>state.cohorts.cohortManager);
3400
+ /**
3401
+ * Internally used selector for the exported selectora
3402
+ * @param state
3403
+ */ const getCurrentCohortFromCoreState = (state)=>{
3404
+ return state.cohorts.cohortManager.currentCohortId;
3405
+ };
3406
+ const selectCohortFilters = (state)=>{
3407
+ const currentCohortId = getCurrentCohortFromCoreState(state);
3408
+ return state.cohorts.cohortManager.entities[currentCohortId]?.filters;
3409
+ };
3410
+ const selectCurrentCohortFilters = (state)=>{
3411
+ const currentCohortId = getCurrentCohortFromCoreState(state);
3412
+ return state.cohorts.cohortManager.entities[currentCohortId]?.filters;
3413
+ };
3414
+ const selectCurrentCohortId = (state)=>{
3415
+ return state.cohorts.cohortManager.currentCohortId;
3416
+ };
3417
+ const selectCurrentCohort = (state)=>cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
3418
+ const selectCurrentCohortName = (state)=>cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state)).name;
3419
+ /**
3420
+ * Select a filter by its name from the current cohort. If the filter is not found
3421
+ * returns undefined.
3422
+ * @param state - Core
3423
+ * @param index which cohort index to select from
3424
+ * @param name name of the filter to select
3425
+ */ const selectIndexedFilterByName = (state, index, name)=>{
3426
+ return cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state)).filters[index]?.root[name];
3427
+ };
3428
+ /**
3429
+ * Returns all the cohorts in the state
3430
+ * @param state - the CoreState
3431
+ *
3432
+ * @category Cohort
3433
+ * @category Selectors
3434
+ */ const selectAvailableCohorts = (state)=>cohortSelectors.selectAll(state);
3435
+ /**
3436
+ * Returns if the current cohort is modified
3437
+ * @param state - the CoreState
3438
+ * @category Cohort
3439
+ * @category Selectors
3440
+ * @hidden
3441
+ */ const selectCurrentCohortModified = (state)=>{
3442
+ const cohort = cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
3443
+ return cohort?.modified;
3444
+ };
3445
+ /**
3446
+ * Returns if the current cohort has been saved
3447
+ * @param state - the CoreState
3448
+ * @category Cohort
3449
+ * @category Selectors
3450
+ * @hidden
3451
+ */ const selectCurrentCohortSaved = (state)=>{
3452
+ const cohort = cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
3453
+ return cohort?.saved;
3454
+ };
3455
+ /**
3456
+ * Select a filter by its name from the current cohort. If the filter is not found
3457
+ * returns undefined.
3458
+ * @param state - Core
3459
+ * @param name name of the filter to select
3460
+ */ const selectAvailableCohortByName = (state, name)=>cohortSelectors.selectAll(state).find((cohort)=>cohort.name === name);
3461
+ /**
3462
+ * Select a filter from the index.
3463
+ * returns undefined.
3464
+ * @param state - Core
3465
+ * @param index which cohort index to select from
3466
+ */ const selectIndexFilters = (state, index)=>{
3467
+ const cohort = cohortSelectors.selectById(state, getCurrentCohortFromCoreState(state));
3468
+ if (!cohort) {
3469
+ console.error('No Cohort Defined');
3470
+ }
3471
+ return cohort?.filters?.[index] ?? EmptyFilterSet;
3472
+ };
3473
+
3462
3474
  const isFileItem = (item)=>{
3463
3475
  return item && 'guid' in item;
3464
3476
  };
@@ -5668,6 +5680,7 @@ exports.downloadJSONDataFromGuppy = downloadJSONDataFromGuppy;
5668
5680
  exports.drsHostnamesReducer = drsHostnamesReducer;
5669
5681
  exports.duplicateCohort = duplicateCohort;
5670
5682
  exports.explorerApi = explorerApi;
5683
+ exports.explorerTags = explorerTags;
5671
5684
  exports.extractEnumFilterValue = extractEnumFilterValue;
5672
5685
  exports.extractFieldNameFromFullFieldName = extractFieldNameFromFullFieldName;
5673
5686
  exports.extractFileDatasetsInRecords = extractFileDatasetsInRecords;
@@ -5846,7 +5859,6 @@ exports.useGetAISearchVersionQuery = useGetAISearchVersionQuery;
5846
5859
  exports.useGetAccessibleDataQuery = useGetAccessibleDataQuery;
5847
5860
  exports.useGetActivePayModelQuery = useGetActivePayModelQuery;
5848
5861
  exports.useGetAggMDSQuery = useGetAggMDSQuery;
5849
- exports.useGetAggsNoFilterSelfQuery = useGetAggsNoFilterSelfQuery;
5850
5862
  exports.useGetAggsQuery = useGetAggsQuery;
5851
5863
  exports.useGetAllFieldsForTypeQuery = useGetAllFieldsForTypeQuery;
5852
5864
  exports.useGetArrayTypes = useGetArrayTypes;
@@ -5898,11 +5910,11 @@ exports.useIsUserLoggedIn = useIsUserLoggedIn;
5898
5910
  exports.useLaunchWorkspaceMutation = useLaunchWorkspaceMutation;
5899
5911
  exports.useLazyFetchUserDetailsQuery = useLazyFetchUserDetailsQuery;
5900
5912
  exports.useLazyGeneralGQLQuery = useLazyGeneralGQLQuery;
5901
- exports.useLazyGetAggsNoFilterSelfQuery = useLazyGetAggsNoFilterSelfQuery;
5902
5913
  exports.useLazyGetAggsQuery = useLazyGetAggsQuery;
5903
5914
  exports.useLazyGetAuthzMappingsQuery = useLazyGetAuthzMappingsQuery;
5904
5915
  exports.useLazyGetAuthzResourcesQuery = useLazyGetAuthzResourcesQuery;
5905
5916
  exports.useLazyGetCSRFQuery = useLazyGetCSRFQuery;
5917
+ exports.useLazyGetCountsQuery = useLazyGetCountsQuery;
5906
5918
  exports.useLazyGetCrosswalkDataQuery = useLazyGetCrosswalkDataQuery;
5907
5919
  exports.useLazyGetDownloadQuery = useLazyGetDownloadQuery;
5908
5920
  exports.useLazyGetExternalLoginsQuery = useLazyGetExternalLoginsQuery;