nvtbs / app.py
smomtaz's picture
Update app.py
e7c5b34 verified
Raw
History Blame Contribute Delete
8.37 kB
from shared import app_dir
from utils import create_nav_button
from shiny import App, ui
import shinyswatch
from server import create_server
app_ui = ui.page_fluid(
ui.tags.style("""
.big-table {
font-size: 22px; /* Increase font size */
padding: 25px; /* Add padding for spacing */
width: 100%; /* Make the card take full width */
overflow-x: auto; /* Enable horizontal scrolling if needed */
}
.big-table table {
width: 100%; /* Make table take full width within card */
}
.title-logo-container {
display: flex;
align-items: center;
gap: 15px; /* Add some space between the logo and title */
}
.title-logo-container img {
max-height: 50px; /* Adjust logo size */
height: auto;
}
.title-logo-container h1 {
margin: 0;
font-size: 28px; /* Adjust title font size */
font-weight: bold; /* Make it bold */
}
"""),
ui.page_fillable(
ui.page_sidebar(
ui.sidebar(
ui.div(
ui.output_image("clientlogo"),
style="display: inline-block; overflow: hidden; max-height: 75px; width: 90%;"
),
ui.card(
create_nav_button(
button_icon="house",
button_label_text="Homepage",
button_link="https://rsginc-nvtbs.hf.space",
button_cls="btn btn-secondary"
),
create_nav_button(
button_icon = "route",
button_label_text = "Origin-Destination",
button_link = "https://rsginc-nvtbsod.hf.space",
#button_cls="btn btn-secondary"
),
#create_nav_button(
# button_icon = "car",
# button_label_text = "Auto Travel",
# button_link = "https://www.rsginc.com"
#),
create_nav_button(
button_icon = "house-laptop",
button_label_text = "Home-Work Location",
button_link = "https://rsginc-nvtbsdwell.hf.space"
),
create_nav_button(
button_icon = "clipboard-question",
button_label_text = "Survey",
button_link = "https://rsginc-nvtbssurvey.hf.space"
),
),
ui.div(
ui.output_image("rsglogo"),
style="display: inline-block; overflow: hidden; max-height: 40px; width: 50%;"
),
open="desktop",
),
ui.include_css(app_dir / "styles.css"),
ui.div(
ui.tags.div(
ui.h1("NAPA Valley Travels", style="margin: 0; font-size: 28px; font-weight: bold;"),
class_="title-logo-container"
),
style="padding-bottom: 20px;"
),
# Tabs inside a card
ui.card(
ui.h2("Study Scope", style="margin: 0; font-size: 28px; font-weight: bold;"),
ui.div(
ui.markdown(
"""
The Napa Valley Travel Behavior Study (TBS) builds on data received from the 2014 TBS using more cost-effective and advanced data collection tools. The TBS focuses on work, school, and other trips in Napa Valley. The study identifies how many trips per day are associated with visitors, residents and employees, where those trips start and end, and the predominant modes and times of travel. The study takes into account seasonal variations, as well as weekday and weekend travel.
Since completing the previous Napa Valley TBS in 2014, the consultant has utilized similar data collection methods but with enhancements and refinements that minimize the shortcomings of the previous approach. Through coordination with data providers, Consultants has a better understanding of available data products, including the advantages and limitations of each data source. The goal of this study is to capitalize on new data sources, be more cost-effective, and obtain a more comprehensive dataset specific to the Napa Valley.
This report describes the methodologies used to update and present a summary of the travel patterns and characteristics identified in Napa Valley. The resulting data will provide the basis for multiple planning efforts by the Napa Valley Transportation Authority (NVTA) and jurisdictions within Napa County. Such uses may include but are not limited to the refinement of the Napa Travel Model, the Short Range Transit Plan and the update of the Countywide Transportation Plan. The data is also expected to inform future transit service expansion in Napa County.
Travel surveys are the traditional approach for gathering travel behavior data since the information is more robust than a typical traffic count process. These traditional survey methods are costly and usually result in very small sample sizes. They are also prone to human error during the data collection process as well as from the survey responders who may misinterpret the questions. In order to minimize the shortcomings of traditional approaches, Consultants evaluated various innovative data collection techniques as well as enhancements to traditional methods for use in this study.
Consultants purchased Cuebiq-based origin-destination mobile device data from StreetLight Data for the TBS update, given their demonstrated experience and success supporting similar travel behavior studies across California, including the previous Napa Valley TBS. StreetLight Data was also selected because of their InSight Portal which offers a quick, convenient, and flexible method for obtaining data, as well as their ability to provide advanced metrics such as trip lengths, trip purposes, and demographic information based on observed home locations. After obtaining this data, it was scaled using newly collected traffic count data and the results were combined to provide a robust, comprehensive dataset, specific to Napa County.
"""
),
style="margin-top: 10px; font-size: 16px; line-height: 1.5;"
),
ui.h2("Visualizer Pages", style="margin: 0; font-size: 28px; font-weight: bold;"),
ui.div(
ui.markdown(
"""
The visualizer prodives the travel behaviour based on big data. The key tabs are as follows:
- **Home**: The general description of the project and the visualizer tool
- **Origin-Destination tab**: Provides detail visual information on the travel pattern observed through the big-data
- **VMT**: Provides the VMT and PMT of the trips asscociated to Napa valley trips
- **Truck**: Provides the commercial trip pattern for the Napa Valley
- **Airline**: Provides air-travel to and from Napa Valley.
"""
),
style="margin-top: 10px; font-size: 16px; line-height: 1.5;"
),
style="padding: 10px; margin-top: 20px;",
),
)
),
theme=shinyswatch.theme.spacelab,
)
app = App(app_ui, create_server(app_dir))
if __name__ == "__main__":
import asyncio
try:
app.run() # Use this for environments without a running event loop
except RuntimeError as e:
if "asyncio.run()" in str(e):
asyncio.run(app.start()) # Fallback for environments with an active event loop