vortexasdk.endpoints.products

Try me out in your browser:

Binder

Products

Products(self)

Products endpoint.

load_all

Products.load_all()

Load all products.

search

Products.search(
  term: typing.Union[str, typing.List[str], NoneType] = None,
  ids: typing.Union[str, typing.List[str], NoneType] = None,
  product_parent: typing.Union[str, typing.List[str], NoneType] = None,
  exact_term_match: bool = False,
  filter_layer: typing.Optional[str] = None)

Find all products matching given search terms.

Arguments

  • term: The name(s) (or partial name(s)) of a product we'd like to search

    ids: ID or IDs of products we'd like to search

    product_parent: ID, or list of IDs of the immediate product parent. E.g. product_parent ='12345' will return all children of product 12345.

    exact_term_match: By default, the SDK returns all products which name includes the search term. For example, searching for "Gasoil" will return results including "Gasoil", "Gasoil 0.4pc", "Gasoil 500ppm" etc. Setting exact_search_match to true ensure that only exact term matches are returned, ie just "Gasoil" in this case.

    filter_layer: Must be one of product types ['group', 'group_product', 'category', 'grade'].

Returns

List of products matching the search arguments.

Examples

Let's look for products with in one of ['diesel', 'fuel oil', 'grane'] their name, or related names.

>>> from vortexasdk import Products
>>> df = Products().search(term=['diesel', 'fuel oil', 'grane']).to_df('all')

Returns

id name layer.0 leaf parent.0.name parent.0.layer.0 parent.0.id meta.api_min meta.api_max ref_type meta.sulphur_min meta.sulphur_max
0 1c107b4317bc2c8... Fuel Oil category False Dirty products product 5de0b00094e0fd... 12.8878 12.8878 product nan nan
1 fddedd17e02507f... Grane grade True Medium-Sour subproduct_group a7e26956fbb917... 29.2955 29.2955 product 0.62 0.62
2 deda35eb9ca56b5... Diesel/Gasoil category False Clean products product b68cbb7746f8b9... 35.9556 35.9556 product nan nan

Further Documentation

VortexaAPI Product Reference

reference

Products.reference(id: str)

Perform a product lookup.

Arguments

  • id: Product ID to lookup

Returns

Product record matching the ID

Further Documentation:

VortexaAPI Product Reference

vortexasdk.endpoints.products_result

ProductResult

ProductResult(*, records: typing.List,
              reference: typing.Dict[str, typing.Any])

Container class that holds the result obtained from calling the Product endpoint.

model_config

to_list

ProductResult.to_list()

Represent products as a list.

to_df

ProductResult.to_df(
    columns:
    typing.Union[typing_extensions.Literal['all'], typing.List[str], NoneType] = ['id', 'name', 'layer.0', 'parent.0.name']
)

Represent products as a pd.DataFrame.

Arguments

  • columns: The product features we want in the dataframe. Enter columns='all' to include all features. Defaults to columns = ['id', 'name', 'layer.0', 'parent.0.name'].

Returns

pd.DataFrame of products.