From 5b227fe72673a4ebb9c3dcffb38c9fb8504dda9c Mon Sep 17 00:00:00 2001 From: yanz571 Date: Fri, 16 Oct 2026 14:46:15 -0700 Subject: [PATCH] backstop feature --- CHANGELOG.md | 15 +++++++++++++++ comcheck_api/ai/skill/SKILL.md | 3 +++ comcheck_api/ai/skill/reference/compliance.md | 3 +++ comcheck_api/api/api_services.py | 3 ++- comcheck_api/client/comcheck_client.py | 4 ++++ docs_site/api/compliance.md | 11 +++++++++++ examples/README.md | 1 + examples/client/compliance_and_report.py | 9 +++++++-- pyproject.toml | 2 +- uv.lock | 2 +- 10 files changed, 48 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83729c8..95c0034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to this project are documented in this file. +## [2.1.0] - 2026-10-16 + +### Added + +- **`use_backstop_compliance` option for `generate_report()`.** Set + `use_backstop_compliance=True` to evaluate the report using envelope backstop + compliance; the generated PDF then includes an Envelope Backstop Compliance + Certificate page. Sent to the API as `useBackstopCompliance` and defaults to + `False`, so existing calls are unchanged. + +### Documentation + +- Documented the backstop compliance option in the Compliance & Reports page, + the AI skill references, and `examples/client/compliance_and_report.py`. + ## [2.0.1] - 2026-09-18 Reverts the enum renames introduced in 2.0.0. If you updated code to use the diff --git a/comcheck_api/ai/skill/SKILL.md b/comcheck_api/ai/skill/SKILL.md index 8b95078..570bbcb 100644 --- a/comcheck_api/ai/skill/SKILL.md +++ b/comcheck_api/ai/skill/SKILL.md @@ -370,6 +370,9 @@ report = client.generate_report(project, download=True, download_dir="./out") report = client.generate_report( project, envelope=True, intlighting=True, extlighting=False, mechanical=True ) + +# Use backstop compliance (defaults to False) +report = client.generate_report(project, use_backstop_compliance=True) ``` `generate_report` deliberately does **not** open a browser — it's a diff --git a/comcheck_api/ai/skill/reference/compliance.md b/comcheck_api/ai/skill/reference/compliance.md index b9d8da2..cfe65a7 100644 --- a/comcheck_api/ai/skill/reference/compliance.md +++ b/comcheck_api/ai/skill/reference/compliance.md @@ -61,6 +61,7 @@ client.generate_report( extlighting=True, intlighting=True, mechanical=True, + use_backstop_compliance=False, download=False, download_dir=None, ) @@ -68,6 +69,8 @@ client.generate_report( - The four section flags toggle which sections appear in the report (all default to `True`). +- `use_backstop_compliance=True` evaluates the report using backstop + compliance (sent to the API as `useBackstopCompliance`; defaults to `False`). - `download=True` fetches the PDF from the presigned URL and saves it using the server-provided `fileName`. `download_dir` defaults to the user's `~/Downloads` folder. diff --git a/comcheck_api/api/api_services.py b/comcheck_api/api/api_services.py index d0832e0..3af3421 100644 --- a/comcheck_api/api/api_services.py +++ b/comcheck_api/api/api_services.py @@ -327,7 +327,8 @@ def generate_report(self, report_data: Dict[str, Any]) -> Dict[str, Any]: Args: report_data: The report request body, containing ``building`` (the project data) and the ``envelope``, ``extlighting``, - ``intlighting``, and ``mechanical`` section flags. + ``intlighting``, and ``mechanical`` section flags, plus the + ``useBackstopCompliance`` flag. Returns: API response as a dictionary with ``url`` (the presigned S3 URL), diff --git a/comcheck_api/client/comcheck_client.py b/comcheck_api/client/comcheck_client.py index eb03235..f45e287 100644 --- a/comcheck_api/client/comcheck_client.py +++ b/comcheck_api/client/comcheck_client.py @@ -363,6 +363,7 @@ def generate_report( extlighting: bool = True, intlighting: bool = True, mechanical: bool = True, + use_backstop_compliance: bool = False, download: bool = False, download_dir: Optional[str] = None, ) -> Optional[Dict[str, Any]]: @@ -382,6 +383,8 @@ def generate_report( extlighting: Whether to include the exterior lighting section. intlighting: Whether to include the interior lighting section. mechanical: Whether to include the mechanical section. + use_backstop_compliance: Whether to evaluate the report using + backstop compliance (sent as ``useBackstopCompliance``). download: When ``True``, fetch the PDF from the presigned URL and save it using the server-provided ``fileName``. download_dir: Directory to save the PDF into when *download* is @@ -397,6 +400,7 @@ def generate_report( "extlighting": extlighting, "intlighting": intlighting, "mechanical": mechanical, + "useBackstopCompliance": use_backstop_compliance, } response = self._service.generate_report(report_data) if response and download: diff --git a/docs_site/api/compliance.md b/docs_site/api/compliance.md index 06ed6f4..c7f329c 100644 --- a/docs_site/api/compliance.md +++ b/docs_site/api/compliance.md @@ -107,6 +107,17 @@ report = client.generate_report( ) ``` +### Backstop compliance + +Pass `use_backstop_compliance=True` to evaluate the report using envelope +backstop compliance. The report then includes an additional **Envelope Backstop +Compliance Certificate** page. Defaults to `False`; the flag is sent to the API +as `useBackstopCompliance`. + +```python +report = client.generate_report(project, use_backstop_compliance=True) +``` + ### Downloading the PDF Pass `download=True` to fetch the PDF from the presigned URL and save it using diff --git a/examples/README.md b/examples/README.md index 7a0475d..1d9ed53 100644 --- a/examples/README.md +++ b/examples/README.md @@ -45,6 +45,7 @@ Demonstrates compliance checks, requirements lookup, and PDF report generation. - `check_UA_compliance()` - Checking code compliance for a project - `check_requirements()` - Retrieving applicable requirements - `generate_report()` - Generating a PDF report (presigned S3 URL, optional download) +- `generate_report(use_backstop_compliance=True)` - Generating a report using backstop compliance **Usage:** ```bash diff --git a/examples/client/compliance_and_report.py b/examples/client/compliance_and_report.py index 431974a..232c433 100644 --- a/examples/client/compliance_and_report.py +++ b/examples/client/compliance_and_report.py @@ -16,7 +16,7 @@ If your project only needs to verify the envelope trade-off path, Example 1 is sufficient. If you need an ASHRAE 90.1 Compliance Check determination (e.g. to generate an -official report), run Example 1 first; if it passes, proceed with Example 6. +official report), run Example 1 first; if it passes, proceed with Example 7. """ import os @@ -67,7 +67,12 @@ if report: print(f"Saved report to ./reports/{report['fileName']}") -# Example 6: ASHRAE 90.1 Compliance Check (ASHRAE 90.1-based codes) +# Example 6: Generate a report using backstop compliance (defaults to False) +report = client.generate_report(project, use_backstop_compliance=True) +if report: + print(f"Backstop compliance report: {report['fileName']}") + +# Example 7: ASHRAE 90.1 Compliance Check (ASHRAE 90.1-based codes) # For a complete compliance determination, first verify the UA path passes, # then run the full simulation. ua_result = client.check_UA_compliance(project) diff --git a/pyproject.toml b/pyproject.toml index 58e8eda..9e2b973 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "comcheck_api" -version = "2.0.1" +version = "2.1.0" description = "COMcheck API Python Package" readme = "README.md" requires-python = ">=3.12" diff --git a/uv.lock b/uv.lock index 8dd8b9b..8a0f922 100644 --- a/uv.lock +++ b/uv.lock @@ -217,7 +217,7 @@ wheels = [ [[package]] name = "comcheck-api" -version = "2.0.1" +version = "2.1.0" source = { editable = "." } dependencies = [ { name = "httpx" },