|
11 | 11 | from ..utilities import spatial_join |
12 | 12 |
|
13 | 13 |
|
14 | | -@validate_output(ParkPriorityOutputValidator) |
15 | | -def park_priority( |
| 14 | +def _park_priority_logic( |
16 | 15 | input_gdf: gpd.GeoDataFrame, |
17 | 16 | ) -> Tuple[gpd.GeoDataFrame, ValidationResult]: |
18 | 17 | """ |
19 | | - Associates properties with park priority areas for Philadelphia using TPL's FeatureServer. |
| 18 | + Core business logic for park priority processing. |
20 | 19 |
|
21 | | - This function loads park priority data from TPL's ESRI FeatureServer and performs |
22 | | - a spatial join with the input GeoDataFrame to associate properties with their |
23 | | - park priority scores. |
| 20 | + This function contains the actual logic for: |
| 21 | + - Loading park priority data from ESRI |
| 22 | + - Renaming columns |
| 23 | + - Performing spatial joins |
| 24 | + - Returning results |
| 25 | +
|
| 26 | + This function can be tested independently without the validation decorator. |
24 | 27 |
|
25 | 28 | Args: |
26 | 29 | input_gdf (gpd.GeoDataFrame): The input GeoDataFrame containing property data. |
27 | 30 |
|
28 | 31 | Returns: |
29 | 32 | Tuple[gpd.GeoDataFrame, ValidationResult]: The input GeoDataFrame with park |
30 | 33 | priority data joined and the validation result. |
31 | | -
|
32 | | - Tagline: |
33 | | - Labels high-priority park areas. |
34 | | -
|
35 | | - Columns Added: |
36 | | - park_priority (float): The park priority score from TPL's analysis. |
37 | | -
|
38 | | - Primary Feature Layer Columns Referenced: |
39 | | - opa_id, geometry |
40 | | -
|
41 | | - Source: |
42 | | - https://server7.tplgis.org/arcgis7/rest/services/ParkServe/ParkServe_ProdNew/FeatureServer/6/ |
43 | 34 | """ |
44 | 35 | start_time = time.time() |
45 | 36 | print(f"Starting park_priority function at {time.strftime('%H:%M:%S')}") |
@@ -118,3 +109,36 @@ def park_priority( |
118 | 109 | print(f"Function completed at {time.strftime('%H:%M:%S')}") |
119 | 110 |
|
120 | 111 | return merged_gdf, input_validation |
| 112 | + |
| 113 | + |
| 114 | +@validate_output(ParkPriorityOutputValidator) |
| 115 | +def park_priority( |
| 116 | + input_gdf: gpd.GeoDataFrame, |
| 117 | +) -> Tuple[gpd.GeoDataFrame, ValidationResult]: |
| 118 | + """ |
| 119 | + Associates properties with park priority areas for Philadelphia using TPL's FeatureServer. |
| 120 | +
|
| 121 | + This function loads park priority data from TPL's ESRI FeatureServer and performs |
| 122 | + a spatial join with the input GeoDataFrame to associate properties with their |
| 123 | + park priority scores. |
| 124 | +
|
| 125 | + Args: |
| 126 | + input_gdf (gpd.GeoDataFrame): The input GeoDataFrame containing property data. |
| 127 | +
|
| 128 | + Returns: |
| 129 | + Tuple[gpd.GeoDataFrame, ValidationResult]: The input GeoDataFrame with park |
| 130 | + priority data joined and the validation result. |
| 131 | +
|
| 132 | + Tagline: |
| 133 | + Labels high-priority park areas. |
| 134 | +
|
| 135 | + Columns Added: |
| 136 | + park_priority (float): The park priority score from TPL's analysis. |
| 137 | +
|
| 138 | + Primary Feature Layer Columns Referenced: |
| 139 | + opa_id, geometry |
| 140 | +
|
| 141 | + Source: |
| 142 | + https://server7.tplgis.org/arcgis7/rest/services/ParkServe/ParkServe_ProdNew/FeatureServer/6/ |
| 143 | + """ |
| 144 | + return _park_priority_logic(input_gdf) |
0 commit comments