Skip to content

Commit

Permalink
feat: add entity index + update send to gsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Mar 27, 2024
1 parent 9a4dd00 commit 1e63b95
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@
"outputs": [],
"source": [
"# Inputs\n",
"entity_dir = pload(os.path.join(naas_data_product.OUTPUTS_PATH, \"entities\", \"0\"), \"entity_dir\") or \"\"\n",
"entity_name = pload(os.path.join(naas_data_product.OUTPUTS_PATH, \"entities\", \"0\"), \"entity_name\") or \"\"\n",
"entity_index = \"0\"\n",
"entity_dir = pload(os.path.join(naas_data_product.OUTPUTS_PATH, \"entities\", entity_index), \"entity_dir\") or \"\"\n",
"entity_name = pload(os.path.join(naas_data_product.OUTPUTS_PATH, \"entities\", entity_index), \"entity_name\") or \"\"\n",
"input_dir = os.path.join(entity_dir, \"content-engine\", date.today().isoformat())\n",
"file_name = \"linkedin_posts\"\n",
"\n",
"# Outputs\n",
"spreadsheet_url = pload(os.path.join(naas_data_product.OUTPUTS_PATH, \"entities\", \"0\"), \"abi_spreadsheet\") or \"\"\n",
"spreadsheet_url = pload(os.path.join(naas_data_product.OUTPUTS_PATH, \"entities\", entity_index), \"abi_spreadsheet\") or \"\"\n",
"sheet_name = \"POSTS\"\n",
"output_dir = os.path.join(entity_dir, \"content-engine\", date.today().isoformat())\n",
"file_content = \"posts\""
Expand Down Expand Up @@ -353,11 +354,7 @@
},
"outputs": [],
"source": [
"df_check = pd.concat([df_init.astype(str), df_content.astype(str)]).drop_duplicates(keep=False)\n",
"if len(df_check) > 0:\n",
" gsheet.connect(spreadsheet_url).send(sheet_name=sheet_name, data=df_content, append=False)\n",
"else:\n",
" print(\"Noting to update in Google Sheets!\")"
"send_data_to_gsheet(df_content, df_init, spreadsheet_url, sheet_name)"
]
},
{
Expand Down

0 comments on commit 1e63b95

Please sign in to comment.