civilpy.state.ohio.DOT package
Submodules
civilpy.state.ohio.DOT.AssetWise module
civilpy.state.ohio.DOT.aw_fields module
civilpy.state.ohio.DOT.boring_logs module
civilpy.state.ohio.DOT.bridge module
civilpy.state.ohio.DOT.legacy module
CivilPy Copyright (C) 2019-2026 - Dane Parks
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class civilpy.state.ohio.DOT.legacy.TimsBridge(sfn)[source]
Bases:
objectGeneral Bridge object to hold data from ODOT TIMS REST SERVER, also contains mapping function which can be used in jupyter to determine location
- civilpy.state.ohio.DOT.legacy.convert_latitudinal_values(latitude)[source]
Takes a Longitude in degree minutes seconds, converts it to decimal, prints an error if it’s not in North America
return: converted value
- civilpy.state.ohio.DOT.legacy.convert_longitudinal_values(longitude)[source]
Takes a Longitude in degree minutes seconds, converts it to decimal, prints an error if it’s not in North America
return: converted value
- civilpy.state.ohio.DOT.legacy.convert_place_code(code)[source]
NOTE: There is no coversion here, the SNBI update still uses FIPS Place codes, but those aren’t readable so here’s how to convert them, it also checks for bad values.
Takes in bridge SFN, returns FIPS County Code location conversion,
NOTE: Currently only Ohio FIPS definitions are loaded (ohio_fips). Multi-state support would require loading the full FIPS dataset (available from census.gov) and filtering by state code before lookup.
returns: Human readable version of 5 digit fips code
- civilpy.state.ohio.DOT.legacy.filter_files_by_category(file_list, label_set)[source]
Takes a list of files, and determines if any of them contain the labels specific to bridge files from ODOT CADD standards.
- Parameters:
file_list – An unfiltered list of all files to be searched
label_set – The category of file you want returned, from the keys in the “all_labels” dictionary above
- Return category_files:
a list of files containing relevant category info
- civilpy.state.ohio.DOT.legacy.get_bridge_data_from_tims(sfn: str = '6500609')[source]
Function to return Bridge data from ODOT TIMS REST server
- Param:
sfn (str): Bridge structure file number
- Returns:
A dictionary containing all the values relevant to the desired bridge
- civilpy.state.ohio.DOT.legacy.get_cty_from_code(cty_code, st_code)[source]
NOTE: County codes can be verified against GPS coordinates via reverse geocoding (e.g., geopy/nominatim). Generalize by replacing the hardcoded state lookup with a state-code-keyed FIPS county dict loaded from the full census.gov FIPS dataset.
returns: 3 character numeric county code
- civilpy.state.ohio.DOT.legacy.get_historic_bridge_data(sfn=2701464, state='Ohio')[source]
Gets historic bridge values for a given sfn
NOTE: Reads from a flat CSV on first call every time. A local SQLite cache of the NBI data would significantly speed up repeated lookups for large analyses.
- civilpy.state.ohio.DOT.legacy.get_project_data_from_tims(pid: str = '96213')[source]
Uses the TIMS REST API to return json values for a given bridge sfn.
- :parameter
pid (str): Project ID number used to look up project points (PID)
- Returns:
dict containing the project points and the number of points
- civilpy.state.ohio.DOT.legacy.help_function()[source]
To use the dicts, import them into python, and then use the two-letter code to get the translations, i.e. basemap_labels[‘BA’] will return “Aerial Mapping”
General Notes:
General File Naming Format:
nnnnn(n)_aa###.dgn where: nnnnnn - 5 (or 6) digit PID aa - Two-letter code signifying sheet type (see dicts) ### - Three digit number identifying the number of drawings of the same type
- Bridge Design File Naming Format:
- nnnnnn_SFNyyyyyyy_aa###.dgn where:
nnnnnn - PID yyyyyyy - 7 digit SFN of the structure aa - Two character bridge plan sheet type ### - Three digit number identifying the number of drawings of the same type
- Culvert Design File Naming Format:
- nnnnnn_CFNyyyyyyy_aa###.dgn where:
nnnnnn - PID yyyyyyy - 7 digit CFN number of the culvert aa - Two character drainage plan sheet type ### - Three digit number identifying the number of drawings of the same type
- Wall Design File Naming Format:
- nnnnnn_WALLyyy_aa###.dgn where:
nnnnnn - PID yyy - Three digit wall number aa - Two digit wall plan sheet type ### - Three digit number identifying the number of drawings of the same type
civilpy.state.ohio.DOT.ODOT_Inspection_Photo_DL module
civilpy.state.ohio.DOT.odot_concrete_slab_generator module
Lookup bridge deck parameters from Ohio DOT standards Inputs: span_length (int), continuous_span (bool), over_side_drainage (bool) Outputs: thickness, bar parameters, top_cover, drainage/parapet parameters
- civilpy.state.ohio.DOT.odot_concrete_slab_generator.generate_a_bars(span_length, a_bar_size, a_bar_spacing, deck_thickness, deck_width=24.0, bot_cover=1.5, top_cover=2.0)[source]
Generate A-bar geometry (bottom tensile bars running transverse across span). A-bars have 180-degree development hooks at both ends per ACI 318. This “U-hook” is formed by two 90-degree bends.
This is the version that produced the “Closer,” image (ee6221.png)
- Parameters:
span_length – Span length in feet
a_bar_size – Bar size number (diameter in 8ths of inch)
a_bar_spacing – Spacing in inches
deck_thickness – Total slab thickness in inches
deck_width – Bridge deck width in feet (default: 24’)
bot_cover – Bottom concrete cover in inches (default: 1.5”)
top_cover – Top concrete cover in inches (default: 2.0”)
- Returns:
List of Rhino Breps (pipes) or None if not in Rhino environment
- civilpy.state.ohio.DOT.odot_concrete_slab_generator.get_aci_bend_radius(bar_size: int) float[source]
Get the ACI 318 minimum bend radius to the centerline of the bar. (ACI specifies inside bend radius, so we add 0.5 * diameter)
- Parameters:
bar_size – Bar size number (e.g., 8 for #8)
- Returns:
Centerline bend radius in inches
- civilpy.state.ohio.DOT.odot_concrete_slab_generator.get_deck_parameters(span_length: int, continuous_span: bool = False, over_side_drainage: bool = True) dict[source]
Retrieve bridge deck parameters based on span length and bridge type.
- Parameters:
span_length – Span length in feet (int)
continuous_span – Whether to use continuous span data (default: False for simple span)
over_side_drainage – Whether to use over_side_drainage (True) or parapet (False) parameters
- Returns:
Dictionary containing all deck parameters
civilpy.state.ohio.DOT.OSE module
civilpy.state.ohio.DOT.Rhino module
- civilpy.state.ohio.DOT.Rhino.display_brep(brep, color='lightblue', opacity=1.0)[source]
Convert a Rhino BREP geometry to a triangulated mesh and display it interactively.
Tessellates the BREP using Rhino’s default meshing parameters, converts all faces to triangles, then renders the result as a Plotly
Mesh3dfigure with a 1:1:1 aspect ratio. Intended for use inside a Jupyter notebook withrhinoinsideloaded.- Parameters:
- Returns:
Calls
fig.show()directly; does not return the figure.- Return type:
None
Note
Requires
rhinoinsideto be loaded before calling this function. The module-levelrhinoinside.load()call handles this when the module is imported in a Rhino-enabled environment.
civilpy.state.ohio.DOT.plan_splitter module
civilpy.state.ohio.DOT.stage_2_comments module
civilpy.state.ohio.DOT.TIMS module
- class civilpy.state.ohio.DOT.TIMS.TIMSBridge(sfn: str)[source]
Bases:
objectRepresents a single bridge from the TIMS database, fetched by its SFN. Attributes are dynamically created from the fetched data keys (converted to lowercase).
Example
bridge = TIMSBridge(‘2102374’) print(bridge.lanes) # Access data as attributes
- __init__(sfn: str)[source]
Initializes the TIMSBridge object by fetching data for the given SFN.
- Parameters:
sfn (str) – The Structure File Number (SFN) of the bridge to fetch.
- Raises:
ValueError – If no bridge is found for the specified SFN.
RuntimeError – If there is a network or API error.
- civilpy.state.ohio.DOT.TIMS.get_bridge_sfns_by_district(district=None, url='https://tims.dot.state.oh.us/ags/rest/services/Assets/Bridge_Inventory/MapServer/0/query')[source]
Queries the TIMS API for bridges in a specific district and returns a list of SFNs.
- civilpy.state.ohio.DOT.TIMS.get_tims_data(data_source='Roadway')[source]
Download all records from an ODOT TIMS ArcGIS MapServer layer into a DataFrame.
Paginates through the service in batches of 1000 records until all features are retrieved. Prints progress to stdout.
- Parameters:
data_source (str) –
Which TIMS layer to query. One of:
'Roadway'— Roadway Information layer (default)'Bridge'— Bridge Assets layer
- Returns:
All feature attributes from the selected layer, one row per feature. Returns an empty DataFrame if no records are found.
- Return type:
Example
>>> df = get_tims_data('Bridge') >>> 'SFN' in df.columns True
civilpy.state.ohio.DOT.title_sheet module
- civilpy.state.ohio.DOT.title_sheet.convert_excel_to_json(excel_path: str, save_and_open: bool = True)[source]
Reads a user-cleaned Excel file and generates a clean JSON object.
- civilpy.state.ohio.DOT.title_sheet.export_for_review(result: dict)[source]
Pre-cleans the OCR data, saves the cleaned DataFrame to Excel and the cropped image to a file, then opens both for manual user review.
- civilpy.state.ohio.DOT.title_sheet.extract_drawing_data(file_path: str, model_path: str, target_label: str = None, page_number: int = 1) dict[source]
Main importable function to run the extraction workflow on a single file.
This function processes a PDF, image, or pre-cleaned Excel file and returns the extracted drawing data in a structured dictionary format.
- Parameters:
file_path (str) – The full path to the input file (PDF, image, or Excel).
model_path (str) – The full path to the trained model file.
target_label (str, optional) – A specific label to extract. If None, the function will search for all known labels.
page_number (int, optional) – The 1-based page number to process in a PDF. Defaults to 1. Ignored for image files.
- Returns:
- A dictionary containing the extracted data. If multiple labels are
processed, the keys are the labels. Returns an empty dict on failure.
- Return type:
- civilpy.state.ohio.DOT.title_sheet.extract_table_or_text(pdf_path, bounding_box_info)[source]
Uses a bounding box to extract a table with Camelot. If it fails, it falls back to extracting a structured table with OCR.
- civilpy.state.ohio.DOT.title_sheet.find_section_in_image(model, image_obj_or_path, target_label)[source]
Finds a labeled section in an image and returns a dictionary of information.
- civilpy.state.ohio.DOT.title_sheet.find_section_in_pdf(model, pdf_path, target_label, page_number=1)[source]
Finds a labeled section in a PDF and returns its coordinates and related info. This function performs inference but does not display output.
- civilpy.state.ohio.DOT.title_sheet.get_model(num_classes)[source]
Defines the Faster R-CNN model architecture. This must be identical to the function in your training script.
- civilpy.state.ohio.DOT.title_sheet.load_trained_model(model_path)[source]
Loads the trained model weights and prepares it for inference.
- civilpy.state.ohio.DOT.title_sheet.ocr_image_table_to_dataframe(image_obj: Image) DataFrame[source]
Performs OCR on a PIL Image object containing a table and reconstructs it into a pandas DataFrame.