dara-core 1.13.0__py3-none-any.whl → 1.13.1__py3-none-any.whl
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.
- dara/core/interactivity/data_variable.py +7 -0
- dara/core/interactivity/derived_data_variable.py +7 -0
- dara/core/internal/routing.py +2 -0
- dara/core/umd/dara.core.umd.js +241 -372
- {dara_core-1.13.0.dist-info → dara_core-1.13.1.dist-info}/METADATA +25 -10
- {dara_core-1.13.0.dist-info → dara_core-1.13.1.dist-info}/RECORD +9 -9
- {dara_core-1.13.0.dist-info → dara_core-1.13.1.dist-info}/LICENSE +0 -0
- {dara_core-1.13.0.dist-info → dara_core-1.13.1.dist-info}/WHEEL +0 -0
- {dara_core-1.13.0.dist-info → dara_core-1.13.1.dist-info}/entry_points.txt +0 -0
|
@@ -182,6 +182,7 @@ class DataVariable(AnyDataVariable):
|
|
|
182
182
|
store: CacheStore,
|
|
183
183
|
filters: Optional[Union[FilterQuery, dict]] = None,
|
|
184
184
|
pagination: Optional[Pagination] = None,
|
|
185
|
+
format_for_display: bool = False,
|
|
185
186
|
) -> Optional[DataFrame]:
|
|
186
187
|
"""
|
|
187
188
|
Get the value of this DataVariable.
|
|
@@ -212,6 +213,12 @@ class DataVariable(AnyDataVariable):
|
|
|
212
213
|
|
|
213
214
|
if entry.data is not None:
|
|
214
215
|
filtered_data, count = apply_filters(entry.data, coerce_to_filter_query(filters), pagination)
|
|
216
|
+
if format_for_display and filtered_data is not None:
|
|
217
|
+
filtered_data = filtered_data.copy()
|
|
218
|
+
for col in filtered_data.columns:
|
|
219
|
+
if filtered_data[col].dtype == 'object':
|
|
220
|
+
# We need to convert all values to string to avoid issues with displaying data in the Table component, for example when displaying datetime and number objects in the same column
|
|
221
|
+
filtered_data.loc[:, col] = filtered_data[col].apply(str)
|
|
215
222
|
data = filtered_data
|
|
216
223
|
# Store count for given filters and schema
|
|
217
224
|
await asyncio.gather(
|
|
@@ -239,6 +239,7 @@ class DerivedDataVariable(AnyDataVariable, DerivedVariable):
|
|
|
239
239
|
store: CacheStore,
|
|
240
240
|
filters: Optional[Union[FilterQuery, dict]] = None,
|
|
241
241
|
pagination: Optional[Pagination] = None,
|
|
242
|
+
format_for_display: bool = False,
|
|
242
243
|
) -> Union[BaseTask, DataFrame, None]:
|
|
243
244
|
"""
|
|
244
245
|
Get the filtered data from the underlying derived variable stored under the specified cache_key.
|
|
@@ -297,6 +298,12 @@ class DerivedDataVariable(AnyDataVariable, DerivedVariable):
|
|
|
297
298
|
|
|
298
299
|
# Run the filtering
|
|
299
300
|
data = await cls._filter_data(data, count_cache_key, data_entry, store, filters, pagination)
|
|
301
|
+
if format_for_display and data is not None:
|
|
302
|
+
data = data.copy()
|
|
303
|
+
for col in data.columns:
|
|
304
|
+
if data[col].dtype == 'object':
|
|
305
|
+
# We need to convert all values to string to avoid issues with displaying data in the Table component, for example when displaying datetime and number objects in the same column
|
|
306
|
+
data.loc[:, col] = data[col].apply(str)
|
|
300
307
|
|
|
301
308
|
return data
|
|
302
309
|
|
dara/core/internal/routing.py
CHANGED
|
@@ -332,6 +332,7 @@ def create_router(config: Configuration):
|
|
|
332
332
|
store,
|
|
333
333
|
body.filters,
|
|
334
334
|
Pagination(offset=offset, limit=limit, orderBy=order_by, index=index),
|
|
335
|
+
format_for_display=True,
|
|
335
336
|
)
|
|
336
337
|
if isinstance(data, BaseTask):
|
|
337
338
|
await task_mgr.run_task(data, body.ws_channel)
|
|
@@ -342,6 +343,7 @@ def create_router(config: Configuration):
|
|
|
342
343
|
store,
|
|
343
344
|
body.filters,
|
|
344
345
|
Pagination(offset=offset, limit=limit, orderBy=order_by, index=index),
|
|
346
|
+
format_for_display=True,
|
|
345
347
|
)
|
|
346
348
|
|
|
347
349
|
dev_logger.debug(
|