datasafe.loi module
Lab Object Identifiers (LOIs)
Accessing objects in a laboratory via unique identifiers (here: a Lab Object Identifier, LOI) is a key concept of the LabInform framework. “Object” may be thought of in a very broad and general way, ranging from (physically existing) samples via datasets represented as files on a computer storage system to abstract concepts such as projects.
Currently, the classes implemented in this module can check a LOI for consistency and compliance to the LOI scheme developed so far.
Todo
structure of the LOI that is implemented in this module needs to be described.
Note
This module should probably eventually be moved to a separate subpackage dealing with LOIs. See the LabInform documentation containing already hints of such a subpackage of the LabInform package for details.
- class datasafe.loi.LoiMixin[source]
Bases:
objectDefine basic properties for LOIs.
Every class handling LOIs should inherit/mixin this class.
- class datasafe.loi.AbstractChecker[source]
Bases:
objectBase class for different types of checkers.
A given string is analysed using basic checkers that look for specific elements or patterns.
Derived classes should implement the concrete and private method
check(). This method returns a Boolean value depending on the test results.
- class datasafe.loi.InListChecker[source]
Bases:
AbstractCheckerCheck whether the given string is contained in a given list.
- class datasafe.loi.StartsWithChecker[source]
Bases:
AbstractCheckerCheck whether a string starts with the given string.
- class datasafe.loi.IsPatternChecker[source]
Bases:
AbstractCheckerCheck whether a string matches the given pattern.
- class datasafe.loi.IsNumberChecker[source]
Bases:
IsPatternCheckerCheck whether a string contains only numbers.
- class datasafe.loi.IsDateChecker[source]
Bases:
IsPatternCheckerCheck for date in given form (YYYY-MM-DD).
Note that currently, the checker doesn’t validate if the date is valid date.
- class datasafe.loi.IsFriendlyStringChecker[source]
Bases:
IsPatternCheckerCheck whether the string contains only “friendly” characters.
- class datasafe.loi.AbstractLoiChecker[source]
Bases:
LoiMixinAbstract checker class to check if LOI is supposed to exist.
The Laboratory Object Identifier (LOI) is a persistent identifier or handle to identify various samples, objects and projects that are linked to a laboratory and its working group. The aim of it is a unique connection between those objects and actions performed on or with them. The LOI is part of the LabInform framework. For more information see https://www.labinform.de/
The checker works recursive-like: If the attribute
next_checkeris given in the respective class, checking continues.This class contains the public method
check()which calls the private method_check()that is to be overwritten in derived checkers.- property ignore_check
Check that should be ignored.
- property next_checker
Next checker class that should be called.
- check(string)[source]
Split string, check first part, give the rest over to next checker.
Initiates checking cascade by checking the first part of the LOI and pass the following string to the next checker (if given) which performs the next checking step in a recursive-like way. Key element of the LOI validating cascade.
- class datasafe.loi.LoiChecker[source]
Bases:
AbstractLoiCheckerCheck a lab object identifier (LOI) to conform to scheme.
A user only needs to instantiate this class for checking a LOI.
Begin of the cascading chain to validate a given LOI. Checking starts with the first part of the LOI that should start with 42. Following, the data type will be surveyed and depending on the result, further downstream checkers will be involved. Returns True if string is valid LOI.
- class datasafe.loi.LoiStartsWithCorrectRootChecker[source]
Bases:
AbstractLoiCheckerCheck root of LOI.
- class datasafe.loi.LoiTypeChecker[source]
Bases:
AbstractLoiCheckerCheck type of LOI.
- class datasafe.loi.LoiRecChecker[source]
Bases:
AbstractLoiCheckerCheck rec type of LOI.
- class datasafe.loi.LoiDsChecker[source]
Bases:
AbstractLoiCheckerCheck ds type of LOI.
- class datasafe.loi.LoiExpChecker[source]
Bases:
AbstractLoiCheckerCheck exp type of LOI.
- class datasafe.loi.BaSaChecker[source]
Bases:
AbstractLoiCheckerCheck ba/sa of LOI.
- class datasafe.loi.BaSaNumberChecker[source]
Bases:
AbstractLoiCheckerCheck ba/sa number type of LOI.
- class datasafe.loi.LoiExpMethodChecker[source]
Bases:
AbstractLoiCheckerCheck experimental method of LOI.
- class datasafe.loi.LoiMeasurementNumberChecker[source]
Bases:
AbstractLoiCheckerCheck measurement number of LOI.
- class datasafe.loi.LoiCalcChecker[source]
Bases:
AbstractLoiCheckerCheck calc of LOI.
- class datasafe.loi.LoiCalcObjectNumberChecker[source]
Bases:
AbstractLoiCheckerCheck calc object number of LOI.
- class datasafe.loi.LoiImgChecker[source]
Bases:
AbstractLoiCheckerCheck img of LOI.
- class datasafe.loi.LoiInfoChecker[source]
Bases:
AbstractLoiCheckerCheck info of LOI.
- class datasafe.loi.LoiInfoKindChecker[source]
Bases:
AbstractLoiCheckerCheck info kind of LOI.
- class datasafe.loi.LoiInfoOtherKindChecker[source]
Bases:
AbstractLoiCheckerCheck info other kind of LOI.
- class datasafe.loi.LoiInfoProjectChecker[source]
Bases:
LoiInfoOtherKindCheckerCheck info project of LOI.
- class datasafe.loi.LoiInfoPublicationChecker[source]
Bases:
LoiInfoOtherKindCheckerCheck info publication of LOI.
- class datasafe.loi.LoiInfoGrantChecker[source]
Bases:
LoiInfoOtherKindCheckerCheck info grant of LOI.
- class datasafe.loi.LoiInfoDeviceChecker[source]
Bases:
LoiInfoOtherKindCheckerCheck info device of LOI.
- class datasafe.loi.LoiInfoChemicalChecker[source]
Bases:
LoiInfoOtherKindCheckerCheck info chemical of LOI.
- class datasafe.loi.LoiInfoPersonChecker[source]
Bases:
LoiInfoOtherKindCheckerCheck info person of LOI.
- class datasafe.loi.LoiInfoSampleChecker[source]
Bases:
AbstractLoiCheckerCheck info sample of LOI.
- class datasafe.loi.LoiInfoCalculationChecker[source]
Bases:
AbstractLoiCheckerCheck info calculation of LOI.
- class datasafe.loi.Parser[source]
Bases:
LoiMixinParse LOIs, allowing to handle different parts correctly.
A LOI consists of four parts:
root
issuer
type
id
Generally, a LOI could be written like this:
<root>.<issuer>/<type>/<id>
Typically, root is fixed for LOIs (42) and issuer is a number. Type is a single string, and id usually consists of several parts separated by a “/”.
For general aspects of LOIs, such as root and separator(s), refer to the
LoiMixinclass.