Files
OpenBB/website/content/platform/developer_guide/standardization.mdx
Danglewood 3a8a71dd15 [Docs] Refactor Docs Pages For Diataxis (#6315)
* This change creates a PR

* start moving stuff around

* data_models/_category_.json

* reference/_category_.json

* moving some stuff around

* Introduction

* Documentation updates

* few broken links, clean up sidebar titles for how-to

* codespell

* quickstart - new provider extension

* add a comment

* map provider interface

* quickstart for new router extension

* [Docs] diataxis refactor refactor (#6425)

* Start refactor

* Edits

* [DOCS] Reorganize and edit. Fix sidebar navigation (#6445)

* Reorganize and edit. Fix sidebar navigation

* Fix broken linkages

* Edit

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Fix links

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Fix broken links

* Reword CLA part in the Licensing FAQ

* change titles and order suggestion - cc @IgorWounds @piiq

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
Co-authored-by: hjoaquim <henriquecjoaquim@gmail.com>
2024-05-22 13:50:43 +00:00

60 lines
3.2 KiB
Plaintext
Vendored

---
title: Standardization
sidebar_position: 2
description: Learn about the OpenBB Platform, an open-source solution built by the community. Understand its use via Python interface and REST API, and acquaint yourself with how to build a custom extension or contribute directly to the platform
keywords:
- OpenBB Platform
- Open source
- Python interface
- REST API
- Data integration
- Data standardization
- OpenBB extensions
- openbb-core
- Python package
- High-Level Architecture
- Custom extension
- Contribution
---
import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
<HeadTitle title="Standardization - Development | OpenBB Platform Docs" />
## What Is The Standardization Framework?
The Standardization Framework is a set of tools and guidelines that enable the user to query and obtain data in a consistent way across multiple providers.
Each provider data model should inherit from an already defined [standard](https://docs.openbb.co/platform/data_models) model. All standard models are created and maintained by the OpenBB team.
If a standard model needs to be created, please open a pull request and detail its use.
Standardizing provider query parameters and response data enhances the user experience by overcoming things like:
- Consistent query parameters across all data sources for a function, or type of function.
- Output data that has conformed types, is validated, and will be JSON serializable.
- `NaN`, `NaT`, `"None"`, empty strings, are always returned as `NoneType` (null).
- Transparently defined schemas for the data and query parameters.
- Outputs from multiple sources are comparable with each other and easily interchanged.
The standard models are all defined in the `/OpenBBTerminal/openbb_platform/core/openbb_core/provider/standard_models/` [directory](https://github.com/OpenBB-finance/OpenBBTerminal/tree/main/openbb_platform/core/openbb_core/provider/standard_models).
### What Is A Standard Model?
Every standard model consists of two classes, with each being a Pydantic model.
- [`QueryParams`](https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/openbb_platform/core/openbb_core/provider/abstract/query_params.py)
- [`Data`](https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/openbb_platform/core/openbb_core/provider/abstract/data.py)
Any parameter or field can be assigned a custom `field_validator`, or the entire model can be passed through a `model_validator` on creation.
### Caveats
The standardization framework is a very powerful tool, but it has some caveats that you should be aware of:
- We standardize fields and parameters that are shared between multiple providers.
- In some cases, it can be undesirable to define common items in the standard model. In this event, we still want consistent names and descriptions.
- When mapping the column names from a provider-specific model to the standard model, the CamelCase to snake_case conversion is done automatically. If the column names are not the same, you'll need to manually map them.
- e.g., `__alias_dict__ = {"o": "open"}`
- The standard models are created and maintained by the OpenBB team. If you want to add or modify a field within a standard model, you'll need to open a PR to the OpenBB Platform.