Coverage for nexusLIMS/db/enums.py: 100%

19 statements  

« prev     ^ index     » next       coverage.py v7.11.3, created at 2026-03-24 05:23 +0000

1"""Database enumerations for NexusLIMS. 

2 

3This module defines type-safe enums for database fields that have 

4constrained values (CHECK constraints in the database schema). 

5""" 

6 

7from enum import Enum 

8 

9 

10class EventType(str, Enum): 

11 """Allowed event types for session logs. 

12 

13 Maps to the CHECK constraint in session_log.event_type column. 

14 """ 

15 

16 START = "START" 

17 END = "END" 

18 RECORD_GENERATION = "RECORD_GENERATION" 

19 

20 

21class RecordStatus(str, Enum): 

22 """Allowed record status values for session logs. 

23 

24 Maps to the CHECK constraint in session_log.record_status column. 

25 

26 Attributes 

27 ---------- 

28 WAITING_FOR_END 

29 Session has started but not yet ended 

30 TO_BE_BUILT 

31 Session has ended and needs record generation 

32 COMPLETED 

33 Record has been successfully built and uploaded 

34 BUILT_NOT_EXPORTED 

35 Record was built successfully but all export destinations failed 

36 ERROR 

37 Record building failed with an error 

38 NO_FILES_FOUND 

39 No files were found for this session 

40 NO_CONSENT 

41 User did not consent to data harvesting 

42 NO_RESERVATION 

43 No matching reservation found for this session 

44 """ 

45 

46 WAITING_FOR_END = "WAITING_FOR_END" 

47 TO_BE_BUILT = "TO_BE_BUILT" 

48 COMPLETED = "COMPLETED" 

49 BUILT_NOT_EXPORTED = "BUILT_NOT_EXPORTED" 

50 ERROR = "ERROR" 

51 NO_FILES_FOUND = "NO_FILES_FOUND" 

52 NO_CONSENT = "NO_CONSENT" 

53 NO_RESERVATION = "NO_RESERVATION" 

54 

55 

56class ExternalSystem(str, Enum): 

57 """External systems that NexusLIMS integrates with. 

58 

59 Maps to the CHECK constraint in external_user_identifiers.external_system column. 

60 

61 Attributes 

62 ---------- 

63 NEMO 

64 NEMO lab management system (usage tracking and reservations) 

65 LABARCHIVES_ELN 

66 LabArchives Electronic Lab Notebook (record export destination) 

67 LABARCHIVES_SCHEDULER 

68 LabArchives Scheduler (reservation system integration) 

69 CDCS 

70 Configurable Data Curation System (NexusLIMS frontend) 

71 """ 

72 

73 NEMO = "nemo" 

74 LABARCHIVES_ELN = "labarchives_eln" 

75 LABARCHIVES_SCHEDULER = "labarchives_scheduler" 

76 CDCS = "cdcs"