Skip to content

rlondner/cre-smart-report

Repository files navigation

CRE Smart Report

An automated tool for commercial real estate (CRE) professionals to generate polished, image-rich property reports from CoStar listing data.

1. Purpose

The tool automates the tedious process of extracting property data and images from CoStar and formatting them into a professional Word document. It uses AI-driven image classification to ensure floor plans and photos are placed in the correct sections of the report and automatically manages layout details like aspect ratio preservation and section duplication.

2. The Process

Step A: Save Listing Data

  1. Web Page: In your browser, navigate to the CoStar "For Lease" listing and save the page as Webpage, Complete into the client/ sub-folder (or any other folder of your choice, simply replace the client references in the commands below with your custom folder path). This creates an .html file and a corresponding _files/ folder.
  2. Brochure (Optional): Save the CoStar PDF tour report or property brochure into the _files/ folder of the property it pertains to.

Step B: Extraction & Classification

When you run the generator:

  1. Parsing: The script parses the HTML to extract fields like address, rent, SF, and leasing contacts.
  2. AI Image Classification: It scans all images in the _files/ folder. Using the OpenAI CLIP model, it identifies which images are floor plans, interior views (offices/stores), or exterior views.
  3. Note Injection: If a CoStar PDF is provided, the script extracts "Agent Notes" and matches them to the correct property via address reconciliation.

Step C: Report Generation

  1. Duplication: The tool takes a "Master Section" from your Word template and duplicates it for every property found in the client/ folder.
  2. Surgical Injection: It replaces {{VARIABLE}} text placeholders with property data and surgically injects images into pre-defined image placeholders.
  3. Final Cleanup: It calculates aspect ratios to prevent image distortion and hides empty placeholder tags.

3. Running the Tool

Basic Command

To generate a report from all HTML files in a folder:

python generate_report.py --input-folder "client/" --output "My_Report.docx"

Full Parameters Example

python generate_report.py `
    --input-folder "client/" `
    --template "property_report_template.docx" `
    --output "Sunny_Report_May_2026.docx" `
    --costar-pdf "client/TourReport.pdf" `
    --client_name "John Doe" `
    --client_co "Sunny Flowers Boutique" `
    --agent "Jane Smith" `
    --search-area "Midtown Manhattan" `
    --budget "50-70" `
    --size "1000-2000" `
    --use-type "Retail"
Parameter Description
--input-folder Folder containing your saved CoStar HTML files.
--template The .docx file to use as a starting point.
--output The name/path of the final document to create.
--costar-pdf (Optional) Path to a CoStar PDF to extract map and agent notes.
--client_name The name of your client (fills {{CLIENT_NAME}}).
--client_co The name of your client (fills {{CLIENT_COMPANY}}).
--search-area Description of the search (fills {{SEARCH_AREA}}).
--budget Rent range (fills {{BUDGET_MIN}} and {{BUDGET_MAX}}).
--size SF range (fills {{SIZE_MIN}} and {{SIZE_MAX}}).

4. Template Requirements

Property Section markers

The tool needs to know which part of your document to repeat for each property. Wrap your property detail page(s) in these two markers (each on its own line):

  • [[ PROPERTY_SECTION_START ]]
  • [[ PROPERTY_SECTION_END ]] Note: These markers are automatically made invisible in the final report.

Image Placeholders

To insert images, insert a "Placeholder" image in Word, right-click it, go to View Alt Text (or Format Picture > Alt Text), and set the Title to one of these exact names:

  • FloorPlan: The primary classified floor plan.
  • Photo1, Photo2, Photo3, Photo4: The top 4 classified property photos.
  • PropertyMapOverview: The overview map extracted from the CoStar PDF.

5. Available Template Fields

You can add any of these {{FIELD_NAME}} tags to your Word template. They will be automatically replaced with data from the CoStar listing.

Property Basics

  • {{PROPERTY_ADDRESS}}: Full address of the building.
  • {{BUILDING_NAME}}: Name of the building (defaults to address).
  • {{CITY_STATE_ZIP}}: City, State, and Zip code.
  • {{SF_AVAILABLE}}: The specific SF available for lease.
  • {{RENT_SF_YR}}: Asking rent per square foot per year.
  • {{USE_TYPE}}: e.g., Office, Retail, Industrial.

Building Details

  • {{BUILDING_TOTAL_SF}}: Total RBA of the building.
  • {{YEAR_BUILT}}: Original construction year.
  • {{FLOOR_LABEL}}: Which floor the space is on.
  • {{SUITE_NAME}}: Suite number or name.

Lease Terms

  • {{LEASE_TYPE}}: e.g., Direct.
  • {{TERM}}: Length of lease.
  • {{SERVICES}}: Utilities/Services included.
  • {{BUILD_OUT}}: Condition of the space (e.g., Full Build-Out).
  • {{SPACE_AMENITIES}}: Specific features listed in CoStar.

Notes & Comments

  • {{SPACE_NOTES}}: The public listing notes from CoStar.
  • {{PERSONAL_NOTES}}: Private notes extracted from your CoStar PDF tour report.
  • {{PHOTO_PAGE_1_NOTES}}: Optional notes for the photo pages.

Contacts

  • {{LEASING_COMPANY}}: The brokerage firm.
  • {{CONTACT_NAME}}: The primary listing agent.
  • {{CONTACT_PHONE}}: The agent's phone number.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages