mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
added new scripts
This commit is contained in:
parent
d4819cfbf6
commit
3f22a4b855
2 changed files with 110 additions and 0 deletions
55
etl/jjc_invoice.py
Normal file
55
etl/jjc_invoice.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
from etl.scraper.scraper import SharePointScraper, SharePointInstaller, WEEK_COMMENCING
|
||||
from pprint import pformat
|
||||
from etl.pdfReader.pdfReaderToText import pdfReaderToText
|
||||
from etl.surveyedData.surveryedData import surveyedDataProcessor
|
||||
import pandas as pd
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
data = {
|
||||
"Address": [],
|
||||
"Surveyor's Name": [],
|
||||
"Type of Work": [],
|
||||
"Price": []
|
||||
}
|
||||
|
||||
south_coast_scraper = SharePointScraper(SharePointInstaller.SOUTH_COAST_INSULATION)
|
||||
file_paths = south_coast_scraper.download_file_for_each_address()
|
||||
list_of_surveys = []
|
||||
for eachAddress in file_paths:
|
||||
for address, files in eachAddress.items():
|
||||
list_of_surveys.append(surveyedDataProcessor(address, files))
|
||||
|
||||
|
||||
for survey in list_of_surveys:
|
||||
if survey.pre_site_note:
|
||||
if survey.pre_site_note.property_description.main_property.wall.insulation.lower() == 'as built' \
|
||||
and survey.pre_site_note.property_description.main_property.wall.construction.lower() == "cavity wall":
|
||||
if survey.csr:
|
||||
data["Price"].append(500)
|
||||
data["Type of Work"].append("REMIDIAL CWI ONLY")
|
||||
else:
|
||||
data["Price"].append(1000)
|
||||
data["Type of Work"].append("CAVITY ONLY")
|
||||
else:
|
||||
# Solar
|
||||
data["Price"].append(1608)
|
||||
data["Type of Work"].append("SOLAR")
|
||||
|
||||
data["Address"].append(survey.address)
|
||||
data["Surveyor's Name"].append(survey.pre_site_note.assessor_information.name)
|
||||
|
||||
df = pd.DataFrame(data)
|
||||
|
||||
# Save to an Excel file
|
||||
df.to_excel("survey_data.xlsx", index=False)
|
||||
|
||||
print(f"WEEK COMMENCING {WEEK_COMMENCING}")
|
||||
print("Excel file 'survey_data.xlsx' created successfully!")
|
||||
print(pformat(data))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
55
etl/sgec_invoice.py
Normal file
55
etl/sgec_invoice.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
from etl.scraper.scraper import SharePointScraper, SharePointInstaller, WEEK_COMMENCING
|
||||
from pprint import pformat
|
||||
from etl.pdfReader.pdfReaderToText import pdfReaderToText
|
||||
from etl.surveyedData.surveryedData import surveyedDataProcessor
|
||||
import pandas as pd
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
data = {
|
||||
"Address": [],
|
||||
"Surveyor's Name": [],
|
||||
"Type of Work": [],
|
||||
"Price": []
|
||||
}
|
||||
|
||||
south_coast_scraper = SharePointScraper(SharePointInstaller.SOUTH_COAST_INSULATION)
|
||||
file_paths = south_coast_scraper.download_file_for_each_address()
|
||||
list_of_surveys = []
|
||||
for eachAddress in file_paths:
|
||||
for address, files in eachAddress.items():
|
||||
list_of_surveys.append(surveyedDataProcessor(address, files))
|
||||
|
||||
|
||||
for survey in list_of_surveys:
|
||||
if survey.pre_site_note:
|
||||
if survey.pre_site_note.property_description.main_property.wall.insulation.lower() == 'as built' \
|
||||
and survey.pre_site_note.property_description.main_property.wall.construction.lower() == "cavity wall":
|
||||
if survey.csr:
|
||||
data["Price"].append(500)
|
||||
data["Type of Work"].append("REMIDIAL CWI ONLY")
|
||||
else:
|
||||
data["Price"].append(1000)
|
||||
data["Type of Work"].append("CAVITY ONLY")
|
||||
else:
|
||||
# Solar
|
||||
data["Price"].append(1608)
|
||||
data["Type of Work"].append("SOLAR")
|
||||
|
||||
data["Address"].append(survey.address)
|
||||
data["Surveyor's Name"].append(survey.pre_site_note.assessor_information.name)
|
||||
|
||||
df = pd.DataFrame(data)
|
||||
|
||||
# Save to an Excel file
|
||||
df.to_excel("survey_data.xlsx", index=False)
|
||||
|
||||
print(f"WEEK COMMENCING {WEEK_COMMENCING}")
|
||||
print("Excel file 'survey_data.xlsx' created successfully!")
|
||||
print(pformat(data))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Reference in a new issue