-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add notebook for submitting civic assertions via prod api
- Loading branch information
Showing
2 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import json\n", | ||
"import os\n", | ||
"import sys\n", | ||
"from pathlib import Path\n", | ||
"\n", | ||
"module_path = os.path.abspath(os.path.join(\"../\"))\n", | ||
"if module_path not in sys.path:\n", | ||
" sys.path.append(module_path)\n", | ||
"from utils import dry_run_test_api, submit # noqa: E402" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"with Path(\"assertion_onco.json\").open() as f:\n", | ||
" onco_sub = json.load(f)\n", | ||
"\n", | ||
"assert dry_run_test_api(onco_sub).status_code == 204" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"with Path(\"batch_assertions_clinical_impact.json\").open() as f:\n", | ||
" clin_impact_sub = None\n", | ||
" _data = json.load(f)\n", | ||
" _subs = _data[\"clinicalImpactSubmission\"]\n", | ||
"\n", | ||
" for _sub in _subs:\n", | ||
" if _sub[\"localKey\"] == \"civic.AID:7\":\n", | ||
" clin_impact_sub = {\"clinicalImpactSubmission\": [_sub]}\n", | ||
" break\n", | ||
"\n", | ||
"assert dry_run_test_api(clin_impact_sub).status_code == 204" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"201" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"onco_sub_resp = submit(onco_sub)\n", | ||
"onco_sub_resp.status_code" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"201" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"clin_impact_sub_resp = submit(clin_impact_sub)\n", | ||
"clin_impact_sub_resp.status_code" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters