| from __future__ import annotations |
|
|
|
|
| MANDATORY_SAFETY_NOTES = [ |
| "Preliminary site-analysis assistant.", |
| "Verify on site.", |
| "Public data may be coarse or incomplete.", |
| "Drawn boundaries are approximate.", |
| "CAD boundary is only as reliable as the uploaded drawing.", |
| "Soil/foundation requires professional geotechnical verification.", |
| "This does not replace architect/engineer judgment.", |
| ] |
|
|
| FORBIDDEN_PHRASES = [ |
| "Use this foundation", |
| "This foundation is safe", |
| "Exact legal boundary", |
| "This soil is exact", |
| "No site visit is needed", |
| "No professional verification is needed", |
| "This design is correct", |
| ] |
|
|
|
|
| def safety_block() -> str: |
| return "\n".join(f"- {note}" for note in MANDATORY_SAFETY_NOTES) |
|
|
|
|
| def find_forbidden_phrases(text: str) -> list[str]: |
| lower = text.lower() |
| return [phrase for phrase in FORBIDDEN_PHRASES if phrase.lower() in lower] |
|
|
|
|
| def assert_safe_text(text: str) -> None: |
| found = find_forbidden_phrases(text) |
| if found: |
| raise ValueError("Unsafe report text contains: " + ", ".join(found)) |
|
|