graphcast.util
¶
Utility functions for graph operations.
This package provides utility functions for data transformation, standardization, and manipulation in the context of graph database operations.
Key Components
- Transform: Data transformation and standardization
- Date: Date parsing and formatting utilities
- String: String manipulation and standardization
- Dict: Dictionary operations and cleaning
Example
from graphcast.util import standardize, parse_date_standard name = standardize("John. Doe, Smith") date = parse_date_standard("2023-01-01")
parse_date_standard(input_str)
¶
Parse a date string in YYYY-MM-DD format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_str
|
str
|
Date string in YYYY-MM-DD format. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
(year, month, day) as integers. |
Example
parse_date_standard("2023-01-01") (2023, 1, 1)
Source code in graphcast/util/transform.py
standardize(k)
¶
Standardizes a string key by removing periods and splitting.
Handles comma and space-separated strings, normalizing their format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
k
|
str
|
Input string to be standardized. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Cleaned and standardized string. |
Example
standardize("John. Doe, Smith") 'John,Doe,Smith' standardize("John Doe Smith") 'John,Doe,Smith'