mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
save sheet names
This commit is contained in:
parent
5cc1e9e645
commit
c807917ad6
2 changed files with 47 additions and 12 deletions
|
|
@ -1,4 +1,14 @@
|
|||
import os
|
||||
|
||||
|
||||
os.environ["SHAREPOINT_CLIENT_ID"] = "895e3b77-b1d7-43ec-b18f-dcfe07cdfeaf"
|
||||
os.environ["SHAREPOINT_CLIENT_SECRET"] = "SOf8Q~-is4wdQiqvEEm9FlJQRAY9ELGaj5Qz-a6E"
|
||||
os.environ["SHAREPOINT_TENANT_ID"] = "c3f7519c-2719-4547-af04-6da6cbfd8f8f"
|
||||
os.environ["SOUTH_COAST_INSULATION_SERVICE_SHAREPOINT_ID"] = "b5a51507-9427-4ee0-b03e-90ec7681e2d3"
|
||||
os.environ["JJC_SERVICE_SHAREPOINT_ID"] = "7fdd0485-bbf3-4b29-b30f-98c81c2a6284"
|
||||
|
||||
from etl.surveyPrice.surveyPrice import SurveyPrice
|
||||
|
||||
|
||||
|
||||
sp = SurveyPrice()
|
||||
sp.get_price_card()
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
from etl.scraper.scraper import SharePointScraper, SharePointInstaller
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class SurveyPrice():
|
||||
|
|
@ -7,24 +8,48 @@ class SurveyPrice():
|
|||
"""
|
||||
def __init__(self):
|
||||
self.sharepoint_client = SharePointScraper(SharePointInstaller.WARMFRONT)
|
||||
pass
|
||||
self.master_rate_card_path = None
|
||||
self.download_price_card()
|
||||
self.sheet_names = [
|
||||
'JJC - EMPTIES',
|
||||
'JJC - GENERAL EXTRACTIONS',
|
||||
'JJC - FORMALDEHYDE EXTRACTION',
|
||||
'JJC - SOLAR',
|
||||
'SCIS - GENERAL EXTRACTIONS',
|
||||
'SCIS - EMPTIES',
|
||||
'SCIS - SOLAR',
|
||||
'SGEC - EMPTIES',
|
||||
'SGEC - GENERAL EXTRACTIONS',
|
||||
'SGEC - FORMALDEHYDE EXTRACTION'
|
||||
]
|
||||
|
||||
def download_price_card(self):
|
||||
self.sharepoint_client.get_folders_in_path("/Documents/Commercials/Rate Cards")
|
||||
pass
|
||||
url = None
|
||||
for files in self.sharepoint_client.get_folders_in_path("/Commercials/Rate Cards")['value']:
|
||||
if files['name'] == "MASTER RATE CARD.xlsx":
|
||||
url = files['@microsoft.graph.downloadUrl']
|
||||
break
|
||||
|
||||
def get_price_card():
|
||||
pass
|
||||
if url:
|
||||
content = self.sharepoint_client.get_file_content(url)
|
||||
self.master_rate_card_path = self.sharepoint_client.create_temp_file(content, "rate_card/rate_card_all.xlsx")
|
||||
|
||||
return self.master_rate_card_path
|
||||
|
||||
def get_price_card(self):
|
||||
excel_file = pd.ExcelFile(self.master_rate_card_path)
|
||||
return excel_file.sheet_names
|
||||
|
||||
|
||||
def get_master_rate_card_path(self):
|
||||
return self.master_rate_card_path()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO
|
||||
# Make a copy of the rate card and work out each price matrix
|
||||
# Make the price card downloadable as a single excelt sheet for viewing
|
||||
|
||||
|
||||
# For other things, do some TDD so it is a little robust
|
||||
# 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
|
||||
# Expected input, expect output etc
|
||||
# Upload both the W.C. calculations and Rate Card to sharepoint
|
||||
Loading…
Add table
Reference in a new issue