Models

class mxlive.lims.models.Beamline(*args, **kwargs)[source]

A Beamline object should be created for every unique facility that will be uploading data or reports, or has its own automounter layout.

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • acronym (CharField) – Acronym

  • energy_lo (FloatField) – Energy lo

  • energy_hi (FloatField) – Energy hi

  • contact_phone (CharField) – Contact phone

  • active (BooleanField) – Active

exception DoesNotExist
exception MultipleObjectsReturned
active_automounter()[source]

Returns the container referenced by the active dewar pointing to the beamline.

active_dewar()[source]

Returns the first active dewar pointing to the beamline. Generally, there should only be one active dewar referencing each beamline.

active_session()[source]

Returns the session that is currently running on the beamline, if there is one.

class mxlive.lims.models.Dewar(*args, **kwargs)[source]

A through-model relating a Beamline object to a Container object. The container referenced here should be the one that samples or containers can be added to during a Project’s beamtime. If a beamline has multiple containers (ie. Dewar objects), only the current one should be marked ‘active’.

Parameters
  • id (AutoField) – Id

  • beamline_id (ForeignKey) – Beamline

  • container_id (ForeignKey) – Container

  • staff_comments (TextField) – Staff comments

  • modified (DateTimeField) – Date modified

  • active (BooleanField) – Active

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.Project(id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined, name, contact_person, contact_email, carrier, account_number, department, address, city, province, postal_code, country, contact_phone, contact_fax, organisation, show_archives, key, kind, alias, created, modified, updated)[source]
Parameters
  • id (AutoField) – Id

  • password (CharField) – Password

  • last_login (DateTimeField) – Last login

  • is_superuser (BooleanField) – Designates that this user has all permissions without explicitly assigning them.

  • username (CharField) – Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.

  • first_name (CharField) – First name

  • last_name (CharField) – Last name

  • email (EmailField) – Email address

  • is_staff (BooleanField) – Designates whether the user can log into this admin site.

  • is_active (BooleanField) – Designates whether this user should be treated as active. Unselect this instead of deleting accounts.

  • date_joined (DateTimeField) – Date joined

  • name (SlugField) – Name

  • contact_person (CharField) – Contact person

  • contact_email (EmailField) – Contact email

  • carrier_id (ForeignKey) – Carrier

  • account_number (CharField) – Account number

  • department (CharField) – Department

  • address (CharField) – Address

  • city (CharField) – City

  • province (CharField) – Province

  • postal_code (CharField) – Postal code

  • country (CharField) – Country

  • contact_phone (CharField) – Contact phone

  • contact_fax (CharField) – Contact fax

  • organisation (CharField) – Organisation

  • show_archives (BooleanField) – Show archives

  • key (TextField) – Key

  • kind_id (ForeignKey) – Project type

  • alias (CharField) – Alias

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

  • updated (BooleanField) – Updated

exception DoesNotExist
exception MultipleObjectsReturned
save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class mxlive.lims.models.Carrier(*args, **kwargs)[source]

A Carrier object should be created for each courier company that may be used for shipping to the beamline. To link to shipment tracking, provide a URL that can be completed using a tracking number to link to a courier-specific tracking page.

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • url (URLField) – Url

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.Shipment(id, name, staff_comments, created, modified, status, project, comments, tracking_code, return_code, date_shipped, date_received, date_returned, carrier, storage_location)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • staff_comments (TextField) – Staff comments

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

  • status (IntegerField) – Status

  • project_id (ForeignKey) – Project

  • comments (TextField) – Comments

  • tracking_code (CharField) – Tracking code

  • return_code (CharField) – Return code

  • date_shipped (DateTimeField) – Date shipped

  • date_received (DateTimeField) – Date received

  • date_returned (DateTimeField) – Date returned

  • carrier_id (ForeignKey) – Carrier

  • storage_location (CharField) – Storage location

exception DoesNotExist
exception MultipleObjectsReturned
shipping_errors()[source]

Returns a list of descriptive string error messages indicating the Shipment is not in a ‘shippable’ state

class mxlive.lims.models.ContainerType(*args, **kwargs)[source]

A ContainerType should be defined for each container that has a unique layout. (e.g. Uni-Puck, Adaptor, Autmounter, etc.)

Parameters
  • envelope (CharField) – ‘rect’ or ‘circle’ are supported. If ‘rect’, location__name lists are assumed to be [x, y] coordinates relative to width and height. If ‘circle’, location__name value lists are assumed to be polar coordinates [r, theta], relative to width.

  • radius (FloatField) – radius of the circle (in range(0,100)) to draw for each location.

  • height (FloatField) – provides the aspect ratio of the envelope, relative to a default width of 1.

  • id (AutoField) – Id

  • name (CharField) – Name

  • layout (JSONField) – Layout

  • height – Height

  • radius – Radius

  • envelope – Envelope

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.ContainerLocation(id, name, kind, x, y)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • kind_id (ForeignKey) – Kind

  • x (FloatField) – X

  • y (FloatField) – Y

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.Container(id, name, staff_comments, created, modified, status, project, kind, shipment, comments, priority, parent, location)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • staff_comments (TextField) – Staff comments

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

  • status (IntegerField) – Status

  • project_id (ForeignKey) – Project

  • kind_id (ForeignKey) – Kind

  • shipment_id (ForeignKey) – Shipment

  • comments (TextField) – Comments

  • priority (IntegerField) – Priority

  • parent_id (ForeignKey) – Parent

  • location_id (ForeignKey) – Location

exception DoesNotExist
exception MultipleObjectsReturned
get_layout(with_samples=True)[source]

Generate a nested dictionary of data representing the hierarchy of containers and samples :param with_samples: Whether to include sample information or not :return: dictionary

placeholders()[source]

Generate a list of container locations that can hold samples or samples contained in the container.

class mxlive.lims.models.Group(id, name, staff_comments, created, modified, project, status, shipment, energy, resolution, kind, absorption_edge, plan, comments, priority)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • staff_comments (TextField) – Staff comments

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

  • project_id (ForeignKey) – Project

  • status (IntegerField) – Status

  • shipment_id (ForeignKey) – Shipment

  • energy (DecimalField) – Energy

  • resolution (FloatField) – Desired resolution (Å)

  • kind (IntegerField) – Exp. type

  • absorption_edge (CharField) – Absorption edge

  • plan (IntegerField) – Plan

  • comments (TextField) – Comments

  • priority (IntegerField) – Priority

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.Sample(id, name, staff_comments, created, modified, project, barcode, container, location, comments, collect_status, priority, group)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • staff_comments (TextField) – Staff comments

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

  • project_id (ForeignKey) – Project

  • barcode (SlugField) – Barcode

  • container_id (ForeignKey) – Container

  • location_id (ForeignKey) – Location

  • comments (TextField) – Comments

  • collect_status (BooleanField) – Collect status

  • priority (IntegerField) – Priority

  • group_id (ForeignKey) – Group

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.Data(id, name, staff_comments, created, modified, status, project, group, sample, session, start_time, end_time, file_name, frames, num_frames, frames_per_file, exposure_time, attenuation, energy, beamline, beam_size, url, kind, download, meta_data)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • staff_comments (TextField) – Staff comments

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

  • status (IntegerField) – Status

  • project_id (ForeignKey) – Project

  • group_id (ForeignKey) – Group

  • sample_id (ForeignKey) – Sample

  • session_id (ForeignKey) – Session

  • start_time (DateTimeField) – Start time

  • end_time (DateTimeField) – End time

  • file_name (CharField) – File name

  • frames (FrameField) – Frames

  • num_frames (IntegerField) – Frame count

  • frames_per_file (IntegerField) – Maximum frames per file

  • exposure_time (FloatField) – Exposure time

  • attenuation (FloatField) – Attenuation

  • energy (DecimalField) – Energy

  • beamline_id (ForeignKey) – Beamline

  • beam_size (FloatField) – Beam size

  • url (CharField) – Url

  • kind_id (ForeignKey) – Kind

  • download (BooleanField) – Download

  • meta_data (JSONField) – Meta data

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.AnalysisReport(id, name, staff_comments, created, modified, status, project, kind, score, url, details)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • staff_comments (TextField) – Staff comments

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

  • status (IntegerField) – Status

  • project_id (ForeignKey) – Project

  • kind (CharField) – Kind

  • score (FloatField) – Analysis report score

  • url (CharField) – Url

  • details (JSONField) – Details

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.ActivityLog(id, created, project, user, user_description, ip_number, object_id, content_type, action_type, object_repr, description)[source]
Parameters
  • id (AutoField) – Id

  • created (DateTimeField) – Date/time

  • project_id (ForeignKey) – Project

  • user_id (ForeignKey) – User

  • user_description (CharField) – User name

  • ip_number (GenericIPAddressField) – Ip address

  • object_id (PositiveIntegerField) – Object id

  • content_type_id (ForeignKey) – Content type

  • action_type (IntegerField) – Action type

  • object_repr (CharField) – Entity

  • description (TextField) – Description

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.Session(id, created, name, project, beamline, comments, url)[source]
Parameters
  • id (AutoField) – Id

  • created (DateTimeField) – Date created

  • name (CharField) – Name

  • project_id (ForeignKey) – Project

  • beamline_id (ForeignKey) – Beamline

  • comments (TextField) – Comments

  • url (CharField) – Url

exception DoesNotExist
exception MultipleObjectsReturned
total_time()[source]

Returns total time the session was active, in hours

class mxlive.lims.models.Stretch(id, start, end, session)[source]
Parameters
  • id (AutoField) – Id

  • start (DateTimeField) – Start

  • end (DateTimeField) – End

  • session_id (ForeignKey) – Session

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.lims.models.Guide(id, created, modified, title, description, priority, attachment, staff_only, kind, modal, url)[source]
Parameters
  • id (AutoField) – Id

  • created (AutoCreatedField) – Created

  • modified (AutoLastModifiedField) – Modified

  • title (CharField) – Title

  • description (TextField) – Description

  • priority (IntegerField) – Priority

  • attachment (FileField) – Attachment

  • staff_only (BooleanField) – Staff only

  • kind (CharField) – Content type

  • modal (BooleanField) – Modal

  • url (CharField) – Url or resource

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.staff.models.UserList(id, name, description, address, active, created, modified)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • description (TextField) – Description

  • address (GenericIPAddressField) – Address

  • active (BooleanField) – Active

  • created (DateTimeField) – Date created

  • modified (DateTimeField) – Date modified

exception DoesNotExist
exception MultipleObjectsReturned
class mxlive.staff.models.RemoteConnection(id, name, user, userlist, status, created, end)[source]
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • user_id (ForeignKey) – User

  • userlist_id (ForeignKey) – Userlist

  • status (CharField) – Status

  • created (DateTimeField) – Date created

  • end (DateTimeField) – Date ended

exception DoesNotExist
exception MultipleObjectsReturned