diff options
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/db/sample_data.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gn3/db/sample_data.py b/gn3/db/sample_data.py index e5c5e48..c697de0 100644 --- a/gn3/db/sample_data.py +++ b/gn3/db/sample_data.py @@ -22,7 +22,10 @@ def __extract_actions(original_data: str, "insert": {"data": [], "csv_header": []}, "update": {"data": [], "csv_header": []}, } + strain_name = "" for _o, _u, _h in zip(original_data, updated_data, csv_header): + if _h == "Strain Name": + strain_name = _o if _o == _u: # No change continue elif _o and _u == "x": # Deletion @@ -38,8 +41,10 @@ def __extract_actions(original_data: str, if not val["data"]: result[key] = None else: - result[key]["data"] = ",".join(result[key]["data"]) - result[key]["csv_header"] = ",".join(result[key]["csv_header"]) + result[key]["data"] = (f"{strain_name}," + + ",".join(result[key]["data"])) + result[key]["csv_header"] = ("Strain Name," + + ",".join(result[key]["csv_header"])) return result |