mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
deem score calcualted with hubspot and sharepoint integration
This commit is contained in:
parent
97a0c9addd
commit
2ccee63a8c
3 changed files with 25 additions and 15 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import hubspot
|
||||
from enum import Enum
|
||||
from hubspot.crm.deals import PublicObjectSearchRequest
|
||||
from hubspot.crm.deals.models import SimplePublicObjectInput
|
||||
from etl.hubSpotClient.types import SubmissionInfoFromDeal
|
||||
|
||||
class DealStage(Enum):
|
||||
SURVEYED_COMPLETE_NEEDS_SIGN_OFF = "1617223914"
|
||||
SURVEYED_NO_ACCESS_NEED_SIGN_OFF = "1617223915"
|
||||
CUSTOMER_CONTACTED = "888730834"
|
||||
SURVEYED_COMPLETED_SIGNED_OFF = "1617223916"
|
||||
|
||||
class HubSpotClient():
|
||||
def __init__(self):
|
||||
|
|
@ -69,4 +71,15 @@ class HubSpotClient():
|
|||
print(f" - Label: {stage.label}")
|
||||
print(f" ID: {stage.id}")
|
||||
|
||||
|
||||
def move_deals_to_different_stage(self, list_of_deals_id, to_stage_id):
|
||||
deal_properties = SimplePublicObjectInput(
|
||||
properties={
|
||||
"dealstage": to_stage_id
|
||||
}
|
||||
)
|
||||
for deal_id in list_of_deals_id:
|
||||
self.client.crm.deals.basic_api.update(
|
||||
deal_id,
|
||||
simple_public_object_input=deal_properties
|
||||
)
|
||||
print(f"Deal {deal_id} moved to stage with ID {to_stage_id}.")
|
||||
|
|
|
|||
|
|
@ -28,10 +28,14 @@ output_path = os.path.abspath(lewis_view)
|
|||
sp.upload_to_sharepoint(output_path, lewis_view)
|
||||
|
||||
|
||||
deal_ids = df["HUBSPOT_DEAL_ID"].tolist()
|
||||
|
||||
sp.move_deals_to_completed(deal_ids)
|
||||
|
||||
|
||||
# TODO:
|
||||
# Move deal in hub spot Surveyoed complete signed off, if normal
|
||||
# Write documentation for tech demos from Khalims demo
|
||||
# Look into getting solar working. ACIS and Lewis
|
||||
# Look into getting 'solar' pricing working. ACIS and Lewis Billignham for examples
|
||||
# Figure out what to do if I see an address that isn't registered but surveyrod
|
||||
# Review deem score with last weeks deem score values to ensure accuracy
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@ class SurveyPrice():
|
|||
self.all_hubspot_submissions = pd.DataFrame(all_deals)
|
||||
return self.all_hubspot_submissions
|
||||
|
||||
def move_deals_to_completed(self, deals):
|
||||
hubspot = HubSpotClient()
|
||||
hubspot.move_deals_to_different_stage(deals, DealStage.SURVEYED_COMPLETED_SIGNED_OFF.value)
|
||||
|
||||
|
||||
def get_all_surveyed_data_from_sharepoint(self):
|
||||
# TODO: rewrite the function so I pass in sharepointInstaller instead so I can re use the same function for
|
||||
# DIfferent installers
|
||||
|
|
@ -301,15 +306,3 @@ class SurveyPrice():
|
|||
sharepoint_path = parent_folder + "/" + date
|
||||
|
||||
self.sharepoint_client.upload_file(file_path_to_upload, sharepoint_path, file_name)
|
||||
|
||||
|
||||
# TODO
|
||||
# Get it working for JJC first, with an idea to make it more diverse
|
||||
# Add some TDD to ensure JJC values are correct
|
||||
# The script can run weekly, for development I can just get one data
|
||||
# Upload both the W.C. calculations and Rate Card to sharepoint
|
||||
# Due considerations -> Piece of UI, as osmosis, dashboard upload and pushes site notes database and condition report to database. Link the two, make a due consideration report, due consideration report, propery_id ()
|
||||
# Property Tbale
|
||||
|
||||
# Add hubspot deal id into pandas
|
||||
# Deem score and move deal id to 'Surveyed Completed Signed off"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue