Skip to content

als-computing/splash-userservice

Repository files navigation

Purpose

This project is intended to serve as an API for Scientific User Facilities to have a common way to access user and group information.

It is intended that the code in models and api would be the front-end interface, and facility-specific APIs would could then write specific code that maps to those model classes.

Installation

This project uses uv for dependency management. Install the project with:

uv sync              # Install all dependencies
uv sync --group dev  # Install with development dependencies

Or in editable mode:

uv pip install -e .

Running the API Server

A FastAPI server is included that documents the APIs with an interactive OpenAPI page:

pip install -e .
uvicorn splash_userservice.api:app

Once started, you can navigate to the page at http://localhost:8000/docs

Testing

Testing with test_user.py

The scripts/test_user.py script allows you to test the ALSHubService directly by querying user information:

python scripts/test_user.py <ORCID_OR_EMAIL> [OPTIONS]

Options:

  • --type {orcid,email} or -t {orcid,email}: Specify identifier type (default: orcid)
  • --no-groups: Skip fetching groups, proposals, ESAFs, and beamline roles

Examples:

# Fetch user by ORCID
python scripts/test_user.py 0000-0002-1539-0297

# Fetch user by email
python scripts/test_user.py user@example.com --type email

# Fetch user without groups
python scripts/test_user.py 0000-0002-1539-0297 --no-groups

# Get help
python scripts/test_user.py --help

The script outputs the user information as JSON and logs all requests/responses to stderr. To see debug output (full URLs and response bodies), the logging is configured to show ALSHub service debug messages.

Testing with test_user.sh (bash alternative)

A bash version is also available at scripts/test_user.sh for making direct HTTP requests:

./scripts/test_user.sh <ORCID> [LBNL_ID]

Environment variables:

  • ALSHUB_BASE: ALSHub base URL (default: https://alsusweb.lbl.gov)
  • ESAF_BASE: ESAF base URL (default: https://als-esaf.als.lbl.gov)
  • INSECURE_TLS: Set to false for strict TLS verification (default: true for insecure)
  • ORCID_ID: Override ORCID (default: 0000-0000-0000-0000)
  • SKIP_LBNL_REQUIRED_CALLS: Skip proposals/ESAF calls if LBNLID not found

This project in a very early stage. Te NSLS-II Scipy Cookiecutter was used to start the project, but much is not yet being taken advantage of (especially documentation).

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages