A tool that checks the form and content of PV and device names with respect to the LCLS naming convention.
Taxons used are sourced from:
https://docs.google.com/spreadsheets/d/1u5EfR9FIvwyTieWiMkCRqpBfHj-_xm3AygjFlxxWgDc/edit?gid=0#gid=0
https://docs.google.com/spreadsheets/d/1SeQhfwZ6O-wg8tyr_MCQZY1boJC-6j3N6EzexfZB-AU/edit?gid=0#gid=0
- Python 3.9+
- Linux (RHEL or Ubuntu)
- Flask 2.2.5 (web only)
- Gunicorn 23.0.0 (web only)
In the top-level folder of your git cloned repository create a Python virtual environment and activate.
Upgrade Python to 3.9+ if needed.
Install the most recently tagged build pip install lcls_naming_tool
After following the installation instructions above, install Flask and gunicorn:
pip install Flask
pip install gunicorn
In the top-level folder of your git cloned repo create a start.sh bash file with the following lines:
export HOME_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )"
export PYTHONPATH="${HOME_DIR}/lcls_naming_tool"
cd "${HOME_DIR}/lcls_naming_tool/web"
exec gunicorn app:app -b 0.0.0.0:8080 \
From the top-level folder navigate to the folder lcls_naming_tool
.
There are two ways to check if a PV or device name is valid. It can be piped in or use the argparse command line syntax.
echo 'MR2K4:KBO:PIP:01:PUMPSIZE' | ./lcls_naming_tool.py
python lcls_naming_tool.py 'MR2K4:KBO:PIP:01:PUMPSIZE'
Similarly, there are two ways to check names in a file. It can be piped in or use the argparse command line syntax. All names in a text file should be separated by newline characters.
cat pvlist.txt | ./lcls_naming_tool.py
python lcls_naming_tool.py -f pvlist.txt
(add a flag -f
to indicate this is a file)
To use in your Python file:
- At the top of your Python file add
from lcls_naming_tool.lcls_naming_tool import load_taxons, validate
. - In your file call
load_taxons()
first.load_taxons
will load all the approved taxons in JSON format and make it available to thevalidate
function. - To check a PV or device name call the
validate()
function.validate
accepts one parameter--a PV or device name in string format--and returnsTrue
if the name is valid orFalse
if it's invalid.
To run the web server on your local machine:
From the top-level folder type ./start.sh
View the web app on your local computer at http://localhost:8080
To run the web server (ECS only):
ssh psca@psctlws01
cd /u1/psca/prod/apps/lcls_naming_tool
git pull
supervisorctl
supervisor> stop lcls_naming_tool
supervisor> start lcls_naming_tool
Website is hosted at https://pswww.slac.stanford.edu/lcls_naming_tool/