Central HTML-based web application for the VHP4Safety project, providing access to tools, data, and resources for human safety assessment. The functionality of the platform is shown through three case studies.
- GUI for the Virtual Human Platform
- Multiple tools for compound, gene, and risk assessment workflows
- Interactive visualizations (Cytoscape.js, JSmol)
- Modular templates and CSS for easy customization
- RESTful API endpoints (Flask)
- Data integration from Wikidata and custom sources
- Dockerized deployment for reproducibility
├── app.py # Main Flask app
├── patch.py # Python patch for dependency fix
├── Dockerfile # Docker build instructions
├── entrypoint.sh # Entrypoint for Docker
├── requirements.txt # Python dependencies
├── routes/ # Flask blueprints & API endpoints
├── static/
│ ├── css/ # CSS stylesheets
│ ├── js/ # JavaScript files
│ ├── images/ # Logos, icons, partners
│ └── data/ # Data files (CSV, JSON)
├── templates/ # Jinja2 HTML templates
└── README.md # Project documentation
base.html: Main layout, includes navigation, header, footer, scripts, and styleshome.html: Landing page with tab descriptions, about section, partner carousel and contact formtools/tools.html: Tool catalog with search and filter functionalitytools/tool.html: Tool-specific template, dynamically filled from .json files based on URLtabs/casestudies.html: Case study catalog where user can choose between the case studiescase_studies/casestudy.html: Case study template, dynamically filled from .json files based on URLtabs/data.html: Data tab where metadata will be sharedlegal/privacypolicy.html,legal/terms_of_service.html: Pages to be filled with legal information
The new philosophy is to do as much as possible with bootstrap5 native css. Before defining new styles try to accomplish the same (or similar) with bootstrapt5. This will improve readability, maintainability, generate less unexpected behavior and makes extending the website much easier.
bootstrap-custom.css: This repo uses a custom bootstrap5 cascading style sheet to reflect vhp4safety design-choices (colors), see below.base.css: Global styles on top of bootstrap-custom that apply generally, use sparsly, ideally also let those be autogenerated via sass maps.home.css: Home page stylestools.css,tool.css: Tool and service card stylescasestudies.css: Case study stylesqaop_app.css: qAOP app and Cytoscape visualizationshackathondemo.css: Hackathon demo page styles (not sure if still in use?)
Create a custom color compiled version of bootstrap5.
cd bootstrap-custom
npm install bootstrap sass --save-devCustomize custom.scss for example with additional colors or padding specs etc.
Then compile to css with
bootstrap-custom % npx sass --load-path=node_modules custom.scss bootstrap-custom.css
Move bootstrap-custom.css to static/css.
app.py: Main Flask application, routing, and renderingroutes/aop_app.py: API endpoints for AOP tools and datapatch.py: Patch script to fix dependency issues (e.g., pyshexc)requirements.txt: Python dependenciesDockerfile&entrypoint.sh: Containerization and startup
- Backend: Python 3.10+, Flask, requests, wikidataintegrator, pyBiodatafuse
- Frontend: HTML5, Jinja2, CSS3, JavaScript (Cytoscape.js, JSmol)
- Containerization: Docker
- Data: CSV, JSON, integration with Wikidata
- Clone the repository:
git clone https://github.com/VHP4Safety/ui-design.git cd ui-design - Install Python dependencies:
pip install -r requirements.txt - Apply the patch (required for pyshexc):
python patch.py
Run the following command in your terminal:
python app.py
The application will be available at http://localhost:5050/.
Build and run the Docker container:
docker build -t vhp4safety_ui .
docker run -d -p 5000:5050 vhp4safety_ui
The application will be available at http://localhost:5001/.
This web app uses a dynamic content loading approach for both the tool and case study pages:
-
Routes in
app.py:- The route
/tools/<toolname>renderstools/tool.htmland passes the relevant JSON filename to the template. - The route
/casestudies/<case>renderscase_studies/casestudy.htmland passes the case name to the template.
- The route
-
HTML Templates:
tools/tool.htmlandcase_studies/casestudy.htmlare designed to be generic containers. They do not contain hardcoded content for each tool or case study.- Instead, they include JavaScript that loads and displays content dynamically based on the URL.
-
JavaScript Files:
- A script (
tool.jsandcasestudies.js) fetches the appropriate JSON file (such asstatic/data/tool/qaopapp_content.json) using the name from the URL. It then updates the HTML elements with the content from that file.
- A script (
-
JSON Files:
- Each tool and case study has its own JSON file containing all the content and metadata needed for the page.
- The JavaScript reads these files and populates the HTML elements, enabling a single template to serve multiple tools or case studies.
This technique allows for easy expansion and maintenance: new tools or case studies can be added simply by creating new JSON files, without modifying the HTML or Python backend.
- Fork the repository on GitHub
- Clone your fork locally
- Create a new branch for your feature or fix
- Make your changes and commit them
- Push your branch to your fork
- Open a Pull Request to the main repository
Please ensure your code is well-documented and tested. For major changes, discuss with the team first.