Coverage for cc_modules/cc_ctvinfo.py: 100%

1"""

2 camcops_server/cc_modules/cc_ctvinfo.py

3

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

5

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

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

8

9 This file is part of CamCOPS.

10

11 CamCOPS 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 CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>.

23

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

25

26**Information class used by the clinical text viewer (CTV) function.**

27

28"""

29

30# =============================================================================

31# CtvInfo

32# =============================================================================

33

34

35 class CtvInfo(object):

36 """

37 Snippet of information for incorporating into a CTV.

38 """

39

40 def __init__(

41 self,

42 heading: str = None,

43 subheading: str = None,

44 description: str = None,

45 content: str = None,

46 skip_if_no_content: bool = True,

47 ):

48 """

49 Args:

50 heading: optional text used for heading

51 subheading: optional text used for subheading

52 description: optional text used for field description

53 content: text

54 skip_if_no_content: if True, no other fields will be printed

55 unless content evaluates to True

56

57 These will be NOT webified by the ClinicalTextView class, meaning

58

59 (a) do it yourself if it's necessary, and

60 (b) you can pass HTML formatting.

61 """

62 self.heading = heading

63 self.subheading = subheading

64 self.description = description

65 self.content = content

66 self.skip_if_no_content = skip_if_no_content

67

68

69 CTV_INCOMPLETE = [CtvInfo(description="Incomplete", skip_if_no_content=False)]