1 | # -*- coding: utf-8 -*- |
||
2 | # |
||
3 | # This file is part of SENAITE.HEALTH. |
||
4 | # |
||
5 | # SENAITE.HEALTH is free software: you can redistribute it and/or modify it |
||
6 | # under the terms of the GNU General Public License as published by the Free |
||
7 | # Software Foundation, version 2. |
||
8 | # |
||
9 | # This program is distributed in the hope that it will be useful, but WITHOUT |
||
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
11 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
||
12 | # details. |
||
13 | # |
||
14 | # You should have received a copy of the GNU General Public License along with |
||
15 | # this program; if not, write to the Free Software Foundation, Inc., 51 |
||
16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
17 | # |
||
18 | # Copyright 2018-2019 by it's authors. |
||
19 | # Some rights reserved, see README and LICENSE. |
||
20 | |||
21 | from AccessControl import ClassSecurityInfo |
||
22 | from Products.ATExtensions.ateapi import RecordsField |
||
23 | from Products.Archetypes.public import * |
||
24 | from Products.CMFCore.permissions import View, ModifyPortalContent |
||
25 | from bika.lims import bikaMessageFactory as _b |
||
26 | from bika.health import bikaMessageFactory as _ |
||
27 | from bika.lims.content.bikaschema import BikaSchema |
||
28 | from bika.health.config import PROJECTNAME |
||
29 | from bika.lims.browser.widgets import RecordsWidget |
||
30 | from zope.interface import implements |
||
31 | |||
32 | schema = BikaSchema.copy() + Schema(( |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
33 | |||
34 | StringField('Form', |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
35 | vocabulary = "getImmunizationFormsList", |
||
36 | widget = ReferenceWidget( |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
37 | checkbox_bound = 1, |
||
38 | label = _("Immunization form", |
||
39 | "Type"), |
||
40 | description = _("Select a type of immunization. <br/>" |
||
41 | "Active immunization entails the introduction of a foreign molecule " |
||
42 | "into the body, which causes the body itself to generate immunity " |
||
43 | "against the target. Vaccination is an active form of immunization<br/>" |
||
44 | "Passive immunization is where pre-synthesized elements of the immune " |
||
45 | "system are transferred to a person so that the body does not need to " |
||
46 | "produce these elements itself. Currently, antibodies can be used for " |
||
47 | "passive immunization"), |
||
48 | ), |
||
49 | ), |
||
50 | |||
51 | TextField('RelevantFacts', |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
52 | default_content_type = 'text/x-web-intelligent', |
||
53 | allowable_content_types = ('text/x-web-intelligent',), |
||
54 | default_output_type="text/plain", |
||
55 | widget = TextAreaWidget( |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
56 | label = _("Relevant Facts"), |
||
57 | ), |
||
58 | ), |
||
59 | |||
60 | TextField('GeographicalDistribution', |
||
61 | default_content_type = 'text/x-web-intelligent', |
||
62 | allowable_content_types = ('text/x-web-intelligent',), |
||
63 | default_output_type="text/plain", |
||
64 | widget = TextAreaWidget( |
||
65 | label = _("Geographical distribution"), |
||
66 | description = _("Geographical areas can be characterized as having high, intermediate " |
||
67 | "or low levels of infection.") |
||
68 | ), |
||
69 | ), |
||
70 | |||
71 | TextField('Transmission', |
||
72 | default_content_type = 'text/x-web-intelligent', |
||
73 | allowable_content_types = ('text/x-web-intelligent',), |
||
74 | default_output_type="text/plain", |
||
75 | widget = TextAreaWidget( |
||
76 | label = _("Transmission"), |
||
77 | ), |
||
78 | ), |
||
79 | |||
80 | TextField('Symptoms', |
||
81 | default_content_type = 'text/x-web-intelligent', |
||
82 | allowable_content_types = ('text/x-web-intelligent',), |
||
83 | default_output_type="text/plain", |
||
84 | widget = TextAreaWidget( |
||
85 | label = _("Symptoms"), |
||
86 | ), |
||
87 | ), |
||
88 | |||
89 | TextField('Risk', |
||
90 | default_content_type = 'text/x-web-intelligent', |
||
91 | allowable_content_types = ('text/x-web-intelligent',), |
||
92 | default_output_type="text/plain", |
||
93 | widget = TextAreaWidget( |
||
94 | label = _("Collectives at risk"), |
||
95 | ), |
||
96 | ), |
||
97 | |||
98 | TextField('Treatment', |
||
99 | default_content_type = 'text/x-web-intelligent', |
||
100 | allowable_content_types = ('text/x-web-intelligent',), |
||
101 | default_output_type="text/plain", |
||
102 | widget = TextAreaWidget( |
||
103 | label = _("Treatment"), |
||
104 | ), |
||
105 | ), |
||
106 | |||
107 | TextField('Prevention', |
||
108 | default_content_type = 'text/x-web-intelligent', |
||
109 | allowable_content_types = ('text/x-web-intelligent',), |
||
110 | default_output_type="text/plain", |
||
111 | widget = TextAreaWidget( |
||
112 | label = _("Prevention"), |
||
113 | ), |
||
114 | ), |
||
115 | |||
116 | )) |
||
117 | |||
118 | schema['description'].widget.visible = True |
||
119 | schema['description'].schemata = 'default' |
||
120 | |||
121 | def getImmunizationForms(context): |
||
122 | """ Return the current list of immunization forms |
||
123 | """ |
||
124 | # Active immunization entails the introduction of a foreign molecule into the body, |
||
125 | # which causes the body itself to generate immunity against the target. Vaccination |
||
126 | # is an active form of immunization. |
||
127 | # Passive immunization is where pre-synthesized elements of the immune system are |
||
128 | # transferred to a person so that the body does not need to produce these elements |
||
129 | # itself. Currently, antibodies can be used for passive immunization. |
||
130 | types = [ |
||
131 | ('active', context.translate(_('Active immunization'))), |
||
132 | ('passive', context.translate(_('Passive immunization'))), |
||
133 | ] |
||
134 | return DisplayList(types) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
135 | |||
136 | class Immunization(BaseContent): |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
137 | security = ClassSecurityInfo() |
||
138 | displayContentsTab = False |
||
139 | schema = schema |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
140 | |||
141 | _at_rename_after_creation = True |
||
142 | def _renameAfterCreation(self, check_auto_id=False): |
||
143 | from bika.lims.idserver import renameAfterCreation |
||
144 | renameAfterCreation(self) |
||
145 | |||
146 | def getImmunizationFormsList(self): |
||
147 | return getImmunizationForms(self) |
||
148 | |||
149 | registerType(Immunization, PROJECTNAME) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
150 |