happi.backends.qs_db.QSBackend

class happi.backends.qs_db.QSBackend(expname, *, url=None, use_kerberos=True, user=None, pw=None)

Questionniare Backend

This backend connects to the LCLS questionnaire and looks at items with the key pattern pcds-{}-setup-{}-{}. These fields are then combined and turned into proper happi items. The translation of table name to happi.HappiItem is determined by the translations dictionary. The beamline is determined by looking where the proposal was submitted.

Unlike the other backends, this one is read-only. All changes to the device information should be done via the web interface. Finally, in order to avoid duplicating any code needed to search the device database, the QSBackend inherits directly from JSONBackend. Many of the methods are unmodified with exception being that this backend merely searches through an in-memory dictionary whereas the JSONBackend reads from a file before searches.

Parameters
  • expname (str) – The experiment name from the elog, e.g. xcslp1915

  • url (str, optional) – Provide a base URL for the Questionnaire. If left as None the appropriate URL will be chosen based on your authentication method

  • use_kerberos (bool, optional) – Use a Kerberos ticket to login to the Questionnaire. This is the default authentication method

  • user (str, optional) – A username for ws_auth sign-in. If not provided the current login name is used

  • pw (str, optional) – A password for ws_auth sign-in. If not provided a password will be requested

__init__(expname, *, url=None, use_kerberos=True, user=None, pw=None)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(expname, *[, url, use_kerberos, …])

Initialize self.

delete(_id)

The current implementation of this backend is read-only

find(to_match)

Find an instance or instances that matches the search criteria

find_range(key, *, start[, stop])

Find an instance or instances that matches the search criteria, such that start <= entry[key] < stop.

find_regex(to_match, *[, flags])

Find an instance or instances that matches the search criteria, using regular expressions.

get_by_id(id_)

Get a device by ID if it exists, or None

initialize()

Can not initialize a new Questionnaire entry from API

load()

Return the structured dictionary of information

save(*args, **kwargs)

The current implementation of this backend is read-only

store(*args, **kwargs)

The current implementation of this backend is read-only

Attributes

all_devices

All of the devices in the database

translations