Dependencies for an Entity ========================== .. code-block:: http /api/repositories/{repository}/entities/{entity}/dependencies .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, the name of the :doc:`repository` entity, int, The ID of the entity to view Get ~~~ .. http:get:: /api/repositories/(string:repository)/entities/(int:entityID)/dependencies :synopsis: Lists dependencies of an entity Lists discovered dependencies of the corresponding :doc:`entity` .. code-block:: http GET /api/repositories/test/entities/1/dependencies HTTP/1.1 Accept: application/json .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 400, Bad Request 500, Server error The response will be a :doc:`standard-response`, with a list of dependencies in the corresponding :doc:`entity`. .. _dep_columns_label: Columns ------- The ``columns`` array will contain the list of columns for each data row. .. csv-table:: :header: Human Name, Column Name, Description :widths: 25, 25, 50 "Lh Attrs", "_lhnames", "The attributes that determine the rh attribute" "Rh Attr", "_rhname", "The attribute that is determined by the lh attribute(s)" "Status", "__STATUS", "Whether the dependency is Discovered or Permanent." "Verified", "_verified", "Whether the rule quality has been verified against all rows." "Job", "JOB_ID", "The scheduler job that created this rule." "Quality %", "GOODNESS", "A measure of how well the attributes form a dependency" "Confirming LR Values", "CONFIRMATIONS", "The number of lh values that do determine their rh value." "Conflicting LH Values", "_conflicting_lh_values", "The number of distinct lh values that do not determine their rh value" "Resolved %", "_resolved", "The percentage of conflicting LH Values that have been resolved" "Normalise Flag", "_normalise", "Dependency can be included in a normalisation (1=true, 0=false)" "Conflicting Rows", "_conflicting_rows", "The number of rows where the lh value does not determine their rh value" "Verified Date", "_checked_date", "When the dependency was last verified." "Verified By", "CHECKED_BY", "Who verified the dependency." "Created Date", "_created_date", "When the dependency rule was created." "Created By", "CREATED_BY", "Who created the dependency rule." "Dependency Key", "_fd_key", "Internal key for this dependency" "Rh Attr ID", "RH_ATTR", "Ids of the right hand attributes that form the primary key" "Lh Attr Ids", "LH_ATTRS", "Ids of the left hand attributes that form the primary key" .. _ent_dep_datarow_label: Data Row -------- The ``data row`` array will contain the list of dependencies in the corresponding :doc:`entity`: .. code-block:: json "rows": [ { "dataRow": [ "Account Holder", "Deactivated Date", "Discovered", "Yes", "1", "99.875", "1602", "1", "", "0", "3", "2015/02/12 13:36:48", "bob", "2015/02/12 13:36:48", "bob", "19 14", "19", "14" ], "metadata": { "url": "/api/repositories/test/entities/1/dependencies/19-14/conflicts/" } } If there are no dependencies in the :doc:`entity`, ``rows`` will be an empty string. Post ~~~~ List Dependencies ----------------- .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/dependencies :synopsis: Lists all dependencies of an entity using post. Lists all dependencies of the corresponding :doc:`entity `, allow user to pass in supported options (Paging, Columns, Sorting & Cache) see :doc:`standard-request` for more information on these options. .. code-block:: http POST /api/repositories/{repository}/entities/{entity}/dependencies HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "pageStart": "1", "pageSize": "65" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success 400, Bad Request 500, Server error The request packet must contain the ``command`` element. The ``options`` elements is optional. The response will be a :doc:`standard-response`, with a list of all dependencies in the corresponding :doc:`entity`. The ``columns`` array will contain the list of columns for each data row as listed in above :ref:`columns `. The ``data row`` will contain the list of all dependencies in the corresponding :doc:`entity` similar to ones listed in above :ref:`data row ` .. _create_dependencies: Create ------ .. code-block:: http POST /api/repositories/test/entities/1/dependencies HTTP/1.1 Content-Type: application/json { "command": "create", "data": { "jobName": "Create Dependency", "attributes": { "rhs": "1", "lhs": "2 3 4" }, "scheduleNow":"0", "scheduleTime":"2016-11-22 11:40:45" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 400, Invalid data passed with request 500, Server error The request requires a :doc:`standard-request` packet. Available commands are: .. csv-table:: :header: Command, Description :widths: 30, 70 create, Create dependency The request packet must contain the ``command`` and ``data`` elements. The following fields should be sent as part of ``data``: .. csv-table:: :header: Name, Mandatory, Default Value, Description :widths: 20, 10, 12, 75 jobName, Yes, NA, Name of the create dependency job attributes, Yes, NA, It should contain right hand attribute id and left hand attribute ids. rhs, Yes, NA, Right hand attribute id. lhs, Yes, NA, Left hand attribute ids. scheduleNow, No, NA, Yes (1) / No (0) scheduleTime, No, NA, What time to start. Required: No (if scheduleNow is 1) / Yes (if scheduleNow is 0). If ``scheduleNow`` is 0 and ``scheduleTime`` is not provided, the job will run immediately. ``scheduleNow`` field can be formatted as follows: .. csv-table:: :header: Value, Description :widths: 10, 75 1, Schedule the job immediately 0, Schedule the job at a given date and time (requires ``scheduleTime`` field) ``scheduleTime`` field can be formatted as follows: .. csv-table:: :header: Value, Example :widths: 50, 75 YYYY-Month-DD HH:MM:SS, 2016-JANUARY-01 10:30:45 YYYY/Month/DD HH:MM:SS, 2016/JANUARY/01 10:30:45 YYYY-Mon-DD HH:MM:SS, 2016-JAN-01 10:30:45 YYYY/Mon/DD HH:MM:SS, 2016/JAN/01 10:30:45 YYYY-MM-DD HH:MM:SS, 2016-01-01 10:30:45 YYYY/MM/DD HH:MM:SS, 2016/01/01 10:30:45 The response will contain the URL of the :doc:`scheduled job `. .. code-block:: json "uri": "/api/repositories/test/scheduler/277" .. _discover_dependencies: Discover -------- .. code-block:: http POST /api/repositories/test/entities/1/dependencies HTTP/1.1 Content-Type: application/json { "command": "discover", "data": { "jobName":"restjob1", "firstRow": "1", "sampleSize": "50", "rowsToSample": { "option": "every", "value": "1" }, "consistency": "95", "sparsity": "4", "maxLhs" : "4", "scheduleNow":"0", "scheduleTime":"2016-11-22 11:40:45" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 400, Invalid data passed with request 500, Server error The request requires a :doc:`standard-request` packet. Available commands are: .. csv-table:: :header: Command, Description :widths: 30, 70 discover, Discover dependencies. The request packet must contain the ``command`` and ``data`` elements. The following fields should be sent as part of ``data``: .. csv-table:: :header: Name, Mandatory, Default Value, Description :widths: 10, 10, 12, 75 jobName, Yes, NA, Name of the scheduled dicover dependencies job firstRow, Yes, 1, Start sampling at a given row. The value should be set between 1 and maximum number of rows available. sampleSize, Yes, 1, How many rows to sample? The value should be set between 1 and maximum number of rows available. rowsToSample, Yes, NA, The options provided here are mutually exclusive. Options are explained further below. consistency, Yes, NA, How consistent should your dependencies be in %? The percentage should be between 1 & 100. sparsity, Yes, NA, Which attributes do you want to exclude. Those less then x% distinct? The percentage should be between 1 & 100. maxLhs, Yes, NA, Maximum number of attributes that can form a compound. The value should be between 1 and maximum number of attributes. scheduleNow, No, NA, Yes (1) / No (0) scheduleTime, No, NA, What time to start. Required: No (if scheduleNow is 1) / Yes (if scheduleNow is 0) If ``scheduleNow`` is 0 and ``scheduleTime`` is not provided, the job will run immediately. ``scheduleNow`` field can be formatted as follows: .. csv-table:: :header: Value, Example :widths: 50, 75 YYYY-Month-DD HH:MM:SS, 2016-JANUARY-01 10:30:45 YYYY/Month/DD HH:MM:SS, 2016/JANUARY/01 10:30:45 YYYY-Mon-DD HH:MM:SS, 2016-JAN-01 10:30:45 YYYY/Mon/DD HH:MM:SS, 2016/JAN/01 10:30:45 YYYY-MM-DD HH:MM:SS, 2016-01-01 10:30:45 YYYY/MM/DD HH:MM:SS, 2016/01/01 10:30:45 The ``rowsToSample`` allow one to select which rows to include in sampling. The options for ``rowsToSample`` are detailed below, they are mutually exclusive, hence you can only selected one of the following options: .. csv-table:: :header: Option, Description :widths: 10, 75 every, Which rows to sample? For every row set value to 1. For every 5 rows set value to 5 and so on. randomPercent, Sample random percentage of rows. The percentage should be set between 1 and 100. prevRandomSelection, Re-use previous random selection. This option must only be set to 1 if you have previously sampled rows using 'randomPercent' option. The response will contain the URL of the :doc:`scheduled job `. .. code-block:: json "uri": "/api/repositories/test/scheduler/276" .. _ent_dep_edit_label: Edit Dependencies ----------------- Setting Dependencies as Discovered or Permanent +++++++++++++++++++++++++++++++++++++++++++++++ .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/dependencies/ :synopsis: Set one or more dependencies as discovered/permanent for an entity using post. Set one or more dependencies as discovered/permanent for the corresponding :doc:`entity `. .. code-block:: http POST /api/repositories/{repository}/entities/1/dependencies/discovered HTTP/1.1 Content-Type: application/json { "command": "edit", "data": { "status": "Discovered", "dependencyKeys": ["5 2","6 2","8 2"] } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success (No Content) 400, Bad Request 500, Server error The request packet must contain the ``command`` and ``data`` element. The required fields to set dependencies as permanent or discovered are: + status + dependencyKeys The dependencies can be set as permanent or discovered as follows: + Set ``status`` field to Permanent to make the dependencies permanent + Set ``status`` field to Discovered to make the dependencies discovered + Set ``dependencyKeys`` field to an array containing one or more dependency keys .. _dependencies_delete: Delete ~~~~~~ Deleting single dependency -------------------------- .. http:delete:: /api/repositories/{repository}/entities/{entity}/dependencies/{dependencyKey} :synopsis: Delete the given dependency Delete the given dependency .. code-block:: http DELETE /api/repositories/test/entities/1/dependencies/5-2 HTTP/1.1 .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success 400, Invalid parameters 500, Server error Deleting multiple dependencies ------------------------------ .. http:delete:: /api/repositories/{repository}/entities/{entity}/dependencies/ :synopsis: Delete multiple dependencies Delete multiple dependencies .. code-block:: http DELETE /api/repositories/test/entities/1/dependencies/ HTTP/1.1 Content-Type: application/json { "command": "delete", "data": { "dependencyKeys": ["5 2", "6 2", "8 2"] } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success 400, Invalid parameters 500, Server error The delete packet must contain the ``command`` and ``data`` elements. The following fields should be sent as part of ``data``: .. csv-table:: :widths: 20, 80 :header: Field, Purpose dependencyKeys, A list of dependency keys. .. _ed_export: Export ~~~~~~~ Some or all of the rows may be exported as a scheduled task. .. code-block:: http POST /api/repositories/jupiter/entities/1/dependencies HTTP/1.1 Content-Type: application/json { "command": "export", "data": { "filename": "filename.csv", "filetype": "csv", "encoding": "utf-8" }, "options": { "columns": ["__STATUS", "_verified", "_fd_key"], "where": "Status = 'Discovered'" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 400, Invalid data passed with request 500, Server error The request packet must contain the ``command`` and ``data`` elements. The ``options`` element is not required, but may specify the columns to export, and/or the rows to filter. The following table shows which fields are required in the ``data`` element: .. csv-table:: :header: Field, Required :widths: 20, 10 filename, Y filetype, N encoding, N If ``filetype`` is not specified, it defaults to csv. If ``encoding`` is not specified, it defaults to the server native encoding. The response will contain the URL of the scheduled task and the link to download the exported file. .. code-block:: json { "job": "/api/repositories/jupiter/scheduler/1", "file": "/api/repositories/jupiter/download/filename.csv" } Dependencies for an Attribute ============================= .. code-block:: http /api/repositories/{repository}/entities/{entity}/attributes/{attribute}/dependencies .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, the name of the :doc:`repository` entity, int, The ID of the entity to view attribute, int, The ID of the attribute to view Get ~~~ .. http:get:: /api/repositories/(string:repository)/entities/(int:entityID)/attributes/(int:attributeID)/dependencies :synopsis: Lists all dependencies of an attribute Lists all dependencies of the corresponding :doc:`attribute ` .. code-block:: http GET /api/repositories/test/entities/1/attributes/1/dependencies HTTP/1.1 Accept: application/json .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 400, Bad Request 500, Server error The response will be a :doc:`standard-response`, with a list of all dependencies in the corresponding :doc:`attributes`. Columns ------- The ``columns`` array will contain the list of columns for each data row as listed in above :ref:`columns `. .. _attr_dep_datarow_label: Data Row -------- The ``data row`` will contain the list of dependencies in the corresponding :doc:`attributes`: .. code-block:: json "rows": [ { "dataRow": [ "Line 01", "Line 02", "Permanent", "Yes", "7", "100.000", "50", "", "", "1", "", "2015/03/16 09:22:54", "bob@TEST-7", "2015/03/16 09:22:54", "bob@TEST-7", "2 1", "2", "1" ], "metadata": { "url": "/api/repositories/test/entities/1/attributes/1/dependencies/2-1/conflicts/" } }, { "dataRow": [ "Line 03", "Line 01", "Discovered", "Yes", "1", "98.000", "49", "1", "", "0", "2", "2015/02/05 11:53:02", "bob@TEST-7", "2015/02/05 11:53:02", "bob@TEST-7", "1 3", "1", "3" ], "metadata": { "url": "/api/repositories/test/entities/1/attributes/1/dependencies/1-3/conflicts/" } } ] If there are no dependencies in the :doc:`attributes`, ``rows`` will be an empty string. Post ~~~~ List Dependencies ----------------- .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/attributes/(int:attributeID)/dependencies :synopsis: Lists all dependencies of an attribute using post. Lists all dependencies of the corresponding :doc:`attribute `, allow user to pass in supported options (Paging, Columns, Sorting & Cache) see :doc:`standard-request` for more information on these options. .. code-block:: http POST /api/repositories/{repository}/entities/1/attributes/1/dependencies HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "pageStart": "1", "pageSize": "65" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success 400, Bad Request 500, Server error The request packet must contain the ``command`` element. The ``options`` elements is optional. The response will be a :doc:`standard-response`, with a list of all dependencies in the corresponding :doc:`attributes`. The ``columns`` array will contain the list of columns for each data row as listed in above :ref:`columns `. The ``data row`` will contain the list of all dependencies in the corresponding :doc:`attributes` similar to ones listed in above :ref:`data row ` .. _attr_dep_edit_label: Edit Dependencies ----------------- Setting Dependencies as Discovered or Permanent +++++++++++++++++++++++++++++++++++++++++++++++ .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/attributes/(int:attributeID)/dependencies/ :synopsis: Set one or more dependencies as discovered/permanent for an attribute using post. Set one or more dependencies as discovered/permanent for the corresponding :doc:`attribute `. .. code-block:: http POST /api/repositories/{repository}/entities/1/attributes/5/dependencies/discovered HTTP/1.1 Content-Type: application/json { "command": "edit", "data": { "status": "Discovered", "dependencyKeys": ["5 2","6 2","8 2"] } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success (No Content) 400, Bad Request 500, Server error The request packet must contain the ``command`` and ``data`` element. The required fields to set dependencies as permanent or discovered are: + status + dependencyKeys The dependencies can be set as permanent or discovered as follows: + Set ``status`` field to Permanent to make the dependencies permanent + Set ``status`` field to Discovered to make the dependencies discovered + Set ``dependencyKeys`` field to an array containing one or more dependency keys Delete ~~~~~~ Deleting single dependency -------------------------- .. http:delete:: /api/repositories/{repository}/entities/{entity}/attributes/{attribute}/dependencies/{dependencyKey} :synopsis: Delete the given dependency Delete the given dependency .. code-block:: http DELETE /api/repositories/test/entities/1/attributes/5/dependencies/5-2 HTTP/1.1 .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success 400, Invalid parameters 500, Server error Deleting multiple dependencies ------------------------------ .. http:delete:: /api/repositories/{repository}/entities/{entity}/attributes/{attribute}/dependencies/ :synopsis: Delete multiple dependencies Delete multiple dependencies .. code-block:: http DELETE /api/repositories/test/entities/1/attributes/5/dependencies/ HTTP/1.1 Content-Type: application/json { "command": "delete", "data": { "dependencyKeys": ["5 2", "5 {1 2 3 4}", "5 {6 7}"] } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success 400, Invalid parameters 500, Server error The delete packet must contain the ``command`` and ``data`` elements. The following fields should be sent as part of ``data``: .. csv-table:: :widths: 20, 80 :header: Field, Purpose dependencyKeys, A list of dependency keys.