From 6474927a1590829d8eedfe8ae5aadc2d0e99ffb4 Mon Sep 17 00:00:00 2001 From: docktermj Date: Fri, 27 Sep 2024 15:31:48 -0400 Subject: [PATCH] #85 Savepoint --- rootfs/notebooks/load_user_data.ipynb | 15 ++++++++------- src/senzing_quickstart/load_user_data.py | 13 +++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/rootfs/notebooks/load_user_data.ipynb b/rootfs/notebooks/load_user_data.ipynb index b34846f..d30a45b 100644 --- a/rootfs/notebooks/load_user_data.ipynb +++ b/rootfs/notebooks/load_user_data.ipynb @@ -26,9 +26,9 @@ "The following instructions show how to upload a file of JSON lines.\n", "Here is an [example file].\n", "\n", - "1. In upper-left corner of Juypter lab, click on the\n", + "1. In upper-left corner of JuypterLab, click on the\n", " ![Upload Files](img/upload-icon.png)\n", - " \"Upload Files\" icon.\n", + " (\"Upload Files\") icon.\n", "1. Choose the file of JSON lines to upload.\n", "\n", "[example file]: https://raw.githubusercontent.com/senzing-garage/demo-quickstart/refs/heads/main/testdata/example-data-for-senzing.json" @@ -130,7 +130,8 @@ " if datasource not in datasources:\n", " datasources.append(datasource)\n", "\n", - "print(f\"Found the following DATA_SOURCE values in the data: {datasources}\")" + "print(f\"Found the following DATA_SOURCE values in the data: {datasources}\")\n", + " " ] }, { @@ -202,7 +203,7 @@ "source": [ "old_config_id = sz_configmanager.get_default_config_id()\n", "old_json_config = sz_configmanager.get_config(old_config_id)\n", - "config_handle = sz_config.import_config(old_json_config)" + "config_handle = sz_config.import_config(old_json_config) " ] }, { @@ -246,7 +247,7 @@ "new_config_id = sz_configmanager.add_config(\n", " new_json_config, \"Add TruthSet datasources\"\n", ")\n", - "sz_configmanager.replace_default_config_id(old_config_id, new_config_id)" + "sz_configmanager.replace_default_config_id(old_config_id, new_config_id) " ] }, { @@ -293,7 +294,7 @@ "source": [ "with open(filepath, \"r\") as file:\n", " for line in file:\n", - " try:\n", + " try: \n", " line_as_dict = json.loads(line)\n", " info = sz_engine.add_record(\n", " line_as_dict.get(\"DATA_SOURCE\"),\n", @@ -303,7 +304,7 @@ " )\n", " print(info)\n", " except SzError as err:\n", - " print(err)" + " print(err) " ] } ], diff --git a/src/senzing_quickstart/load_user_data.py b/src/senzing_quickstart/load_user_data.py index 75d9887..e14f668 100755 --- a/src/senzing_quickstart/load_user_data.py +++ b/src/senzing_quickstart/load_user_data.py @@ -10,9 +10,9 @@ # The following instructions show how to upload a file of JSON lines. # Here is an [example file]. # -# 1. In upper-left corner of Juypter lab, click on the +# 1. In upper-left corner of JuypterLab, click on the # ![Upload Files](img/upload-icon.png) -# "Upload Files" icon. +# ("Upload Files") icon. # 1. Choose the file of JSON lines to upload. # # [example file]: https://raw.githubusercontent.com/senzing-garage/demo-quickstart/refs/heads/main/testdata/example-data-for-senzing.json @@ -62,6 +62,7 @@ datasources.append(datasource) print(f"Found the following DATA_SOURCE values in the data: {datasources}") + # ## Update Senzing configuration @@ -97,7 +98,7 @@ old_config_id = sz_configmanager.get_default_config_id() old_json_config = sz_configmanager.get_config(old_config_id) -config_handle = sz_config.import_config(old_json_config) +config_handle = sz_config.import_config(old_json_config) # Add DataSources to Senzing configuration. @@ -121,7 +122,7 @@ new_config_id = sz_configmanager.add_config( new_json_config, "Add TruthSet datasources" ) -sz_configmanager.replace_default_config_id(old_config_id, new_config_id) +sz_configmanager.replace_default_config_id(old_config_id, new_config_id) # With the change in Senzing configuration, Senzing objects need to be updated. @@ -142,7 +143,7 @@ with open(filepath, "r") as file: for line in file: - try: + try: line_as_dict = json.loads(line) info = sz_engine.add_record( line_as_dict.get("DATA_SOURCE"), @@ -152,5 +153,5 @@ ) print(info) except SzError as err: - print(err) + print(err)