Skip to content

Models

The DataScribe API uses Pydantic models to provide type-safe data structures for all API responses. All models include:

  • Full type validation: Automatic validation of data types and structure
  • IDE support: Auto-completion and type hints in your editor
  • Serialization: Easy conversion to JSON, dicts, and DataFrames
  • Documentation: Built-in field descriptions and examples

Available Models

Data Table Models

Materials Models

Common Methods

All collection models (DataTables, DataTableRows, DataTableColumns, MaterialSearchResults, MaterialByIdResults) support these methods:

to_dataframe()

Convert the model data to a pandas DataFrame
from datascribe_api import DataScribeClient

client = DataScribeClient()
tables = client.get_data_tables_for_user()

# Convert to DataFrame
df = tables.to_dataframe()
print(df.head())

to_list()

Convert the model data to a list of dictionaries
rows = client.get_data_table(tableName="my_table")

# Convert to list
data = rows.to_list()
for row_dict in data:
    print(row_dict)

Model Serialization

All models support standard Pydantic serialization:

To dictionary
data_dict = model.model_dump()
To JSON string
json_str = model.model_dump_json()
To JSON with indentation
json_pretty = model.model_dump_json(indent=2)
Exclude certain fields
data_dict = model.model_dump(exclude={"user_id"})
Include only certain fields
data_dict = model.model_dump(include={"table_name", "display_name"})