-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3640 from architecture-building-systems/3568-fastapi
Replace flask with fastapi
- Loading branch information
Showing
38 changed files
with
4,322 additions
and
2,804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ | |
__email__ = "[email protected]" | ||
__status__ = "Production" | ||
|
||
def generate_empty_surroundings(crs) -> gdf: | ||
return gdf(columns=["Name", "height_ag", "floors_ag"], geometry=[], crs=crs) | ||
|
||
|
||
def calc_surrounding_area(zone_gdf, buffer_m): | ||
""" | ||
|
@@ -189,7 +192,7 @@ def geometry_extractor_osm(locator, config): | |
if not surroundings.shape[0] > 0: | ||
print('No buildings were found within range based on buffer parameter.') | ||
# Create an empty surroundings file | ||
result = gdf(columns=["Name", "height_ag", "floors_ag"], geometry=[], crs=surroundings.crs) | ||
result = generate_empty_surroundings(surroundings.crs) | ||
else: | ||
# clean attributes of height, name and number of floors | ||
result = clean_attributes(surroundings, buildings_height, buildings_floors, key="CEA") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,23 @@ | ||
from flask import Blueprint | ||
from flask_restx import Api | ||
from .tools import api as tools | ||
from .project import api as project | ||
from .inputs import api as inputs | ||
from .dashboard import api as dashboard | ||
from .glossary import api as glossary | ||
from .databases import api as databases | ||
from .contents import api as contents | ||
from fastapi import APIRouter | ||
|
||
blueprint = Blueprint('api', __name__, url_prefix='/api') | ||
api = Api(blueprint) | ||
import cea.interfaces.dashboard.api.inputs as inputs | ||
import cea.interfaces.dashboard.api.contents as contents | ||
import cea.interfaces.dashboard.api.dashboards as dashboards | ||
import cea.interfaces.dashboard.api.databases as databases | ||
import cea.interfaces.dashboard.api.glossary as glossary | ||
import cea.interfaces.dashboard.api.project as project | ||
import cea.interfaces.dashboard.api.tools as tools | ||
import cea.interfaces.dashboard.api.weather as weather | ||
import cea.interfaces.dashboard.api.geometry as geometry | ||
|
||
api.add_namespace(tools, path='/tools') | ||
api.add_namespace(project, path='/project') | ||
api.add_namespace(inputs, path='/inputs') | ||
api.add_namespace(inputs, path='/inputs') | ||
api.add_namespace(dashboard, path='/dashboards') | ||
api.add_namespace(glossary, path='/glossary') | ||
api.add_namespace(databases, path='/databases') | ||
api.add_namespace(contents, path='/contents') | ||
router = APIRouter() | ||
|
||
|
||
@api.errorhandler | ||
def default_error_handler(error): | ||
"""Default error handler""" | ||
import traceback | ||
trace = traceback.format_exc() | ||
return {'message': str(error), 'trace': trace}, 500 | ||
router.include_router(inputs.router, prefix="/inputs") | ||
router.include_router(contents.router, prefix="/contents") | ||
router.include_router(dashboards.router, prefix="/dashboards") | ||
router.include_router(databases.router, prefix="/databases") | ||
router.include_router(glossary.router, prefix="/glossary") | ||
router.include_router(project.router, prefix="/project") | ||
router.include_router(tools.router, prefix="/tools") | ||
router.include_router(weather.router, prefix="/weather") | ||
router.include_router(geometry.router, prefix="/geometry") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.