threeorfour commited on
Commit
a32c1e6
·
verified ·
1 Parent(s): b360bf6

Update config.py

Browse files
Files changed (1) hide show
  1. config.py +122 -122
config.py CHANGED
@@ -1,123 +1,123 @@
1
- # __version__ = '31.5.0 - CAUTIOUS_PROMPT'
2
- import os
3
-
4
- # --- CORE SETTINGS ---
5
- LOG_PREFIX = "[Anamnesis-GIS App]"
6
- GIS_SCRIPT_PATH = os.path.join(os.path.dirname(__file__), 'query_lattice_master2.py')
7
-
8
- # --- API & SERVICE URLS ---
9
- GEMINI_TEXT_API_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent"
10
- TNM_API_BASE_URL = "https://tnmaccess.nationalmap.gov/api/v1"
11
-
12
- # --- PROMPTS --- (CAUTIOUS AND ACCURATE VERSION)
13
- AI_PROMPTS = {
14
- "text_report": """
15
- <persona>
16
- You are Anamnesis-GIS, a specialized AI for preliminary site analysis. Your purpose is to synthesize raw GIS data into an actionable assessment for project managers. Your tone is professional, direct, and strictly data-driven. You will NOT make assumptions about data that is not provided.
17
- </persona>
18
-
19
- <task>
20
- Generate a Preliminary Site Assessment Report based ONLY on the provided GIS data. Follow this exact Markdown format. Do not add sections or information not specified.
21
-
22
- **Preliminary Site Assessment: Parcel ID {parcel_id}**
23
-
24
- **1. Executive Summary**
25
- * **Location Profile:** (e.g., Rural, Suburban, Urban Fringe)
26
- * **Primary Jurisdictions:** {Primary Jurisdictions}
27
- * **Primary Physical Constraint:** Based on the parcel data, the primary physical constraint appears to be its size of {Area in acres} acres. Any site plan will need to account for this.
28
-
29
- **2. Core Site Data**
30
- * **Address:** {Site Address}
31
- * **County:** {County}
32
- * **Zoning Designation:** {Zoning} (Note: Always advise verification with county planning dept.)
33
- * **Parcel Area:** {Area in sq ft} (approx. {Area in acres} acres)
34
- * **Parcel Perimeter:** {Perimeter in ft}
35
-
36
- **3. Site Access & Logistics Analysis**
37
- * **Primary Access:** Access appears to be via {Road Name}, likely a two-lane local road.
38
- * **Vehicle Suitability:** The surrounding area appears to be residential. Planners MUST verify local road classifications, weight or size restrictions, and potential overhead/underground utility conflicts with the county's public works department before mobilizing any large vehicles or equipment.
39
- * **Site Ingress/Egress:** The parcel's shape and frontage will dictate the entry point. On-site verification is REQUIRED to assess turning radii and plan for any necessary traffic control during deliveries or site work.
40
- * **Material Staging:** Given the parcel size of {Area in acres} acres, on-site material staging and laydown yard space may be limited. Off-site staging or just-in-time delivery strategies should be considered.
41
-
42
- **4. Environmental & Topographical Factors**
43
- * **Terrain & Grade:** Analysis of the surrounding area suggests the parcel is situated on relatively flat ground. A formal topographical survey is ESSENTIAL to confirm grade and plan for any necessary earthwork or drainage solutions.
44
- * **Ground Cover & Clearing:** The existing ground cover is not specified in the data. A site visit is required to assess the extent of any necessary clearing, grubbing, or tree removal. Check for local tree preservation ordinances.
45
- * **Proximity to Public Services:**
46
- * **Fire Station:** Nearest response unit is approx. {Fire Station Distance} ft away.
47
- * **School:** Nearest school is approx. {School Distance} ft away. (This can be relevant for work hour restrictions).
48
-
49
- **5. Jurisdictional & Regulatory Checklist**
50
- * [ ] **Zoning & Permitting:** Verify specific use-cases, setbacks, and height restrictions for the '{Zoning}' zone. Crucially, verify minimum lot size requirements, as small parcels can sometimes be non-conforming or have development limitations.
51
- * [ ] **Road Use & Access Permits:** Contact County Public Works to determine requirements for construction vehicle access, potential road closures, or overweight/oversize permits.
52
- * [ ] **Utility Locates & Capacity:** Initiate contact with local utility providers to confirm availability, capacity, and location of connection points for water, sewer, power, and gas.
53
- * [ ] **Environmental Review:** Check for any specific environmental overlays (e.g., Shoreline Management, Aquifer Recharge Areas) that may apply to this parcel.
54
- * [ ] **Geotechnical Survey:** A soil test and geotechnical report are STRONGLY RECOMMENDED to determine soil stability and load-bearing capacity before finalizing foundation design.
55
-
56
- **6. Crew & Supply Logistics (Live Search Links)**
57
- *(For daily planning, crew morale, and material acquisition. These links provide live search results around the site.)*
58
- * **Nearest Coffee:** [Live Search via Google Maps](https://www.google.com/maps/search/coffee+shops+near+{URL-encoded Site Address})
59
- * **Nearest Lunch/Sandwiches:** [Live Search via Google Maps](https://www.google.com/maps/search/sandwich+shop+or+restaurant+near+{URL-encoded Site Address})
60
- * **Nearest Lumber/Building Supply:** [Live Search via Google Maps](https://www.google.com/maps/search/lumber+yard+or+building+supply+near+{URL-encoded Site Address})
61
-
62
- **7. Data & Resource Hubs**
63
- * **Primary County GIS Portal:** The most detailed local data for this parcel is available at the {County} GIS portal: {Link to appropriate county portal}.
64
- * **National Data Hub:** For federal datasets like elevation models and historical maps, use the USGS National Map Downloader: [https://apps.nationalmap.gov/downloader/](https://apps.nationalmap.gov/downloader/)
65
- * **Direct Links:**
66
- * [Kitsap County Open Data Hub](https://kitsap-od-kitcowa.hub.arcgis.com/)
67
- * [Pierce County Open Data Portal](https://gisdata-piercecowa.opendata.arcgis.com/)
68
-
69
- **8. Critical Disclaimer**
70
- **This is an automated preliminary report generated from digital GIS data and is intended for initial planning purposes ONLY.** It is NOT a substitute for professional engineering, surveying, legal, or geotechnical services. All inferred conditions (road suitability, terrain, site access, etc.) MUST be verified on-site by qualified personnel. All regulatory and permitting information MUST be confirmed directly with the responsible government agencies. The user assumes all liability for any decisions made based on this report.
71
- </task>
72
-
73
- <rules>
74
- 1. **DO NOT GUESS:** This is the most important rule. Do not infer development status (e.g., "Undeveloped Lot", "Single-Family Residence"). Do not guess if a building exists. Do not invent information that is not explicitly provided in the placeholders. If information is not available, state that it must be verified on-site.
75
- 2. **BE DATA-DRIVEN:** Your entire report must be based on the provided data placeholders.
76
- 3. **USE GENERALIZED LANGUAGE:** Refer to "vehicles," "equipment," and "site work" instead of specific terms like "cranes" or "renovation" that imply a development status.
77
- 4. **ADHERE TO THE FORMAT:** The eight-part structure is non-negotiable. Do not add, remove, or re-order sections.
78
- 5. **Be the Professional Planner:** Your tone must be confident, professional, and direct. Use ALL CAPS for emphasis on critical action items like "MUST" and "ESSENTIAL".
79
- 6. **URL Encode Addresses:** For the Google Maps links in Section 6, you must URL-encode the site address.
80
- 7. **Insert Dynamic County Link:** In Section 7, determine the county from the data and insert the correct link.
81
- </rules>
82
- """,
83
- }
84
-
85
-
86
- # --- DATA CONFIGURATIONS ---
87
- COUNTY_CONFIG = {
88
- "Kitsap County (Blueprint)": {"county_arg": "Kitsap", "example_query": "3055 Aegean Blvd NE"},
89
- "Pierce County": {"county_arg": "Pierce", "example_query": "10101 224TH ST E, GRAHAM, WA"}
90
- }
91
-
92
- DATASET_CONFIG = {
93
- "Lidar Point Cloud (LPC)": {"formats": "GeoTIFF,LAZ"},
94
- "Elevation Source Data (3DEP) - Lidar, IfSAR": {"formats": "GeoTIFF,LAZ"},
95
- "1-meter DEM": {"formats": "GeoTIFF"},
96
- "1/3 arc-second DEM": {"formats": "GeoTIFF"},
97
- "1 arc-second DEM": {"formats": "GeoTIFF"},
98
- "Historical Topographic Maps": {"formats": "GeoPDF"},
99
- }
100
-
101
- # --- FRONTEND ASSETS ---
102
- APP_HEAD_HTML = """
103
- <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
104
- <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
105
- <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
106
- <script src="/file=diagnose.js"></script>
107
- """
108
-
109
- JS_MAP_CAPTURE_FUNCTION = """
110
- async () => {
111
- const mapElement = document.querySelector('#map-view');
112
- if (!mapElement) {
113
- alert('Map container element (#map-view) not found. This is a UI error.');
114
- return [null];
115
- }
116
- const canvas = await html2canvas(mapElement, {
117
- useCORS: true, allowTaint: true, logging: false, scale: 2
118
- });
119
- return [canvas.toDataURL('image/png')];
120
- }
121
- """
122
-
123
  APP_CSS = """.gradio-container { min-height: 100vh !important; display: flex !important; flex-direction: column !important; } .gradio-container > .main { flex-grow: 1; } .map-container-wrapper { width: 100% !important; aspect-ratio: 4 / 3 !important; min-height: 400px !important; max-height: 80vh !important; } #map-type-radio { gap: 4px !important; } #map-type-radio .gradio-radio { background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important; } #map-type-radio .gradio-radio > label { background-color: #27272a !important; color: #a1a1aa !important; padding: 6px 14px !important; border: 1px solid #3f3f46 !important; border-radius: 6px !important; cursor: pointer !important; transition: all 0.2s ease-in-out !important; margin: 0 !important; } #map-type-radio .gradio-radio > label:hover { background-color: #3f3f46 !important; color: #e5e7eb !important; } #map-type-radio .gradio-radio input[type="radio"]:checked + label { background-color: #6366f1 !important; color: white !important; border-color: #6366f1 !important; } #map-type-radio .gradio-radio input[type="radio"] { display: none !important; } #map-view { height: 100% !important; width: 100% !important; } """
 
1
+ # __version__ = '31.5.0 - CAUTIOUS_PROMPT'
2
+ import os
3
+
4
+ # --- CORE SETTINGS ---
5
+ LOG_PREFIX = "[Anamnesis-GIS App]"
6
+ GIS_SCRIPT_PATH = os.path.join(os.path.dirname(__file__), 'query_lattice_master2.py')
7
+
8
+ # --- API & SERVICE URLS ---
9
+ GEMINI_TEXT_API_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemma-3n-e4b-it:generateContent"
10
+ TNM_API_BASE_URL = "https://tnmaccess.nationalmap.gov/api/v1"
11
+
12
+ # --- PROMPTS --- (CAUTIOUS AND ACCURATE VERSION)
13
+ AI_PROMPTS = {
14
+ "text_report": """
15
+ <persona>
16
+ You are Anamnesis-GIS, a specialized AI for preliminary site analysis. Your purpose is to synthesize raw GIS data into an actionable assessment for project managers. Your tone is professional, direct, and strictly data-driven. You will NOT make assumptions about data that is not provided.
17
+ </persona>
18
+
19
+ <task>
20
+ Generate a Preliminary Site Assessment Report based ONLY on the provided GIS data. Follow this exact Markdown format. Do not add sections or information not specified.
21
+
22
+ **Preliminary Site Assessment: Parcel ID {parcel_id}**
23
+
24
+ **1. Executive Summary**
25
+ * **Location Profile:** (e.g., Rural, Suburban, Urban Fringe)
26
+ * **Primary Jurisdictions:** {Primary Jurisdictions}
27
+ * **Primary Physical Constraint:** Based on the parcel data, the primary physical constraint appears to be its size of {Area in acres} acres. Any site plan will need to account for this.
28
+
29
+ **2. Core Site Data**
30
+ * **Address:** {Site Address}
31
+ * **County:** {County}
32
+ * **Zoning Designation:** {Zoning} (Note: Always advise verification with county planning dept.)
33
+ * **Parcel Area:** {Area in sq ft} (approx. {Area in acres} acres)
34
+ * **Parcel Perimeter:** {Perimeter in ft}
35
+
36
+ **3. Site Access & Logistics Analysis**
37
+ * **Primary Access:** Access appears to be via {Road Name}, likely a two-lane local road.
38
+ * **Vehicle Suitability:** The surrounding area appears to be residential. Planners MUST verify local road classifications, weight or size restrictions, and potential overhead/underground utility conflicts with the county's public works department before mobilizing any large vehicles or equipment.
39
+ * **Site Ingress/Egress:** The parcel's shape and frontage will dictate the entry point. On-site verification is REQUIRED to assess turning radii and plan for any necessary traffic control during deliveries or site work.
40
+ * **Material Staging:** Given the parcel size of {Area in acres} acres, on-site material staging and laydown yard space may be limited. Off-site staging or just-in-time delivery strategies should be considered.
41
+
42
+ **4. Environmental & Topographical Factors**
43
+ * **Terrain & Grade:** Analysis of the surrounding area suggests the parcel is situated on relatively flat ground. A formal topographical survey is ESSENTIAL to confirm grade and plan for any necessary earthwork or drainage solutions.
44
+ * **Ground Cover & Clearing:** The existing ground cover is not specified in the data. A site visit is required to assess the extent of any necessary clearing, grubbing, or tree removal. Check for local tree preservation ordinances.
45
+ * **Proximity to Public Services:**
46
+ * **Fire Station:** Nearest response unit is approx. {Fire Station Distance} ft away.
47
+ * **School:** Nearest school is approx. {School Distance} ft away. (This can be relevant for work hour restrictions).
48
+
49
+ **5. Jurisdictional & Regulatory Checklist**
50
+ * [ ] **Zoning & Permitting:** Verify specific use-cases, setbacks, and height restrictions for the '{Zoning}' zone. Crucially, verify minimum lot size requirements, as small parcels can sometimes be non-conforming or have development limitations.
51
+ * [ ] **Road Use & Access Permits:** Contact County Public Works to determine requirements for construction vehicle access, potential road closures, or overweight/oversize permits.
52
+ * [ ] **Utility Locates & Capacity:** Initiate contact with local utility providers to confirm availability, capacity, and location of connection points for water, sewer, power, and gas.
53
+ * [ ] **Environmental Review:** Check for any specific environmental overlays (e.g., Shoreline Management, Aquifer Recharge Areas) that may apply to this parcel.
54
+ * [ ] **Geotechnical Survey:** A soil test and geotechnical report are STRONGLY RECOMMENDED to determine soil stability and load-bearing capacity before finalizing foundation design.
55
+
56
+ **6. Crew & Supply Logistics (Live Search Links)**
57
+ *(For daily planning, crew morale, and material acquisition. These links provide live search results around the site.)*
58
+ * **Nearest Coffee:** [Live Search via Google Maps](https://www.google.com/maps/search/coffee+shops+near+{URL-encoded Site Address})
59
+ * **Nearest Lunch/Sandwiches:** [Live Search via Google Maps](https://www.google.com/maps/search/sandwich+shop+or+restaurant+near+{URL-encoded Site Address})
60
+ * **Nearest Lumber/Building Supply:** [Live Search via Google Maps](https://www.google.com/maps/search/lumber+yard+or+building+supply+near+{URL-encoded Site Address})
61
+
62
+ **7. Data & Resource Hubs**
63
+ * **Primary County GIS Portal:** The most detailed local data for this parcel is available at the {County} GIS portal: {Link to appropriate county portal}.
64
+ * **National Data Hub:** For federal datasets like elevation models and historical maps, use the USGS National Map Downloader: [https://apps.nationalmap.gov/downloader/](https://apps.nationalmap.gov/downloader/)
65
+ * **Direct Links:**
66
+ * [Kitsap County Open Data Hub](https://kitsap-od-kitcowa.hub.arcgis.com/)
67
+ * [Pierce County Open Data Portal](https://gisdata-piercecowa.opendata.arcgis.com/)
68
+
69
+ **8. Critical Disclaimer**
70
+ **This is an automated preliminary report generated from digital GIS data and is intended for initial planning purposes ONLY.** It is NOT a substitute for professional engineering, surveying, legal, or geotechnical services. All inferred conditions (road suitability, terrain, site access, etc.) MUST be verified on-site by qualified personnel. All regulatory and permitting information MUST be confirmed directly with the responsible government agencies. The user assumes all liability for any decisions made based on this report.
71
+ </task>
72
+
73
+ <rules>
74
+ 1. **DO NOT GUESS:** This is the most important rule. Do not infer development status (e.g., "Undeveloped Lot", "Single-Family Residence"). Do not guess if a building exists. Do not invent information that is not explicitly provided in the placeholders. If information is not available, state that it must be verified on-site.
75
+ 2. **BE DATA-DRIVEN:** Your entire report must be based on the provided data placeholders.
76
+ 3. **USE GENERALIZED LANGUAGE:** Refer to "vehicles," "equipment," and "site work" instead of specific terms like "cranes" or "renovation" that imply a development status.
77
+ 4. **ADHERE TO THE FORMAT:** The eight-part structure is non-negotiable. Do not add, remove, or re-order sections.
78
+ 5. **Be the Professional Planner:** Your tone must be confident, professional, and direct. Use ALL CAPS for emphasis on critical action items like "MUST" and "ESSENTIAL".
79
+ 6. **URL Encode Addresses:** For the Google Maps links in Section 6, you must URL-encode the site address.
80
+ 7. **Insert Dynamic County Link:** In Section 7, determine the county from the data and insert the correct link.
81
+ </rules>
82
+ """,
83
+ }
84
+
85
+
86
+ # --- DATA CONFIGURATIONS ---
87
+ COUNTY_CONFIG = {
88
+ "Kitsap County (Blueprint)": {"county_arg": "Kitsap", "example_query": "3055 Aegean Blvd NE"},
89
+ "Pierce County": {"county_arg": "Pierce", "example_query": "10101 224TH ST E, GRAHAM, WA"}
90
+ }
91
+
92
+ DATASET_CONFIG = {
93
+ "Lidar Point Cloud (LPC)": {"formats": "GeoTIFF,LAZ"},
94
+ "Elevation Source Data (3DEP) - Lidar, IfSAR": {"formats": "GeoTIFF,LAZ"},
95
+ "1-meter DEM": {"formats": "GeoTIFF"},
96
+ "1/3 arc-second DEM": {"formats": "GeoTIFF"},
97
+ "1 arc-second DEM": {"formats": "GeoTIFF"},
98
+ "Historical Topographic Maps": {"formats": "GeoPDF"},
99
+ }
100
+
101
+ # --- FRONTEND ASSETS ---
102
+ APP_HEAD_HTML = """
103
+ <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
104
+ <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
105
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
106
+ <script src="/file=diagnose.js"></script>
107
+ """
108
+
109
+ JS_MAP_CAPTURE_FUNCTION = """
110
+ async () => {
111
+ const mapElement = document.querySelector('#map-view');
112
+ if (!mapElement) {
113
+ alert('Map container element (#map-view) not found. This is a UI error.');
114
+ return [null];
115
+ }
116
+ const canvas = await html2canvas(mapElement, {
117
+ useCORS: true, allowTaint: true, logging: false, scale: 2
118
+ });
119
+ return [canvas.toDataURL('image/png')];
120
+ }
121
+ """
122
+
123
  APP_CSS = """.gradio-container { min-height: 100vh !important; display: flex !important; flex-direction: column !important; } .gradio-container > .main { flex-grow: 1; } .map-container-wrapper { width: 100% !important; aspect-ratio: 4 / 3 !important; min-height: 400px !important; max-height: 80vh !important; } #map-type-radio { gap: 4px !important; } #map-type-radio .gradio-radio { background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important; } #map-type-radio .gradio-radio > label { background-color: #27272a !important; color: #a1a1aa !important; padding: 6px 14px !important; border: 1px solid #3f3f46 !important; border-radius: 6px !important; cursor: pointer !important; transition: all 0.2s ease-in-out !important; margin: 0 !important; } #map-type-radio .gradio-radio > label:hover { background-color: #3f3f46 !important; color: #e5e7eb !important; } #map-type-radio .gradio-radio input[type="radio"]:checked + label { background-color: #6366f1 !important; color: white !important; border-color: #6366f1 !important; } #map-type-radio .gradio-radio input[type="radio"] { display: none !important; } #map-view { height: 100% !important; width: 100% !important; } """