Skip to content

Commit

Permalink
Merge pull request #68 from DARPA-ASKEM/TS/2906-Add-simulation-risk-t…
Browse files Browse the repository at this point in the history
…o-results

add risk.json to simulation results
  • Loading branch information
Tom-Szendrey authored Mar 13, 2024
2 parents ef7f6e9 + ccde515 commit 24ea9ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions service/utils/tds.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ def attach_files(output: dict, job_id, status="complete"):
data_result.to_csv(output_filename, index=False)
files[output_filename] = "result.csv"

risk_result = output.get("risk", None)
if risk_result is not None:
json_obj = json.loads(json.dumps(risk_result, default=str))
json_filename = os.path.join(job_dir, "./risk.json")
with open(json_filename, "w") as f:
json.dump(json_obj, f, ensure_ascii=False, indent=4)
files[json_filename] = "risk.json"

eval_output_filename = os.path.join(job_dir, "./eval.csv")
eval_result = output.get("quantiles", None)
if eval_result is not None:
Expand Down

0 comments on commit 24ea9ce

Please sign in to comment.