Skip to content

Commit aaab748

Browse files
committed
Add validation modules for real estate responses
- Implemented RealEstateHallucinationDetector to identify unrealistic percentages and large price figures in responses. - Created PriceValidator to validate price information based on property type and regional multipliers, including checks for price per square foot and total price consistency. - Developed ROIValidator to validate ROI projections, cap rates, and cash-on-cash returns, ensuring they fall within reasonable ranges and checking for consistency across financial metrics. - Added PriceConsistencyValidator to ensure consistency among multiple price mentions within a response.
1 parent 0b34cea commit aaab748

File tree

137 files changed

+44346
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+44346
-2
lines changed

.flake8

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[flake8]
2+
max-line-length = 120
3+
ignore =
4+
# W293: blank line contains whitespace
5+
W293,
6+
# W291: trailing whitespace
7+
W291,
8+
# E128: continuation line under-indented for visual indent
9+
E128,
10+
# F401: imported but unused (for development)
11+
F401
12+
exclude =
13+
__pycache__,
14+
.git,
15+
.venv,
16+
venv,
17+
env,
18+
.env,
19+
build,
20+
dist,
21+
*.egg-info,
22+
migrations
23+
24+
# Focus on important errors
25+
select =
26+
E, # pycodestyle errors
27+
W, # pycodestyle warnings
28+
F, # pyflakes
29+
C, # complexity
30+
31+
# Exclude some less critical warnings during development
32+
per-file-ignores =
33+
__init__.py:F401

.gitignore

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[codz]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
.vscode/
10+
logs/
11+
logs/*
12+
13+
# Cache directories
14+
cache/
15+
16+
# Distribution / packaging
17+
.Python
18+
build/
19+
develop-eggs/
20+
dist/
21+
downloads/
22+
eggs/
23+
.eggs/
24+
lib/
25+
lib64/
26+
parts/
27+
sdist/
28+
var/
29+
wheels/
30+
share/python-wheels/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
MANIFEST
35+
36+
# PyInstaller
37+
# Usually these files are written by a python script from a template
38+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
39+
*.manifest
40+
*.spec
41+
42+
# Installer logs
43+
pip-log.txt
44+
pip-delete-this-directory.txt
45+
46+
# Unit test / coverage reports
47+
htmlcov/
48+
.tox/
49+
.nox/
50+
.coverage
51+
.coverage.*
52+
.cache
53+
nosetests.xml
54+
coverage.xml
55+
*.cover
56+
*.py.cover
57+
.hypothesis/
58+
.pytest_cache/
59+
cover/
60+
61+
# Translations
62+
*.mo
63+
*.pot
64+
65+
# Django stuff:
66+
*.log
67+
local_settings.py
68+
db.sqlite3
69+
db.sqlite3-journal
70+
71+
# Flask stuff:
72+
instance/
73+
.webassets-cache
74+
75+
# Scrapy stuff:
76+
.scrapy
77+
78+
# Sphinx documentation
79+
docs/_build/
80+
81+
# PyBuilder
82+
.pybuilder/
83+
target/
84+
85+
# Jupyter Notebook
86+
.ipynb_checkpoints
87+
88+
# IPython
89+
profile_default/
90+
ipython_config.py
91+
92+
# pyenv
93+
# For a library or package, you might want to ignore these files since the code is
94+
# intended to run in multiple environments; otherwise, check them in:
95+
# .python-version
96+
97+
# pipenv
98+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
100+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
101+
# install all needed dependencies.
102+
#Pipfile.lock
103+
104+
# UV
105+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
106+
# This is especially recommended for binary packages to ensure reproducibility, and is more
107+
# commonly ignored for libraries.
108+
#uv.lock
109+
110+
# poetry
111+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
112+
# This is especially recommended for binary packages to ensure reproducibility, and is more
113+
# commonly ignored for libraries.
114+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
115+
#poetry.lock
116+
#poetry.toml
117+
118+
# pdm
119+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
120+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
121+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
122+
#pdm.lock
123+
#pdm.toml
124+
.pdm-python
125+
.pdm-build/
126+
127+
# pixi
128+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
129+
#pixi.lock
130+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
131+
# in the .venv directory. It is recommended not to include this directory in version control.
132+
.pixi
133+
134+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
135+
__pypackages__/
136+
137+
# Celery stuff
138+
celerybeat-schedule
139+
celerybeat.pid
140+
141+
# SageMath parsed files
142+
*.sage.py
143+
144+
# Environments
145+
.env
146+
.env.test
147+
.env.example
148+
.env.local
149+
.envrc
150+
.venv
151+
env/
152+
venv/
153+
ENV/
154+
env.bak/
155+
venv.bak/
156+
157+
# Spyder project settings
158+
.spyderproject
159+
.spyproject
160+
161+
# Rope project settings
162+
.ropeproject
163+
164+
# mkdocs documentation
165+
/site
166+
167+
# mypy
168+
.mypy_cache/
169+
.dmypy.json
170+
dmypy.json
171+
172+
# Pyre type checker
173+
.pyre/
174+
175+
# pytype static type analyzer
176+
.pytype/
177+
178+
# Cython debug symbols
179+
cython_debug/
180+
181+
# PyCharm
182+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
183+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
184+
# and can be added to the global gitignore or merged into this file. For a more nuclear
185+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
186+
#.idea/
187+
188+
# Abstra
189+
# Abstra is an AI-powered process automation framework.
190+
# Ignore directories containing user credentials, local state, and settings.
191+
# Learn more at https://abstra.io/docs
192+
.abstra/
193+
194+
# Visual Studio Code
195+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
196+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
197+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
198+
# you could uncomment the following to ignore the entire vscode folder
199+
# .vscode/
200+
201+
# Ruff stuff:
202+
.ruff_cache/
203+
204+
# PyPI configuration file
205+
.pypirc
206+
207+
# Cursor
208+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
209+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
210+
# refer to https://docs.cursor.com/context/ignore-files
211+
.cursorignore
212+
.cursorindexingignore
213+
214+
# Marimo
215+
marimo/_static/
216+
marimo/_lsp/
217+
__marimo__/
218+
219+
220+
# Local development files
221+
cache/embeddings/ `# Cache for embeddings, can be large and specific to local development
222+
223+
224+
API_TESTING_GUIDE.md
225+
CLI_FUNCTIONALITY_SUMMARY.md
226+
CLI_README.md
227+
cli_requirements.txt
228+
demo_cli.py
229+
final_testing.md
230+
performance_improvements_summary.md
231+
Phase3_Implementation_Summary.md
232+
PROMPT_ANALYSIS_FRAMEWORK.md
233+
ROI_Deep_Fix_Summary.md
234+
SINGLE_TEST_USAGE.md
235+
TASK_4.2_COMPLETION_SUMMARY.md
236+
237+
238+
# Testing files
239+
tests/
240+
.tox/
241+
.nox/
242+
.coverage
243+
.coverage.*
244+
.cache

LINTING_GUIDE.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Pre-Commit Linting Guide
2+
3+
## Quick Setup
4+
5+
You now have flake8 installed and configured for your project. Here's how to lint your code before pushing:
6+
7+
## Basic Commands
8+
9+
### 1. Check for Critical Errors Only (Recommended for CI/CD)
10+
```bash
11+
flake8 src/trackrealties/ --select=F821,E999
12+
```
13+
This checks for:
14+
- F821: Undefined name errors (the ones causing your CI/CD failures)
15+
- E999: Syntax errors
16+
17+
### 2. Full Linting Check
18+
```bash
19+
flake8 src/trackrealties/ --max-line-length=120
20+
```
21+
22+
### 3. Check Specific Files
23+
```bash
24+
flake8 src/trackrealties/cli.py --select=F821
25+
flake8 src/trackrealties/rag/optimized_pipeline.py --select=F821
26+
```
27+
28+
## Automated Pre-Commit Script
29+
30+
Run our custom linting script:
31+
```bash
32+
python simple_lint.py
33+
```
34+
35+
This script checks:
36+
- ✅ No undefined names (F821) or syntax errors (E999)
37+
- ✅ Python files compile successfully
38+
- ✅ Key imports work correctly
39+
40+
## Configuration
41+
42+
Your project now has a `.flake8` configuration file that:
43+
- Sets max line length to 120 characters
44+
- Ignores some cosmetic issues during development
45+
- Focuses on critical errors
46+
47+
## Recommended Workflow
48+
49+
Before committing/pushing:
50+
51+
1. **Run critical checks:**
52+
```bash
53+
python simple_lint.py
54+
```
55+
56+
2. **If that passes, you're good to push!** Your CI/CD should now pass.
57+
58+
3. **Optional: Full code style check:**
59+
```bash
60+
flake8 src/trackrealties/cli.py --max-line-length=120
61+
```
62+
63+
## What We Fixed
64+
65+
-**Fixed undefined `location` variable** in `optimized_pipeline.py` (lines 1250, 1253)
66+
-**Fixed undefined `EnhancedDataIngestionEngine`** in `cli.py` → replaced with `EnhancedIngestionPipeline`
67+
-**Fixed undefined `DataIngestionEngine`** in `cli.py` → replaced with enhanced pipeline fallback
68+
-**Fixed undefined `ListingType`** in `cli.py` → added proper import and updated enum values
69+
-**Fixed undefined `MigrationRunner`** in `cli.py` → disabled with helpful error message
70+
-**Removed missing `DataValidator`** imports → disabled with helpful error messages
71+
72+
All F821 undefined name errors have been resolved! 🎉

0 commit comments

Comments
 (0)