Skip to content

Commit 2ca9b40

Browse files
Dev (#345)
* BCO scoring changes * Add New Production Deployment md Changes to be committed: deleted: docs/bco_scores.json modified: docs/deployment/productionDeployment.md new file: docs/newProductionInstance.md * Update config.md * Add API endpoint for basic comaprison Changes to be committed: modified: biocompute/apis.py modified: biocompute/urls.py modified: requirements.txt * Fix Django CI issue (#340) biocompute-objects/portal_userdb#380 Changes to be committed: modified: .github/workflows/django.yml modified: biocompute/apis.py modified: biocompute/models.py modified: config/settings.py modified: config/urls.py * Update to BcoValidator.load_schema (#341) Updated the function to check locally for the most used schemas. Improves testing and speed in BCO validation. Changes to be committed: modified: biocompute/services.py renamed: config/IEEE/2791object.json -> config/schemas/2791object.json new file: config/schemas/dataset_extension.json renamed: config/IEEE/description_domain.json -> config/schemas/description_domain.json renamed: config/IEEE/error_domain.json -> config/schemas/error_domain.json renamed: config/IEEE/execution_domain.json -> config/schemas/execution_domain.json new file: config/schemas/fhir_extension.json new file: config/schemas/galaxy_extension.json renamed: config/IEEE/io_domain.json -> config/schemas/io_domain.json new file: config/schemas/license_extension.json renamed: config/IEEE/parametric_domain.json -> config/schemas/parametric_domain.json renamed: config/IEEE/provenance_domain.json -> config/schemas/provenance_domain.json new file: config/schemas/scm_extension.json renamed: config/IEEE/usability_domain.json -> config/schemas/usability_domain.json * Add additional schema files and reorganize Changes to be committed: modified: biocompute/services.py new file: config/schemas/1.1.0/dataset_extension.json new file: config/schemas/1.1.0/fhir_extension.json new file: config/schemas/1.1.0/galaxy_extension.json new file: config/schemas/1.1.0/license_extension.json new file: config/schemas/1.1.0/scm_extension.json renamed: config/schemas/dataset_extension.json -> config/schemas/1.2.0/dataset_extension.json renamed: config/schemas/fhir_extension.json -> config/schemas/1.2.0/fhir_extension.json renamed: config/schemas/galaxy_extension.json -> config/schemas/1.2.0/galaxy_extension.json renamed: config/schemas/license_extension.json -> config/schemas/1.2.0/license_extension.json renamed: config/schemas/scm_extension.json -> config/schemas/1.2.0/scm_extension.json renamed: config/schemas/2791object.json -> config/schemas/2791/2791object.json renamed: config/schemas/description_domain.json -> config/schemas/2791/description_domain.json renamed: config/schemas/error_domain.json -> config/schemas/2791/error_domain.json renamed: config/schemas/execution_domain.json -> config/schemas/2791/execution_domain.json renamed: config/schemas/io_domain.json -> config/schemas/2791/io_domain.json renamed: config/schemas/parametric_domain.json -> config/schemas/2791/parametric_domain.json renamed: config/schemas/provenance_domain.json -> config/schemas/2791/provenance_domain.json renamed: config/schemas/usability_domain.json -> config/schemas/2791/usability_domain.json modified: config/settings.py modified: requirements.txt * Add instructions for Docker deployment Changes to be committed: modified: Dockerfile modified: docker-compose.yml modified: docs/deployment/dockerDeployment.md new file: entrypoint.sh * Update comparison API (#344) Changes to be committed: modified: biocompute/apis.py --------- Co-authored-by: Kiran Sen <[email protected]> Co-authored-by: Kiran Sen <[email protected]>
1 parent c39a741 commit 2ca9b40

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

biocompute/apis.py

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -910,35 +910,27 @@ def post(self, request):
910910
accepted_requests = True
911911
data = request.data
912912

913-
for index, comparison in enumerate(data):
914-
new_bco, old_bco = comparison
915-
identifier = new_bco["object_id"]+ " vs " + old_bco["object_id"]
916-
917-
# new_results = validator.parse_and_validate(bco=new_bco)
918-
# old_results = validator.parse_and_validate(bco=old_bco)
919-
# import pdb; pdb.set_trace()
920-
# new_identifier, new_results = new_results.popitem()
921-
# old_identifier, old_results = bco_results.popitem()
922-
923-
# if results["number_of_errors"] > 0:
924-
# rejected_requests = True
925-
# bco_status = "FAILED"
926-
# status_code = 400
927-
# message = "BCO not valid"
928-
929-
# else:
930-
# accepted_requests = True
931-
# bco_status = "SUCCESS"
932-
# status_code = 200
933-
# message = "BCO valid"
913+
try:
914+
915+
for index, comparison in enumerate(data):
916+
new_bco, old_bco = comparison
917+
identifier = new_bco["object_id"]+ " vs " + old_bco["object_id"]
918+
919+
result = DeepDiff(new_bco, old_bco)
920+
parsed_results = {
921+
'dictionary_item_removed': list(result['dictionary_item_removed']),
922+
'values_changed': list(result['values_changed']),
923+
'iterable_item_removed': list(result['iterable_item_removed'])
924+
}
934925

935-
response_data.append(bulk_response_constructor(
936-
identifier = identifier,
937-
status="SUCCESS",
938-
code=200,
939-
# message=message,
940-
data=DeepDiff(new_bco, old_bco).to_json()
941-
))
926+
response_data.append(bulk_response_constructor(
927+
identifier = identifier,
928+
status="SUCCESS",
929+
code=200,
930+
data=parsed_results
931+
))
942932

943-
status_code = response_status(accepted_requests, rejected_requests)
944-
return Response(status=status_code, data=response_data)
933+
status_code = response_status(accepted_requests, rejected_requests)
934+
return Response(status=status_code, data=response_data)
935+
except Exception:
936+
return Response(status=status.HTTP_400_BAD_REQUEST, data={})

0 commit comments

Comments
 (0)