Coverage for crateweb/consent/constants.py: 90%

29 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-08-27 10:34 -0500

1""" 

2crate_anon/crateweb/consent/constants.py 

3 

4=============================================================================== 

5 

6 Copyright (C) 2015, University of Cambridge, Department of Psychiatry. 

7 Created by Rudolf Cardinal (rnc1001@cam.ac.uk). 

8 

9 This file is part of CRATE. 

10 

11 CRATE is free software: you can redistribute it and/or modify 

12 it under the terms of the GNU General Public License as published by 

13 the Free Software Foundation, either version 3 of the License, or 

14 (at your option) any later version. 

15 

16 CRATE is distributed in the hope that it will be useful, 

17 but WITHOUT ANY WARRANTY; without even the implied warranty of 

18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

19 GNU General Public License for more details. 

20 

21 You should have received a copy of the GNU General Public License 

22 along with CRATE. If not, see <https://www.gnu.org/licenses/>. 

23 

24=============================================================================== 

25 

26**Constants for the consent-to-contact system.** 

27 

28""" 

29 

30from dataclasses import dataclass 

31 

32 

33@dataclass 

34class EthicsDocInfo: 

35 title: str 

36 version: str 

37 date: str 

38 

39 

40class EthicsInfo: 

41 IRAS_NUMBER = "?" 

42 REC_REFERENCE = "?" 

43 

44 # People/entities: 

45 # - C clinician 

46 # - R researcher 

47 # - P patient 

48 # - D research database manager or automatic (CRATE) 

49 # LTR letter: next elements are from, to, subject. 

50 # In sequence (per IRAS): 

51 LTR_PT_FIRST_TRAFFIC_LIGHT = "letter_patient_first_traffic_light" 

52 FORM_TRAFFIC_GENERIC = "traffic_light_decision_form_generic" 

53 FORM_TRAFFIC_PERSONALIZED = "traffic_light_decision_form_personalized" 

54 LTR_D_P_CONFIRM_TRAFFIC = "letter_patient_confirm_traffic" 

55 LTR_C_P_STUDY = "letter_patient_from_clinician_re_study" 

56 FORM_STUDY = "decision_form_to_patient_re_study" 

57 LTR_D_R_APPROVAL = "letter_researcher_approve" 

58 LTR_R_P_STUDY_TEMPLATE = ( 

59 "letter_researcher_to_patient_cover_letter_template" 

60 ) 

61 LTR_D_R_WITHDRAWAL = "letter_researcher_withdraw" 

62 

63 def get_docinfo(self, doccode: str) -> EthicsDocInfo: 

64 raise NotImplementedError 

65 

66 

67class CPFTEthics2022(EthicsInfo): 

68 """ 

69 Values for CPFT's ethics approval of the CPFT Research Database. Of no 

70 interest to others! Reason: all patient-facing documentation should have 

71 a footer including 

72 

73 - IRAS number 

74 - NHS REC number 

75 - Title 

76 - Version number 

77 - Date 

78 """ 

79 

80 # 2022 approvals: 

81 IRAS_NUMBER = "319851" 

82 REC_REFERENCE = "22/EE/0264" 

83 

84 _DATE_MOST = "2022-09-18" 

85 _DATE = "2022-10-10" # submission date 

86 

87 def __init__(self) -> None: 

88 self._docinfo = { 

89 # Titles from IRAS. 

90 self.LTR_PT_FIRST_TRAFFIC_LIGHT: EthicsDocInfo( 

91 # IRAS doc #09 

92 title="Clinician to patient cover letter re traffic light", 

93 version="1", 

94 date=self._DATE_MOST, 

95 ), 

96 self.FORM_TRAFFIC_GENERIC: EthicsDocInfo( 

97 # IRAS doc #10 

98 title="Traffic light decision form", 

99 version="2", 

100 date="2022-10-06", 

101 ), 

102 self.FORM_TRAFFIC_PERSONALIZED: EthicsDocInfo( 

103 # IRAS doc #11 

104 title="Traffic light decision form (personalised)", 

105 version="2", 

106 date="2022-10-06", 

107 ), 

108 self.LTR_D_P_CONFIRM_TRAFFIC: EthicsDocInfo( 

109 # IRAS doc #12 

110 title="RDBM to patient confirming traffic light choice", 

111 version="1", 

112 date=self._DATE_MOST, 

113 ), 

114 self.LTR_C_P_STUDY: EthicsDocInfo( 

115 # IRAS docs #16, #17 

116 title="Clinician to patient cover letter for a specific study", 

117 version="1", 

118 date=self._DATE_MOST, 

119 ), 

120 self.FORM_STUDY: EthicsDocInfo( 

121 # IRAS docs #18, 19 

122 title="Decision form about a specific study", 

123 version="1", 

124 date=self._DATE_MOST, 

125 ), 

126 self.LTR_D_R_APPROVAL: EthicsDocInfo( 

127 # IRAS doc #20 

128 title="RDBM to researcher giving permission to contact", 

129 version="1", 

130 date=self._DATE_MOST, 

131 ), 

132 self.LTR_R_P_STUDY_TEMPLATE: EthicsDocInfo( 

133 # IRAS doc #21 

134 title="Researcher cover letter to patient", 

135 version="1", 

136 date=self._DATE_MOST, 

137 ), 

138 self.LTR_D_R_WITHDRAWAL: EthicsDocInfo( 

139 # IRAS doc #22 

140 title="RDBM to researcher when patient withdraws consent", 

141 version="1", 

142 date=self._DATE_MOST, 

143 ), 

144 } 

145 

146 def get_docinfo(self, doccode: str) -> EthicsDocInfo: 

147 return self._docinfo[doccode]