mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
55 lines
No EOL
1.9 KiB
Python
55 lines
No EOL
1.9 KiB
Python
from etl.scraper.scraper import SharePointScraper, SharePointInstaller, WEEK_COMMENCING
|
|
from pprint import pformat
|
|
from etl.fileReader.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() |