A Python module to interact with Lariat API to access data quality metrics and diagnostics
Project description
Lariat Python SDK
A Python module to interact with Lariat API and perform various operations like querying indicators, fetching datasets, etc.
Installation
To install the package, run the following command:
pip install lariat_python_sdk
Usage
First, import the necessary components:
from lariat_client import configure, get_raw_datasets, get_datasets, get_indicators, get_indicator, query, Filter, FilterClause
import datetime
Set up your API key and application key:
API_KEY = "your-api-key"
APP_KEY = "your-app-key"
configure(api_key=API_KEY, application_key=APP_KEY)
Get raw datasets:
raw_datasets = get_raw_datasets(dataset_ids=[1, 2, 3])
Get computed datasets:
datasets = get_datasets()
Get indicators:
indicators = get_indicators(datasets=datasets)
Get a specific indicator:
indicator = get_indicator(id=1)
Query an indicator:
from_ts = datetime.datetime(2022, 1, 1)
to_ts = datetime.datetime(2022, 2, 1)
group_by = ["country"]
filter_clause = FilterClause(field="country", operator="in", values=["US", "UK"])
query_filter = Filter(clauses=[filter_clause], operator="and")
results = query(indicator["id"], from_ts, to_ts, group_by, query_filter=query_filter)
# Convert results to a DataFrame
results_df = results.to_df()
# Save results to a CSV file
results.to_csv("results.csv")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for lariat_python_sdk-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7e550f2dc0c7df324740e919e3659c61d0608dd4275435201a28591da56c142 |
|
MD5 | 7a9d89673116007d51dfbc092ffda8a7 |
|
BLAKE2b-256 | 618ac1f04210d4cf4bbc94012aad087e46e4a154979f6dd1a57d633beac33670 |