comcheck-api 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. comcheck_api/DISCLAIMER.md +24 -0
  2. comcheck_api/__init__.py +99 -0
  3. comcheck_api/ai/__init__.py +30 -0
  4. comcheck_api/ai/skill/SKILL.md +285 -0
  5. comcheck_api/ai/skill/__init__.py +5 -0
  6. comcheck_api/ai/skill/reference/operations.md +101 -0
  7. comcheck_api/ai/skill/reference/simulation.md +99 -0
  8. comcheck_api/ai/skill/reference/types.md +90 -0
  9. comcheck_api/ai/skill/scripts/__init__.py +1 -0
  10. comcheck_api/ai/skill/scripts/validate_code.py +210 -0
  11. comcheck_api/api/__init__.py +1 -0
  12. comcheck_api/api/api_services.py +273 -0
  13. comcheck_api/cli.py +136 -0
  14. comcheck_api/client/__init__.py +1 -0
  15. comcheck_api/client/comcheck_client.py +335 -0
  16. comcheck_api/constants/__init__.py +0 -0
  17. comcheck_api/constants/building_area_constants.py +35 -0
  18. comcheck_api/constants/common_constants.py +116 -0
  19. comcheck_api/constants/envelope_constants.py +250 -0
  20. comcheck_api/defaults.py +150 -0
  21. comcheck_api/exceptions.py +54 -0
  22. comcheck_api/introspection.py +188 -0
  23. comcheck_api/managers/__init__.py +0 -0
  24. comcheck_api/managers/components/__init__.py +0 -0
  25. comcheck_api/managers/components/building_area.py +11 -0
  26. comcheck_api/managers/components/envelope/__init__.py +0 -0
  27. comcheck_api/managers/components/envelope/ag_wall.py +97 -0
  28. comcheck_api/managers/components/envelope/bg_wall.py +39 -0
  29. comcheck_api/managers/components/envelope/door.py +11 -0
  30. comcheck_api/managers/components/envelope/floor.py +11 -0
  31. comcheck_api/managers/components/envelope/roof.py +30 -0
  32. comcheck_api/managers/components/envelope/skylight.py +11 -0
  33. comcheck_api/managers/components/envelope/window.py +11 -0
  34. comcheck_api/managers/data_manager.py +369 -0
  35. comcheck_api/project_operations/__init__.py +8 -0
  36. comcheck_api/project_operations/project_building_area_operations.py +107 -0
  37. comcheck_api/project_operations/project_envelope_operations.py +899 -0
  38. comcheck_api/schemas/comCheck.schema.json +6463 -0
  39. comcheck_api/types/__init__.py +49 -0
  40. comcheck_api/types/api_types.py +127 -0
  41. comcheck_api/types/common_types.py +32 -0
  42. comcheck_api/types/core_types.py +4198 -0
  43. comcheck_api/types/custom_base_model.py +314 -0
  44. comcheck_api/utilities/__init__.py +5 -0
  45. comcheck_api/utilities/common.py +50 -0
  46. comcheck_api/utilities/envelope_utilities.py +46 -0
  47. comcheck_api/utilities/id_registry.py +79 -0
  48. comcheck_api/utilities/project_utilities.py +60 -0
  49. comcheck_api/validation.py +64 -0
  50. comcheck_api-1.0.0.dist-info/METADATA +244 -0
  51. comcheck_api-1.0.0.dist-info/RECORD +54 -0
  52. comcheck_api-1.0.0.dist-info/WHEEL +4 -0
  53. comcheck_api-1.0.0.dist-info/entry_points.txt +2 -0
  54. comcheck_api-1.0.0.dist-info/licenses/LICENSE +24 -0
@@ -0,0 +1,107 @@
1
+ """Project Building Area Operations."""
2
+
3
+ from typing import Any
4
+
5
+ from comcheck_api.constants.building_area_constants import DEFAULT_BUILDING_AREA
6
+ from comcheck_api.types.core_types import ComBuilding, WholeBldgUse
7
+
8
+ from comcheck_api.utilities.project_utilities import _require_building_area
9
+
10
+
11
+ def add_building_area_to_project(
12
+ project: ComBuilding, new_building_area: WholeBldgUse
13
+ ) -> ComBuilding:
14
+ """Add a new building area to the project using buildingAreaListManager.
15
+
16
+ Args:
17
+ project: The project object to modify
18
+ new_building_area: The building area object to add
19
+
20
+ Returns:
21
+ Updated project object with the building area added
22
+
23
+ """
24
+
25
+ updated_project = project.model_copy(deep=True)
26
+
27
+ # Ensure interiorLightingSpace is initialized
28
+ if new_building_area.interiorLightingSpace is None:
29
+ new_building_area.interiorLightingSpace = (
30
+ DEFAULT_BUILDING_AREA.interiorLightingSpace.model_copy(deep=True)
31
+ )
32
+
33
+ updated_project.lighting.append_subcomponent(new_building_area)
34
+
35
+ return updated_project
36
+
37
+
38
+ def update_building_area_in_project(
39
+ project: ComBuilding, building_area_key: str, updates: dict[str, Any] | WholeBldgUse
40
+ ) -> ComBuilding:
41
+ """Update an existing building area in the project using buildingAreaListManager.
42
+
43
+ Args:
44
+ project: The project object to modify
45
+ building_area_key: The key of the building area to update
46
+ updates: Partial updates (dict) or full building area object to apply
47
+
48
+ Returns:
49
+ Updated project object with the building area updated
50
+
51
+ """
52
+ _require_building_area(project, building_area_key)
53
+
54
+ updated_project = project.model_copy(deep=True)
55
+
56
+ updated_project.lighting.update_subcomponent_list(subcomponent_updates=updates, subcomponent_id=building_area_key, subcomponent_name="wholeBldgUse")
57
+
58
+ return updated_project
59
+
60
+ def remove_building_area_from_project(
61
+ project: ComBuilding, building_area_key: str) -> ComBuilding:
62
+ """Remove an existing building area in the project.
63
+
64
+ Args:
65
+ project: The project object to modify
66
+ building_area_key: The key of the building area to update
67
+
68
+ Returns:
69
+ Updated project object with the building area removed
70
+
71
+ """
72
+ _require_building_area(project, building_area_key)
73
+
74
+ updated_project = project.model_copy(deep=True)
75
+
76
+ updated_project.lighting.remove_from_subcomponent_list(subcomponent_id=building_area_key, subcomponent_name="wholeBldgUse")
77
+
78
+ return updated_project
79
+
80
+ def get_building_area_keys_from_project(project: ComBuilding) -> list[dict]:
81
+ """
82
+ Extract valid building area identifiers from a COMcheck project.
83
+
84
+ This function retrieves the `lighting.wholeBldgUse` field from the provided
85
+ project and returns a list of dictionaries containing each area's unique key
86
+ and description.
87
+
88
+ Args:
89
+ project (ComBuilding): The COMcheck project object.
90
+
91
+ Returns:
92
+ list[dict]: A list of dictionaries with the shape:
93
+ {
94
+ "key": <area key>,
95
+ "areaDescription": <area description>
96
+ }
97
+ """
98
+ whole_use = project.get_by_path("lighting.wholeBldgUse")
99
+
100
+ if not isinstance(whole_use, list):
101
+ return []
102
+
103
+ return [
104
+ {"key": getattr(area, "key"), "areaDescription": getattr(area, "areaDescription")}
105
+ for area in whole_use
106
+ if getattr(area, "key", None) is not None and getattr(area, "areaDescription", None) is not None
107
+ ]