This is the backend Flask API for the DOM Mobility project developed by Ulysses Echeverria. It enables users to query and visualize data stored in a PostgreSQL database (domdb). The application provides a search interface to filter mobility-related chemical compound records and allows viewing corresponding fragment data via hyperlinks.
- Filter mobility data by:
mz_exp(experimental m/z value)mz_calc(calculated m/z value)mz_error_ppm(parts-per-million error)chem_formulaorigin
- Clickable
mz_expvalues that link to matching fragment records - Clean tabular HTML display for both mobility and fragment data
- Structured Python code with inline documentation
- Flask-based web server running locally
This code is written with clarity and future collaboration in mind. Each component of the code is documented to ensure maintainability. The application is designed to be easily integrated with a frontend component or extended for research workflows.
Open a terminal and clone the GitHub repository:
git clone https://github.com/pcdslab/mobility-web-app.git
cd mobility-web-apppython3 -m venv venv
source venv/bin/activateIf you're using Windows:
venv\Scripts\activateInstall the required libraries:
pip install -r requirements.txtIf requirements.txt is missing, you can create it manually:
pip install Flask psycopg2
pip freeze > requirements.txtEnsure your PostgreSQL database is accessible with the following settings:
- Host:
localhost - Port:
5433 - Database:
domdb - User:
domuser - Password:
Password
These values are defined in app.py:
DB_CONFIG = {
'host': 'localhost',
'port': 5433,
'dbname': 'domdb',
'user': 'domuser',
'password': 'Password'
}Ensure PostgreSQL is running and listening on port 5433, and the mobility_data and fragments_data tables are properly loaded.
From the root of the repository:
python app.pyYou should see an output like:
Running on http://127.0.0.1:8000
Now open your browser to:
http://127.0.0.1:8000/filter
- Access
/filterendpoint. - Provide values for
mz_exp,chem_formula, and/or other filters. - Submit the form to see matching mobility records.
- Click on a
mz_expvalue to view corresponding fragment records.
This backend is part of a collaborative project. The frontend integration is managed by other team members. If you're extending the backend, feel free to open an issue or pull request.
To contribute:
git checkout -b feature-name
# Make your changes
# Commit and pushMIT License.