aboutsummaryrefslogtreecommitdiff
path: root/gn3/csvcmp.py
diff options
context:
space:
mode:
authorBonfaceKilz2022-02-24 09:08:12 +0300
committerBonfaceKilz2022-03-12 15:33:09 +0300
commit17d0e4239f6cb1d5c3820730162b3f59d83dac68 (patch)
treef71b81d45eefe5ecde1ac53cb14fa3c165922cd6 /gn3/csvcmp.py
parenta4ae3a4d1bb680f8a0d38d37f8ceffe0f3a1b2a9 (diff)
downloadgenenetwork3-17d0e4239f6cb1d5c3820730162b3f59d83dac68.tar.gz
Store columns in the output dict
When inserting, deleting, or editing case-attributes, we need the column headers in order to be able to know identify the attribute of interest. * gn3/csvcmp.py (csv_diff): Add extra "Column" key in returned dict.
Diffstat (limited to 'gn3/csvcmp.py')
-rw-r--r--gn3/csvcmp.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gn3/csvcmp.py b/gn3/csvcmp.py
index e033396..a525b91 100644
--- a/gn3/csvcmp.py
+++ b/gn3/csvcmp.py
@@ -59,7 +59,10 @@ def csv_diff(base_csv, delta_csv, tmp_dir="/tmp"):
f"'{file_name1}' '{file_name2}' "
"--format json"))
if _r.get("code") == 0:
- _r["output"] = json.loads(_r.get("output"))
+ _r = json.loads(_r.get("output"))
+ _r["Columns"] = max(_header1, _header2)
+ else:
+ _r = {}
# Clean Up!
if os.path.exists(file_name1):
os.remove(file_name1)