--- title: "Corridor Python Package" description: "How to access object metadata such as id, alias, description, definition, simulations, and dashboard through the corridor Python package." --- The metadata for the objects on the platform can be accessed through `corridor` package which is provided by Corridor. This package can be used from a [Jupyter notebook](/technology/installation/configuration-setup/jupyter/), or any other external application. All the relevant information like `id`, `alias`, `description`, `definition`, `simulations`, `dashboard` is made available. :::note `corridor` package is a python package and can be directly access from python applications. The package, in general, is backward compatible. ::: ## Example The example shows the attributes available for the `Feature` object in `corridor` package. The user can import the `corridor` package in a notebook or a python shell and fetch the metadata. ```console >>> from corridor import Feature >>> help(Feature) Help on class Feature in module corridor._internal.features: class Feature(corridor._internal.util.base_api.ApiBase, corridor._internal.mixins.auditable.Auditable, corridor._internal.mixins.simulatable.Simulatable, corridor._internal.mixins.workflowable.Workflowable, corridor._internal.mixins.searchable.Searchable, corridor._internal.mixins.with_artifact_bundle.WithArtifactBundle) | Feature(alias=None, version=None, id=None) | | Represents a Feature that is registered. | | :param alias: The alias of the Feature to fetch. | :param version: The version of the Feature to fetch. If not provided, the latest approved version is used. | :param id: The ID of the Feature to fetch. | | Example: | >>> dti = Feature('debt_to_income') | >>> dti.name | 'Debt to Income' | >>> dti.version | 1 | >>> dti.is_aggregate | False | | The following properties of the Feature can be accessed: | - name: string | The name of the Feature as registered. | - alias: string | The alias of the Feature as registered. This is the alias used to refer to the Feature | when creating definitions or rules. | - platform_entity: string | The name of the platform entity that this Feature belongs to. | - permissible_purpose: list of string | The list of permissible purpose tags registered to this Feature. | - group: string | The group that this Feature belongs to. | - keywords: list of keywords or None | The keywords for this Feature. | - type: string | The type of the Feature - Numerical, Categorical, etc. | - description: string | The description registered for the Feature. | - version: integer | The version of this Feature. | - is_aggregate: bool | Whether the Feature is an aggregate or not. | - current_status: string | The current workflow status of the Feature. | - definition: string | The definition for the Feature. | - note: string | Any notes added during registration. | - id: integer | The ID that is unique to every Feature. (and is different for every version fo the Feature too.) | - parent_id: integer | Id of the parent feature. Multiple versions of a feature have same parent id. | - colname: string | The unique column name associated to this element - for internal purposes. | - created_by: string | The username of the user that created the Feature. | - created_date: datetime | The date that this Feature was created. | - approval_histories: list of ApprovalHistory objects | The list of approval histories for this Feature. | - approval_workflow: ApprovalWorkflow object | The ApprovalWorkflow associated with this Feature. | - approval_statuses: list of ApprovalStatus objects | The list of approval statuses for this Feature. | - table_join_path: dict | The join path(if applicable) from each input datatable to the datatable at the Feature Platform Entity level | Each entry in the dictionary represents a path for one input datatable | print_table_join_path() can be used to print the path in a more user-friendly way | | | The following functions of the Feature can be accessed: | - print_table_join_path(): none | Print table_join_path in a more user-friendly way | - all(): list | Returns a list of filtered Feature objects | Valid filters: status, keyword, permissible_purpose, name, contains, type, alias, group, platform_entity | | Method resolution order: | Feature | corridor._internal.util.base_api.ApiBase | corridor._internal.mixins.auditable.Auditable | corridor._internal.mixins.simulatable.Simulatable | corridor._internal.mixins.workflowable.Workflowable | corridor._internal.mixins.searchable.Searchable | corridor._internal.mixins.with_artifact_bundle.WithArtifactBundle | builtins.object | | Methods defined here: | | __init__(self, alias=None, version=None, id=None) | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) | Return str(self). | | get_versions(self) | | print_table_join_path(self) | | ---------------------------------------------------------------------- | Readonly properties defined here: | | alias | | colname | | elements | Fetch all Features that are approved. | | group | | inputs | | is_aggregate | | keywords | | name | | parent_id | | permissible_purpose | | platform_entity | | table_join_path | Structure of `table_join_path`: dict | {pe_id: [{column_id: , how: } for all the path_cols needed to join from current table to the PE level table]} | | Example: | >>> self._data['externalDefinition']['table_paths_info'] | {'1': [{'how': 'inner', 'pe_id': 1}, | {'column_id': 1, 'how': 'inner'}, | {'column_id': 1, 'how': 'inner'}, | {'column_id': 10, 'how': 'inner'}, | {'column_id': 11, 'how': 'inner'}, | {'column_id': 7, 'how': 'inner'}, | {'column_id': 7, 'how': 'inner'}, | {'how': 'inner', 'pe_id': 2}, | {'how': 'inner', 'pe_id': 2}], | '2': [{'how': 'inner', 'pe_id': 2}]} | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | Job = | Represents a job for the item. | | :param entity: The entity that the Job ran on, can be either entity object or entity id | :param name: The name of the Job to fetch. | :param id: The id of the Job to fetch. | | ---------------------------------------------------------------------- | Methods inherited from corridor._internal.util.base_api.ApiBase: | | __dir__(self) | Default dir() implementation. | | __getattr__(self, key) | | __repr__(self) | Return repr(self). | | __setattr__(self, key, value) | Implement setattr(self, name, value). | | ---------------------------------------------------------------------- | Data descriptors inherited from corridor._internal.util.base_api.ApiBase: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Readonly properties inherited from corridor._internal.mixins.auditable.Auditable: | | created_by | | created_date | | last_modified_by | | last_modified_date | | ---------------------------------------------------------------------- | Methods inherited from corridor._internal.mixins.simulatable.Simulatable: | | get_job(self, name) | | ---------------------------------------------------------------------- | Readonly properties inherited from corridor._internal.mixins.simulatable.Simulatable: | | default_simulation | | jobs | | ---------------------------------------------------------------------- | Readonly properties inherited from corridor._internal.mixins.workflowable.Workflowable: | | approval_histories | | approval_statuses | | approval_workflow | | ---------------------------------------------------------------------- | Class methods inherited from corridor._internal.mixins.searchable.Searchable: | | all(**filters) from builtins.type | Search the platforms using filters | | :param filters: key-value pair of the searching criterion | if no searching criterion applied, all() returns all the objects registered for the class | :return: A list of objects that fit the searching criterion | | Examples(Using DataElement as example, it applies the same for all other searchable Entities): | Returns all the DataElement registered on the platform | >>> DataElement.all() | | Returns all the Draft DataElement registered on the platform | >>> DataElement.all(status='Draft') | | Returns all the Numerical and Categorical DataElements registered on the platform | >>> DataElement.all(type=['Numerical', 'Categorical']) | | Returns all the DataElements registered on the platform that contains the word `annual` | in the name, alias, description etc | >>> DataElement.all(contains='annual') | | Note: if unsure of what are the available filter values, you can input a arbitrary value, | the error message will provide information on the valid values to search for | This can be used for type, status, platform_entity | Example: Search for `status='garbage'` | >>> DataElement.all(status='garbage') | AssertionError: Found invalid filter value(s): {'garbage'} for filter: status. | Expecting filter value to be in {'Draft', 'Rejected', 'Approved', 'Pending Approval', 'Shadow', 'Active'} | | ---------------------------------------------------------------------- | Methods inherited from corridor._internal.mixins.with_artifact_bundle.WithArtifactBundle: | | get_artifact(self) ```