diff options
| author | Munyoki Kilyungi | 2025-07-01 11:18:33 +0300 |
|---|---|---|
| committer | BonfaceKilz | 2025-07-07 07:58:31 +0300 |
| commit | 0d144bd464c493dc53be38fe5129bfbdfa1a3b29 (patch) | |
| tree | 6587ee7f7c528080775fe8150b966a15bff9092c /gn3/db/case_attributes.py | |
| parent | 6e9cac9c172b1aec408de1c839dad3e7048cf4d1 (diff) | |
| download | genenetwork3-0d144bd464c493dc53be38fe5129bfbdfa1a3b29.tar.gz | |
Add function for viewing a single diff change.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/db/case_attributes.py')
| -rw-r--r-- | gn3/db/case_attributes.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gn3/db/case_attributes.py b/gn3/db/case_attributes.py index 48d77c7..4bdb654 100644 --- a/gn3/db/case_attributes.py +++ b/gn3/db/case_attributes.py @@ -144,6 +144,20 @@ def __fetch_case_attrs_changes__(cursor, change_ids: tuple) -> list: return results +def view_change(cursor, change_id: int) -> dict: + cursor.execute( + "SELECT json_diff_data " + "FROM caseattributes_audit " + "WHERE id = %s", + (change_id,) + ) + json_diff_data, _ = cursor.fetchone() + if json_diff_data: + json_diff_data = json.loads(json_diff_data) + return json_diff_data + return {} + + def get_changes(cursor, inbredset_id: int, directory: Path) -> dict: directory = f"{directory}/case-attributes/{inbredset_id}" if not os.path.exists(directory): |
