kodexa.platform.client
Module Contents
Classes
A base class for objects that are owned by an organization |
|
Represents a client endpoint |
|
Represents a project resource endpoint |
|
Represents a component endpoint |
|
Represents an entity endpoint |
|
Represents an entities endpoint |
|
Represents the organization endpoint |
|
Represents a page endpoint |
|
Represents a page endpoint |
|
Represents a page endpoint |
|
Represents a page endpoint |
|
Represents a page endpoint |
|
Represents a page endpoint |
|
Represents a page endpoint |
|
Represents a page user endpoint |
|
Represents a page membership endpoint |
|
Represents a page membership endpoint |
|
Represents a page project endpoint |
|
Represents a page endpoint |
|
Represents a page organization endpoint |
|
Represents a page document family endpoint |
|
Represents an organization endpoint |
|
Represents a components endpoint |
|
Represents a component instance endpoint |
|
Represents an assistant endpoint |
|
Represents a project assistants endpoint |
|
Represents a project document stores endpoint |
|
Represents a project taxonomies endpoint |
|
Represents a project stores endpoint |
|
Represents a project data stores endpoint |
|
Represents a project model stores endpoint |
|
Represents a project endpoint |
|
Represents a projects endpoint |
|
Represents a stores endpoint |
|
Represents an extension packs endpoint |
|
Represents a project templates endpoint |
|
Represents a credentials endpoint |
|
Represents a component endpoint |
|
Represents a model runtimes endpoint |
|
Represents a project template endpoint |
|
Represents a pipeline endpoint |
|
Represents a assistant definition endpoint |
|
Represents a pipeline endpoint |
|
Represents a credential endpoint |
|
Represents a component instance endpoint |
|
Represents an assistant definition endpoint |
|
Represents a pipeline endpoint |
|
Represents a model runtime endpoint |
|
Represents an extension pack endpoint |
|
Represents an action endpoint |
|
Represents a taxonomy endpoint |
|
Represents a membership endpoint |
|
Represents a execution endpoint |
|
Represents a user endpoint |
|
Represents a executions endpoint |
|
Represents a memberships endpoint |
|
Represents a users endpoint |
|
Represents a data attribute endpoint |
|
Represents a data object endpoint |
|
Represents a document family endpoint |
|
Represents a store endpoint |
|
Represents a data store endpoint |
|
Represents a document store that can be used to store files and then their related document representations |
|
Represents a model store |
|
Represents a taxonomies endpoint |
|
Functions
|
Process the response from the server |
|
Takes part of an object type (ie. pipeline) and then resolves the object type (pipelines) |
Attributes
- kodexa.platform.client.logger
- kodexa.platform.client.DEFAULT_COLUMNS
- class kodexa.platform.client.OrganizationOwned
Bases:
pydantic.BaseModelA base class for objects that are owned by an organization
- organization :Optional[OrganizationEndpoint]
- set_organization(organization)
Set the organization that this object belongs to :param organization: :return:
- class kodexa.platform.client.ClientEndpoint
Bases:
pydantic_yaml.YamlModelRepresents a client endpoint
- client :Optional[KodexaClient]
- set_client(client)
Set the client that this endpoint is associated with :param client: The client to set :return: The endpoint
- to_dict()
Convert the client endpoint to a dictionary :return: A dictionary representation of the endpoint
- yaml(**kwargs)
Convert the client endpoint to a yaml string :return: A yaml string representation of the endpoint
- detach()
Detach the client from the endpoint
- class kodexa.platform.client.ProjectResourceEndpoint
Bases:
ClientEndpointRepresents a project resource endpoint
- project :Optional[ProjectEndpoint]
- set_project(project: ProjectEndpoint)
Set the project that this endpoint is associated with
- get_instance_class(object_dict=None) Type[ClientEndpoint]
- print_table(query='*', page=1, pagesize=10, sort=None, filters: List[str] = None, title: str = None)
- create(component)
- get(component_id)
- class kodexa.platform.client.ComponentEndpoint
Bases:
ClientEndpoint,OrganizationOwnedRepresents a component endpoint
- reindex()
Reindex the component :return:
- find_by_slug(slug, version=None) Optional[Type[pydantic.BaseModel]]
Find a component by slug :param slug: :param version: :return:
- print_table(query='*', page=1, pagesize=10, sort=None, filters: List[str] = None, title: str = None)
- create(component)
- get_by_slug(slug, version=None)
- class kodexa.platform.client.EntityEndpoint
Bases:
kodexa.model.base.BaseEntity,ClientEndpointRepresents an entity endpoint
- reload()
Reload the entity :return:
- create()
Create the entity :return:
- update()
Update the entity :return:
- delete()
Delete the entity :return:
- class kodexa.platform.client.EntitiesEndpoint(client: KodexaClient, organization: OrganizationEndpoint = None)
Represents an entities endpoint
- print_table(query='*', page=1, pagesize=10, sort=None, filters: List[str] = None, title: str = None)
- find_by_organization(organization: kodexa.model.objects.Organization) kodexa.model.objects.PageProject
Find projects by organization
- get(entity_id: str) EntityEndpoint
Get an entity by id
- create(new_entity: EntityEndpoint) EntityEndpoint
Create an entity
- class kodexa.platform.client.OrganizationsEndpoint(client: KodexaClient, organization: OrganizationEndpoint = None)
Bases:
EntitiesEndpointRepresents the organization endpoint
- find_by_slug(slug) Optional[OrganizationEndpoint]
Find an organization by slug :param slug: :return:
- class kodexa.platform.client.PageEndpoint
Bases:
ClientEndpointRepresents a page endpoint
- to_df()
Convert the page to a dataframe :return:
- get(index: int) ComponentInstanceEndpoint
Get a component by index :param index: :return:
- set_client(client)
Set the client for the page :param client: :return:
- to_endpoints()
Convert the page to endpoints :return:
- class kodexa.platform.client.PageTaxonomyEndpoint
Bases:
kodexa.model.objects.PageTaxonomy,PageEndpointRepresents a page endpoint
- class kodexa.platform.client.PageStoreEndpoint
Bases:
kodexa.model.objects.PageStore,PageEndpointRepresents a page endpoint
- class kodexa.platform.client.PageModelRuntimeEndpoint
Bases:
kodexa.model.objects.PageStore,PageEndpointRepresents a page endpoint
- class kodexa.platform.client.PageExtensionPackEndpoint
Bases:
kodexa.model.objects.PageExtensionPack,PageEndpointRepresents a page endpoint
- class kodexa.platform.client.PageAssistantDefinitionEndpoint
Bases:
kodexa.model.objects.PageAssistantDefinition,PageEndpointRepresents a page endpoint
- class kodexa.platform.client.PageCredentialEndpoint
Bases:
kodexa.model.objects.PageCredential,PageEndpointRepresents a page endpoint
- class kodexa.platform.client.PageUserEndpoint
Bases:
kodexa.model.objects.PageUser,PageEndpointRepresents a page user endpoint
- class kodexa.platform.client.PageMembershipEndpoint
Bases:
kodexa.model.objects.PageMembership,PageEndpointRepresents a page membership endpoint
- class kodexa.platform.client.PageExecutionEndpoint
Bases:
kodexa.model.objects.PageExecution,PageEndpointRepresents a page membership endpoint
- class kodexa.platform.client.PageProjectEndpoint
Bases:
kodexa.model.objects.PageProject,PageEndpointRepresents a page project endpoint
- class kodexa.platform.client.PageProjectTemplateEndpoint
Bases:
kodexa.model.objects.PageProjectTemplate,PageEndpointRepresents a page endpoint
- class kodexa.platform.client.PageOrganizationEndpoint
Bases:
kodexa.model.objects.PageOrganization,PageEndpointRepresents a page organization endpoint
- class kodexa.platform.client.PageDocumentFamilyEndpoint
Bases:
kodexa.model.objects.PageDocumentFamily,PageEndpointRepresents a page document family endpoint
- class kodexa.platform.client.OrganizationEndpoint
Bases:
kodexa.model.objects.Organization,EntityEndpointRepresents an organization endpoint
- property projects ProjectsEndpoint
Get the projects endpoint of the organization
- suspend()
- deploy(component: ComponentEndpoint) ComponentInstanceEndpoint
Deploy a component to the organization
- property model_runtimes ModelRuntimesEndpoint
Get the model runtimes endpoint of the organization
- property extension_packs ExtensionPacksEndpoint
Get the extension packs endpoint of the organization
- property project_templates ProjectTemplatesEndpoint
Get the project templates endpoint of the organization
- property credentials
Get the credentials endpoint of the organization
- property dataForms
- property stores
Get the stores endpoint of the organization
- property taxonomies
Get the taxonomies endpoint of the organization
- class kodexa.platform.client.ComponentsEndpoint(organization: OrganizationEndpoint)
Bases:
ClientEndpointRepresents a components endpoint
- class kodexa.platform.client.ComponentInstanceEndpoint
Bases:
ClientEndpoint,kodexa.model.objects.SlugBasedMetadataRepresents a component instance endpoint
- create()
Create the component instance
- update()
Update the component instance
- delete()
Delete the component instance
- deploy(update=False)
Deploy the component instance
- class kodexa.platform.client.AssistantEndpoint
Bases:
kodexa.model.objects.Assistant,ClientEndpointRepresents an assistant endpoint
- update() AssistantEndpoint
Update the assistant
- delete()
Delete the assistant
- activate()
Activate the assistant
- deactivate()
Deactivate the assistant
- schedule()
Schedule the assistant
- set_stores(stores: List[DocumentStoreEndpoint])
Set the stores of the assistant
- get_stores() List[DocumentStoreEndpoint]
Get the stores of the assistant
- executions() List[kodexa.model.objects.Execution]
Get the executions of the assistant
- class kodexa.platform.client.ProjectAssistantsEndpoint
Bases:
ProjectResourceEndpointRepresents a project assistants endpoint
- class kodexa.platform.client.ProjectDocumentStoresEndpoint
Bases:
ProjectResourceEndpointRepresents a project document stores endpoint
- class kodexa.platform.client.ProjectTaxonomiesEndpoint
Bases:
ProjectResourceEndpointRepresents a project taxonomies endpoint
- class kodexa.platform.client.ProjectStoresEndpoint
Bases:
ProjectResourceEndpointRepresents a project stores endpoint
- class kodexa.platform.client.ProjectDataStoresEndpoint
Bases:
ProjectResourceEndpointRepresents a project data stores endpoint
- class kodexa.platform.client.ProjectModelStoresEndpoint
Bases:
ProjectResourceEndpointRepresents a project model stores endpoint
- class kodexa.platform.client.ProjectEndpoint
Bases:
EntityEndpoint,kodexa.model.objects.ProjectRepresents a project endpoint
- update_resources(stores: List[StoreEndpoint] = None, taxonomies: List[TaxonomyEndpoint] = None) ProjectEndpoint
Update the resources of the project
- property document_stores ProjectDocumentStoresEndpoint
Get the document stores endpoint of the project
- property data_stores ProjectDataStoresEndpoint
Get the data stores endpoint of the project
- property model_stores ProjectModelStoresEndpoint
Get the model stores endpoint of the project
- property taxonomies ProjectTaxonomiesEndpoint
Get the taxonomies endpoint of the project
- property assistants ProjectAssistantsEndpoint
Get the assistants endpoint of the project
- class kodexa.platform.client.ProjectsEndpoint(client: KodexaClient, organization: OrganizationEndpoint = None)
Bases:
EntitiesEndpointRepresents a projects endpoint
- get_instance_class(object_dict=None) Type[pydantic.BaseModel]
Get the instance class of the endpoint
- find_by_name(project_name: str) ProjectEndpoint
Find a project by name
- create(project: kodexa.model.objects.Project, template_ref: str = None) kodexa.model.objects.Project
Create a project
- class kodexa.platform.client.StoresEndpoint
Bases:
ComponentEndpoint,ClientEndpoint,OrganizationOwnedRepresents a stores endpoint
- class kodexa.platform.client.ExtensionPacksEndpoint
Bases:
ComponentEndpoint,ClientEndpoint,OrganizationOwnedRepresents an extension packs endpoint
- get_instance_class(object_dict=None) Type[pydantic.BaseModel]
Get the instance class of the endpoint
- deploy_from_url(extension_pack_url: str, deployment_options: kodexa.model.objects.DeploymentOptions) ExtensionPackEndpoint
Deploy an extension pack from a url
- class kodexa.platform.client.ProjectTemplatesEndpoint
Bases:
ComponentEndpoint,ClientEndpoint,OrganizationOwnedRepresents a project templates endpoint
- class kodexa.platform.client.CredentialsEndpoint
Bases:
ComponentEndpoint,ClientEndpoint,OrganizationOwnedRepresents a credentials endpoint
- class kodexa.platform.client.DataFormsEndpoint
Bases:
ComponentEndpoint,ClientEndpoint,OrganizationOwnedRepresents a component endpoint
- class kodexa.platform.client.ModelRuntimesEndpoint
Bases:
ComponentEndpoint,ClientEndpoint,OrganizationOwnedRepresents a model runtimes endpoint
- class kodexa.platform.client.ProjectTemplateEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.ProjectTemplateRepresents a project template endpoint
- class kodexa.platform.client.PipelinesEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.CredentialRepresents a pipeline endpoint
- class kodexa.platform.client.AssistantDefinitionsEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.CredentialRepresents a assistant definition endpoint
- class kodexa.platform.client.ActionsEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.CredentialRepresents a pipeline endpoint
- class kodexa.platform.client.CredentialEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.CredentialRepresents a credential endpoint
- class kodexa.platform.client.DataFormEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.DataFormRepresents a component instance endpoint
- class kodexa.platform.client.AssistantDefinitionEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.AssistantDefinitionRepresents an assistant definition endpoint
- class kodexa.platform.client.PipelineEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.PipelineRepresents a pipeline endpoint
- class kodexa.platform.client.ModelRuntimeEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.ModelRuntimeRepresents a model runtime endpoint
- class kodexa.platform.client.ExtensionPackEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.ExtensionPackRepresents an extension pack endpoint
- class kodexa.platform.client.ActionEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.ActionRepresents an action endpoint
- class kodexa.platform.client.TaxonomyEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.TaxonomyRepresents a taxonomy endpoint
- get_group_taxons() List[kodexa.model.objects.Taxon]
Get the group taxons of the taxonomy
- find_taxon(taxons, parts, use_label=False)
Find a taxon in the taxonomy by its parts
- find_taxon_by_label_path(label_path: str) kodexa.model.objects.Taxon
Find a taxon in the taxonomy by its label path
- find_taxon_by_path(path: str) kodexa.model.objects.Taxon
Find a taxon in the taxonomy by its path
- class kodexa.platform.client.MembershipEndpoint
Bases:
kodexa.model.objects.Membership,EntityEndpointRepresents a membership endpoint
- class kodexa.platform.client.ExecutionEndpoint
Bases:
kodexa.model.objects.Execution,EntityEndpointRepresents a execution endpoint
- class kodexa.platform.client.UserEndpoint
Bases:
kodexa.model.objects.User,EntityEndpointRepresents a user endpoint
- activate() UserEndpoint
Activate the user
- deactivate() UserEndpoint
Deactivate the user
- set_password(password: str, reset_token) UserEndpoint
Set the password of the user
- get_memberships() List[MembershipEndpoint]
Get the memberships of the user
- class kodexa.platform.client.ExecutionsEndpoint(client: KodexaClient, organization: OrganizationEndpoint = None)
Bases:
EntitiesEndpointRepresents a executions endpoint
- class kodexa.platform.client.MembershipsEndpoint(client: KodexaClient, organization: OrganizationEndpoint = None)
Bases:
EntitiesEndpointRepresents a memberships endpoint
- class kodexa.platform.client.UsersEndpoint(client: KodexaClient, organization: OrganizationEndpoint = None)
Bases:
EntitiesEndpointRepresents a users endpoint
- class kodexa.platform.client.DataAttributeEndpoint
Bases:
kodexa.model.objects.DataAttribute,ClientEndpointRepresents a data attribute endpoint
- data_object :kodexa.model.objects.DataObject
- set_data_object(data_object: kodexa.model.objects.DataObject)
Set the data object of the data attribute
- property notes kodexa.model.objects.PageNote
Get the notes of the data attribute
- class kodexa.platform.client.DataObjectEndpoint
Bases:
kodexa.model.objects.DataObject,ClientEndpointRepresents a data object endpoint
- update()
Update the data object
- delete()
Delete the data object
- property attributes List[DataAttributeEndpoint]
Get the attributes of the data object
- class kodexa.platform.client.DocumentFamilyEndpoint
Bases:
kodexa.model.objects.DocumentFamily,ClientEndpointRepresents a document family endpoint
- update()
Update the document family
- update_document(document: kodexa.model.Document, content_object: Optional[kodexa.model.objects.ContentObject] = None)
Update a document in the document family
- wait_for(mixin: Optional[str] = None, label: Optional[str] = None, timeout: int = 60) DocumentFamilyEndpoint
Wait for the document family to be ready
- delete()
Delete the document family
- get_document(content_object: Optional[kodexa.model.objects.ContentObject] = None) kodexa.model.Document
Get the document of the document family
- reprocess(assistant: kodexa.model.objects.Assistant)
Reprocess the document family
- add_document(document: kodexa.model.Document, content_object: Optional[kodexa.model.objects.ContentObject] = None)
Add a document to the document family
- replace_tags(document: kodexa.model.Document, content_object: Optional[kodexa.model.objects.ContentObject] = None)
Replace the tags of the document family
- class kodexa.platform.client.StoreEndpoint
Bases:
ComponentInstanceEndpoint,kodexa.model.objects.StoreRepresents a store endpoint
- set_metadata(metadata)
- reindex()
Reindex the store
- update_metadata()
Update the metadata of the store
- get_metadata()
Get the metadata of the store
- class kodexa.platform.client.DataStoreEndpoint
Bases:
StoreEndpointRepresents a data store endpoint
- get_data_objects_export(document_family: Optional[kodexa.model.objects.DocumentFamily] = None, output_format: str = 'json', path: Optional[str] = None, root_name: str = '', friendly_names=True) str
Get the data objects export of the store
- get_taxonomies() List[kodexa.model.Taxonomy]
Get the taxonomies of the store
- get_data_objects_df(path: str, query: str = '*', document_family: Optional[kodexa.model.objects.DocumentFamily] = None, include_id: bool = False)
Get the data objects as a pandas dataframe
- Parameters
path (str) – The path to the data object
document_family (Optional[DocumentFamily) – Optionally the document family to limit results to
include_id (Optional[bool]) – Include the data object ID as a column (defaults to False)
Returns:
- get_data_objects(path: str, query: str = '*', document_family: Optional[kodexa.model.objects.DocumentFamily] = None) List[DataObjectEndpoint]
Get the data objects of the store :param path: The path to the data object :type path: str :param query: A query to limit the results (Default *) :type query: str :param document_family: Optionally the document family to limit results to :type document_family: Optional[DocumentFamily
Returns:
- get_data_objects_page_request(path: str, page_number: int = 1, page_size=5000, query='*', document_family: Optional[kodexa.model.objects.DocumentFamily] = None) kodexa.model.objects.PageDataObject
Get a page of data objects
- Parameters
Returns:
- create_data_objects(data_objects: List[kodexa.model.objects.DataObject]) List[DataObjectEndpoint]
Create data objects in the store
- Parameters
data_objects – A list of data objects that you want to create
Returns:
- class kodexa.platform.client.DocumentStoreEndpoint
Bases:
StoreEndpointRepresents a document store that can be used to store files and then their related document representations
- delete_by_path(object_path: str)
Delete the content stored in the store at the given path
- Parameters
object_path – str the path to the document family (ie. Invoice.pdf)
- import_family(file_path: str)
Import a document family from a file
- Parameters
file_path (str) – The path to the file
- upload_file(file_path: str, object_path: Optional[str] = None, replace=False, additional_metadata: Optional[dict] = None)
Upload a file to the store :param file_path: The path to the file :type file_path: str :param object_path: The path to the object (Default is the same the file path) :type object_path: Optional[str] :param replace: Replace the file if it already exists (Default False) :type replace: bool :param additional_metadata: Additional metadata to add to the file (Default None) :type additional_metadata: Optional[dict]
- upload_bytes(path: str, content, replace=False, additional_metadata: Optional[dict] = None) DocumentFamilyEndpoint
Put the content into the store at the given path
- Parameters
path – The path you wish to put the content at
content – The content for that object
replace – Replace the content if it exists
additional_metadata – Additional metadata to store with the document (not it can’t include ‘path’)
- Returns
the document family that was created
- get_bytes(object_path: str)
Get the bytes for the object at the given path, will return None if there is no object there
- Parameters
object_path – the object path
object_path – str:
- Returns
the bytes or None is nothing is at the path
- list_contents() List[str]
List the contents of the store
- Returns
A list of the contents of the store
- download_document_families(output_dir: str)
Download all the document families in the store to the given directory
- get_family(document_family_id: str) DocumentFamilyEndpoint
Get the document family with the given id
- query(query: str = '*', page: int = 1, page_size: int = 100, sort=None) PageDocumentFamilyEndpoint
- upload_document(path: str, document: kodexa.model.Document) DocumentFamilyEndpoint
Upload a document to the store at the given path
- get_by_path(path: str) DocumentFamilyEndpoint
Get the document family at the given path
- class kodexa.platform.client.ModelStoreEndpoint
Bases:
DocumentStoreEndpointRepresents a model store
- IMPLEMENTATION_PREFIX = model_implementation/
- TRAINED_MODELS_PREFIX = trained_models/
- upload_trained_model(training_run_id: str, base_path: Optional[str] = None)
Upload a trained model to the store
- download_trained_model(training_run_id: str, download_path: Optional[str] = '')
Download a trained model from the store
- download_implementation(download_path: Optional[str] = '')
Download the implementation from the store
- upload_implementation(metadata)
Upload the implementation to the store
- upload_contents(metadata)
Upload the contents of the metadata to the store
- class kodexa.platform.client.TaxonomiesEndpoint
Bases:
ComponentEndpoint,ClientEndpoint,OrganizationOwnedRepresents a taxonomies endpoint
- kodexa.platform.client.process_response(response) requests.Response
Process the response from the server
- kodexa.platform.client.OBJECT_TYPES
- kodexa.platform.client.resolve_object_type(obj_type)
Takes part of an object type (ie. pipeline) and then resolves the object type (pipelines)
- Parameters
obj_type – part of the object type
- Returns
The object type dict (if found)
- class kodexa.platform.client.KodexaClient(url=None, access_token=None)
- static login(url, email, password)
- property me
- property platform kodexa.model.objects.PlatformOverview
- reindex()
- __build_object(ref, object_type_metadata)
- get_platform()
- get(url, params=None) requests.Response
- post(url, body=None, data=None, files=None, params=None) requests.Response
- put(url, body=None, data=None, files=None, params=None) requests.Response
- delete(url, params=None) requests.Response
- get_url(url)
- export_project(project: ProjectEndpoint, export_path: str)
- import_project(organization: OrganizationEndpoint, import_path: str)
- deserialize(component_dict: dict, component_type: Optional[str] = None) ComponentInstanceEndpoint
- get_project(project_id) ProjectEndpoint
- get_object_type(object_type, organization: Optional[OrganizationEndpoint] = None) ClientEndpoint