omniindex package

Submodules

omniindex.api module

class omniindex.api.OmniIndexClient(server, api_key, unit_name, block_type, user)[source]

Bases: object

Instantiate an Omniindex client object to interact with the Omniindex API.

Parameters:
  • server (str) – The server to connect to. This is the node server for your blockchain, refer to the Omniindex documentation for more information.

  • api_key (str) – The API key to use for authentication.

  • unit_name (str) – The name of the unit to use for the transaction.

  • user (str) – The user to use for the transaction.

  • block_type (str) – The type of block to use for the transaction.

For more information on the client object and elements refer to the OmniIndex Documentation.

get_block_schematic()[source]

Omniindex API call to get the schematic of a block. Before you can do any work with Omniindex you must first get the schematic of the block you want to use. This will return a JSON string containing the schematic of the block. You can then use this schematic to create a block object. This POST method will bring back the schematic of a block that the user has access to

Parameters:
  • method (str) – (hard coded) HTTP request method (POST)

  • url (str) – (hard coded) URL to the Omniindex API endpoint

  • payload (str) – JSON string containing the unit name, server, block type, user and API key.

  • headers (dict) – (hard coded) Content-Type and Accept headers.

  • response (str) – Response from the API call.

Returns:

JSON string containing the block schematic.

Reference to omniindex.api.OmniIndexClient.get_block_schematic().

get_folders(show_protected)[source]

Omniindex API call to get the folders in a block. This POST method will bring back the folders in a block that the user has access to. OmniIndex allows you to save ‘file structure’ to the blockchain. This capability allows you to securely encrypt your critical data as a file system from a variety of tools. We built the Dropblock Add-on for Google Workspace and BigQuery as a perfect implementation of this capability. And it is further enhanced by the ability to redact (partially encrypt) data from within a document into a separate block. (We’ll see more of that later in the documentation. But you can do this from any tool you wish via the API.) Notice the extra key in this JSON object: ‘showProtected’. You must declare ‘true’, or the default value false will be used.

Note

When set ‘true’, the full folder name will be returned in the result set. When set ‘false’, the folder name is redacted. However, you can see that one exists. [case sensitive, default is false]

This API allows an authorized user to view the folder structure of a block they have the required permissions to inspect:

Parameters:
  • method (str) – (hard coded) HTTP request method (POST)

  • url (str) – (hard coded) URL to the Omniindex API endpoint

  • showProtected (str) – str value to show protected folders.

  • payload (str) – JSON string containing the unit name, server, block type, user and API key.

  • headers (dict) – (hard coded) Content-Type and Accept headers.

  • response (str) – Response from the API call.

Returns:

JSON string containing the folders in the block.

Reference to omniindex.api.OmniIndexClient.get_folders().

get_searchchain(show_protected, search_phrase, search_type)[source]

Omniindex API call to search the entire unitname in the blockchain. This POST method will bring back documents in a block that the user has access to. Using showProtected, you can search the entire blockchain for a specific phrase. This is a powerful capability that allows you to search for documents that contain a specific phrase including redacted data. Using searchType, you can search for a specific type of search, either of just the document contents or of the titles, filenames and contents. With this API Call, we can return datasets using familiar, natural language search techniques of the encrypted data on the blockchain.

Note

This is an API call that demonstrates the power of OmniIndex. In this result set, you can see that the document is redacted. However, the search phrase is still visible. This is a powerful capability that allows you to search for documents that contain a specific phrase including redacted data without ever needing to decrypt the data. As well as that you can see the sentiment analysis of the document as well as the context (as analysed against the machine learning (narrow AI) ontology)

Parameters:
  • show_protected (str) – “true” or “false” (default is “false”) sets if the search will include redacted content.

  • search_phrase (str) – a string to search for.

  • search_type (str) – “fulltext” or “files” (default is “fulltext”) FullText will search the file names, folder names, content, and dates, while files will only search within the content of the files:

  • method (str) – (hard coded) HTTP request method (POST)

  • url (str) – (hard coded) URL to the Omniindex API endpoint

  • payload (str) – JSON string containing the unit name, server, block type, user and API key.

  • headers (dict) – (hard coded) Content-Type and Accept headers.

  • response (str) – Response from the API call.

Returns:

JSON string containing the search results.

reference to omniindex.api.OmniIndexClient.get_searchchain().

getfiles(show_protected, folder_name)[source]

Omniindex API call to get the files in a given folder_name in a block. This POST method will bring back the files in a block that the user has access to. OmniIndex allows you to save ‘file structure’ to the blockchain. This capability allows you to securely encrypt your critical data as a file system from a variety of tools. We built the Dropblock Add-on for Google Workspace and BigQuery as a perfect implementation of this capability. And it is further enhanced by the ability to redact (partially encrypt) data from within a document into a separate block. (We’ll see more of that later in the documentation. But you can do this from any tool you wish via the API.)

Notice the extra key in this JSON object: ‘showProtected’. You must declare ‘true’, or the default value false will be used.

Note

When set ‘true’, the full file name will be returned in the result set. When set ‘false’, the file name is redacted. However, you can see that one exists. [case sensitive, default is false]

This API allows an authorized user to view the files within a folder structure of a block they have the required permissions to inspect:

Parameters:
  • show_protected – “true” or “false” (default is “false”) sets if the search will include redacted content.

  • folder_name (str) – a string to search for.

  • method (str) – (hard coded) HTTP request method (POST)

  • url (str) – (hard coded) URL to the Omniindex API endpoint

  • payload (str) – JSON string containing the unit name, server, block type, user and API key.

  • headers (dict) – (hard coded) Content-Type and Accept headers.

  • response (str) – Response from the API call.

Returns:

JSON string containing the files in the block.

Reference to omniindex.api.OmniIndexClient.getfiles().

post_minedata(key, data)[source]

This POST method will add a block to the chain. This is a very dynamic call, that requires a json object with the data to be sent to the server. As of version 0.1.11, the JSON parser will not allow anything other than a string to be sent to the server. We will be adding INT and FLOAT support in the future.

This object MUST follow the follwing rules: Any object that needs to be encrypted, the key must have the word ‘Encrypt’ added to it. EG: fileContentsEncrypt.

This will ensure that the SDK encrypts the value in all methods available prior to it being sent to a node.

All things OmniIndex, tend to make incredibly complex things, for which we hold multiple patents, very simple indeed. minedata is no exception, indeed it is the poster child for simplicity. To create an OmniIndex Blockchain you simply need to create a master encryption key, declare the unit_name of your choice, a user and their api key / passphrase / password (whatever you want).

Parameters:
  • data (str) – a string of JSON which is merged with the credentials payload to form the new block.

  • method (str) – (hard coded) HTTP request method (POST)

  • url (str) – (hard coded) URL to the Omniindex API endpoint

  • payload (str) – JSON string containing the unit name, server, block type, user and API key.

  • headers (dict) – (hard coded) Content-Type and Accept headers.

  • response (str) – Response from the API call.

  • key (str) – the base encryption key to use for the new block.

Returns:

JSON string containing new block.

Reference to omniindex.api.OmniIndexClient.post_minedata().

run_analytic_query(show_protected, query)[source]

This POST method will run a query on the Blockchain. To use it you are required to know the definition of the blocks that you are querying. If your where syntax includes data that has been encrypted for searching you need to use curly braces around your search string. EG: SELECT X FROM Y where thissearchableowners LIKE ‘%{what am i searching for}%’. The API will then convert this into a searchable ciphered stream.

Unlike standard SQL, there is no need to include the name of the datastore because that is defined by the unitName that we are working with. Similarly, there are no joins in ‘runanalyticquery’, but you can ‘SELECT’, ‘ORDER’, ‘LIMIT’ and set parameters including ‘LIKE’ to return the data that you want to query

Note

when returning ‘data objects’ as opposed to ‘file objects’, these will be base64 encoded and you will need to handle decoding in your own scripts. This is standard practice for all major data store providers

Parameters:
  • show_protected – “true” or “false” (default is “false”) sets if the search will include redacted content.

  • query (str) – a string to search for.

  • method (str) – (hard coded) HTTP request method (POST)

  • url (str) – (hard coded) URL to the Omniindex API endpoint

  • payload (str) – JSON string containing the unit name, server, block type, user and API key.

  • headers (dict) – (hard coded) Content-Type and Accept headers.

  • response (str) – Response from the API call.

Returns:

JSON string containing the matches for the query.

Reference to omniindex.api.OmniIndexClient.run_analytic_query().

Module contents