Helpers
helpers
Module of helper methods for the Kaleidoscope Python Client.
This module provides utility functions for data transformation and other helper tasks. Currently, it includes functionality to map field IDs to human-readable field names.
Functions:
| Name | Description |
|---|---|
export_data |
Transforms data records by mapping field IDs to field names. |
Example
from kalpy.helpers import export_data
# Transform raw data with field IDs to data with field names
processed_data = export_data(client, raw_data)
export_data
Transform a list of data records by mapping field IDs to their corresponding field names.
This function takes raw data records where keys are field IDs and converts them into records where keys are human-readable field names. It uses the KaleidoscopeClient to retrieve field metadata and perform the mapping. If a field ID is not found in the metadata, the original ID is preserved as the key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
KaleidoscopeClient
|
The client instance containing field metadata used to map field IDs to field names. |
required |
data
|
list[dict[str, Any]]
|
A list of records, each represented as a dictionary mapping field IDs to their values. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of transformed records, each represented as a dictionary mapping field names (as keys) to their values. |
Source code in kalpy/helpers.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |