From f8d59698e9dd6fddb7bd2a7014e680b53c89804b Mon Sep 17 00:00:00 2001 From: Sny Date: Thu, 8 Aug 2024 18:15:25 +0530 Subject: [PATCH 1/2] OpenConceptLab/ocl_issues#1912 | Updated Bulk Import GET API documentation --- .../oclapi/apireference/bulkimporting.md | 93 ++++++++++--------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/docs/source/oclapi/apireference/bulkimporting.md b/docs/source/oclapi/apireference/bulkimporting.md index 87b3367..90141d5 100644 --- a/docs/source/oclapi/apireference/bulkimporting.md +++ b/docs/source/oclapi/apireference/bulkimporting.md @@ -303,49 +303,56 @@ To view the final outcome of a previous bulk import, use a GET request to specif GET /importers/bulk-import/?task=:taskid[&result=:format] ``` * GET Request Parameters: - * **task** (Required for GET request) - Task ID of a previously submitted bulk import request - * **result** (Optional) - default="summary"; format of the results to be returned. Options are: - * **summary** -- one line of plain text (see `OclImportResults.get_detailed_summary()`) - * **report** -- longer report of plain text (see `OclImportResults.display_report()`) - * **json** -- full results object serialized to JSON (see `OclImportResults.to_json()`) -_”Summary” example_ -``` -Processed 348 of 348 -- 346 NEW (200:39, 201:307); 1 UPDATE (200:1); 1 DELETE (200:1) -``` - - -_”Report” example_ - - -``` -REPORT OF IMPORT RESULTS: -/orgs/DATIM-MOH-BW-FY19/collections/HTS-TST-N-MOH-HllvX50cXC0/: -NEW 200: -[{"message": "Added the latest versions of concept to the collection. Future updates will not be added automatically.", -"added": true, "expression": -... -``` - - -_”JSON” example_ - - - - -``` -{ - "count": 348, - "elapsed_seconds": 94.10947012901306, - "total_lines": 348, - "num_skipped": 0, - "results": { - "/orgs/DATIM-MOH-BW-FY19/collections/HTS-TST-N-MOH-HllvX50cXC0/": { - "NEW": { - "200": [ - { - "obj_type": "Reference", - "text": "{\"data\": {\"expressions\": [\"/orgs/DATIM-MOH-BW-FY19/sources/DATIM-Alignment-Indicators/mappings/MAP-DATIM-HAS-OPTION-HTS_TST_N_MOH-HllvX50cXC0/\", \"/orgs/PEPFAR/sources/DATIM-MOH-FY19/concepts/HTS_TST_N_MOH/\", \"/orgs/PEPFAR/sources/DATIM-MOH-FY19/concepts/HllvX50cXC0/\", \"/orgs/DATIM-MOH-BW-FY19/sources/ -``` + * **task=\** (Required for GET request) - Task ID of a previously submitted bulk import request + * **result=json** (Optional) - full results object serialized to JSON (see `OclImportResults.to_json()`) + +Default GET Response (without `?result=json`) has: +1. "message" (string) + ```doctest + Started: 2024-08-08 02:58:04.072628 | Processed: 62/62 | Created: 48 | Updated: 1 | Deleted: 0 | Existing: 1 | Permission Denied: 0 | Unchanged: 11 | Time: 41.45secs + ``` +2. ”report” (json) -- Summary of the results in counts + ```json + { + "total": , # Total number of lines/requests in the import content + "processed": , # Number of lines/requests processed + "created": , # Number of new resources created + "updated": , # Number of new resources updated + "invalid": int, # Number of invalid (bad) resources + "exists": , # Number of resources that already exist + "failed": , # Number of resources that failed to be created/updated + "exception": , # Number of resources that caused an exception + "deleted": , # Number of resources that were deleted + "others": , # Number of resources that OCL had no idea on what to do with + "unknown": , # Number of resources that had "resource_type" unknown to OCL + "permission_denied": , # Number of resources that the user did not have permission to create/update + "unchanged": , # Number of resources that were unchanged due to same standard checksum + "elapsed_seconds": , # Time taken to process the import + "start_time": , # Time the import started + "child_resource_time_distribution": { + "concept": , # Time taken to process concepts + "mapping": # Time taken to process mappings + } + } + ``` + + +GET Response with `?result=json` has: +1. "result" (json): + ```json + { + "count": 348, + "elapsed_seconds": 94.10947012901306, + "total_lines": 348, + "num_skipped": 0, + "results": { + "/orgs/DATIM-MOH-BW-FY19/collections/HTS-TST-N-MOH-HllvX50cXC0/": { + "NEW": { + "200": [ + { + "obj_type": "Reference", + "text": "{\"data\": {\"expressions\": [\"/orgs/DATIM-MOH-BW-FY19/sources/DATIM-Alignment-Indicators/mappings/MAP-DATIM-HAS-OPTION-HTS_TST_N_MOH-HllvX50cXC0/\", \"/orgs/PEPFAR/sources/DATIM-MOH-FY19/concepts/HTS_TST_N_MOH/\", \"/orgs/PEPFAR/sources/DATIM-MOH-FY19/concepts/HllvX50cXC0/\", \"/orgs/DATIM-MOH-BW-FY19/sources/ + ``` * Notes: From da37e83443d0964377353b893f27b75c3ffad10a Mon Sep 17 00:00:00 2001 From: Sny Date: Thu, 8 Aug 2024 18:23:30 +0530 Subject: [PATCH 2/2] OpenConceptLab/ocl_issues#1912 | Updated JSON result format --- .../oclapi/apireference/bulkimporting.md | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/docs/source/oclapi/apireference/bulkimporting.md b/docs/source/oclapi/apireference/bulkimporting.md index 90141d5..53ec84e 100644 --- a/docs/source/oclapi/apireference/bulkimporting.md +++ b/docs/source/oclapi/apireference/bulkimporting.md @@ -311,7 +311,7 @@ Default GET Response (without `?result=json`) has: ```doctest Started: 2024-08-08 02:58:04.072628 | Processed: 62/62 | Created: 48 | Updated: 1 | Deleted: 0 | Existing: 1 | Permission Denied: 0 | Unchanged: 11 | Time: 41.45secs ``` -2. ”report” (json) -- Summary of the results in counts +2. ”report” (json) -- _Summary of the result in counts_ ```json { "total": , # Total number of lines/requests in the import content @@ -338,20 +338,29 @@ Default GET Response (without `?result=json`) has: GET Response with `?result=json` has: -1. "result" (json): +1. "result" (json) -- _An extended format of "report" with more details_ ```json { - "count": 348, - "elapsed_seconds": 94.10947012901306, - "total_lines": 348, - "num_skipped": 0, - "results": { - "/orgs/DATIM-MOH-BW-FY19/collections/HTS-TST-N-MOH-HllvX50cXC0/": { - "NEW": { - "200": [ - { - "obj_type": "Reference", - "text": "{\"data\": {\"expressions\": [\"/orgs/DATIM-MOH-BW-FY19/sources/DATIM-Alignment-Indicators/mappings/MAP-DATIM-HAS-OPTION-HTS_TST_N_MOH-HllvX50cXC0/\", \"/orgs/PEPFAR/sources/DATIM-MOH-FY19/concepts/HTS_TST_N_MOH/\", \"/orgs/PEPFAR/sources/DATIM-MOH-FY19/concepts/HllvX50cXC0/\", \"/orgs/DATIM-MOH-BW-FY19/sources/ + "total": , # Total number of lines/requests in the import content + "processed": , # Number of lines/requests processed + "created": , # List of new resources created + "updated": , # List of new resources updated + "invalid": , # List of invalid (bad) resources + "exists": , # List of resources that already exist + "failed": , # List of resources that failed to be created/updated + "exception": , # List of resources that caused an exception + "deleted": , # List of resources that were deleted + "others": , # List of resources that OCL had no idea on what to do with + "unknown": , # List of resources that had "resource_type" unknown to OCL + "permission_denied": , # List of resources that the user did not have permission to create/update + "unchanged": , # List of resources that were unchanged due to same standard checksum + "elapsed_seconds": , # Time taken to process the import + "start_time": , # Time the import started + "child_resource_time_distribution": { + "concept": , # Time taken to process concepts + "mapping": # Time taken to process mappings + } + } ```