Mercurial > hgweb > health
changeset 4856:007a3f719e29
task #16043: Migration to GNU Health 4.0: Migrate and cleanup health_iss
| author | Luis Falcon <falcon@gnuhealth.org> |
|---|---|
| date | Thu, 13 Jan 2022 18:10:22 +0000 |
| parents | f40c97f17a08 |
| children | ba94107421a5 |
| files | tryton/health_iss/__init__.py tryton/health_iss/health_iss.py tryton/health_iss/tryton.cfg |
| diffstat | 3 files changed, 50 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_iss/__init__.py +++ b/tryton/health_iss/__init__.py @@ -2,7 +2,7 @@ ############################################################################## # # GNU Health: The Free Health and Hospital Information System -# Copyright (C) 2008-2013 Luis Falcon <falcon@gnuhealth.org> +# Copyright (C) 2008-2022 Luis Falcon <falcon@gnuhealth.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,10 +20,10 @@ ############################################################################## from trytond.pool import Pool -from .health_iss import * +from . import health_iss def register(): Pool.register( - Iss, + health_iss.Iss, module='health_iss', type_='model')
--- a/tryton/health_iss/health_iss.py +++ b/tryton/health_iss/health_iss.py @@ -6,7 +6,7 @@ # Copyright (C) 2011-2022 GNU Solidario <health@gnusolidario.org> # # MODULE : INJURY SURVEILLANCE SYSTEM -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -25,7 +25,7 @@ # # The documentation of the module goes in the "doc" directory. -from trytond.pyson import Eval, Not, Bool, PYSONEncoder, Equal +from trytond.pyson import Eval, Not, Equal from trytond.model import ModelView, ModelSQL, fields, Unique __all__ = ['Iss'] @@ -35,18 +35,21 @@ 'Injury Surveillance System Registration' __name__ = 'gnuhealth.iss' - name = fields.Many2One('gnuhealth.patient.evaluation', + name = fields.Many2One( + 'gnuhealth.patient.evaluation', 'Evaluation', required=True, help='Related Patient Evaluation') - injury_date = fields.Date('Injury Date', + injury_date = fields.Date( + 'Injury Date', help="Usually the same as the Evaluation") - + registration_date = fields.Date('Registration Date') - - code = fields.Char('Code',help='Injury Code', required=True) - operational_sector = fields.Many2One('gnuhealth.operational_sector', - 'O. Sector',help="Operational Sector in which happened the injury") + code = fields.Char('Code', help='Injury Code', required=True) + + operational_sector = fields.Many2One( + 'gnuhealth.operational_sector', + 'O. Sector', help="Operational Sector in which happened the injury") latitude = fields.Numeric('Latidude', digits=(3, 14)) longitude = fields.Numeric('Longitude', digits=(4, 14)) @@ -55,7 +58,7 @@ 'OSM Map', help="Maps the Accident / Injury location on Open Street Map") - healthcenter = fields.Many2One('gnuhealth.institution','Institution') + healthcenter = fields.Many2One('gnuhealth.institution', 'Institution') patient = fields.Function( fields.Char('Patient'), @@ -67,7 +70,6 @@ patient_age = fields.Function(fields.Char('Age'), 'get_patient_age') - complaint = fields.Function( fields.Char('Chief Complaint'), 'get_patient_complaint') @@ -95,7 +97,7 @@ ('aircraft', 'Aircraft'), ('other', 'Other'), ('unknown', 'Unknown'), - ], 'Mode', help="Motor Vehicle Accident Mode",sort=False, + ], 'Mode', help="Motor Vehicle Accident Mode", sort=False, states={'required': Equal(Eval('injury_type'), 'motor_vehicle')}) mva_position = fields.Selection([ @@ -106,9 +108,9 @@ ('bystander', 'Bystander'), ('unspecified_vehicle', 'Unspecified vehicle'), ('unknown', 'Unknown'), - ], 'User Position', help="Motor Vehicle Accident user position",sort=False, - states={'required': Equal(Eval('injury_type'), 'motor_vehicle')}) - + ], 'User Position', + help="Motor Vehicle Accident user position", sort=False, + states={'required': Equal(Eval('injury_type'), 'motor_vehicle')}) mva_counterpart = fields.Selection([ (None, ''), @@ -125,41 +127,41 @@ ('aircraft', 'Aircraft'), ('other', 'Other'), ('unknown', 'Unknown'), - ], 'Counterpart', help="Motor Vehicle Accident Counterpart",sort=False, + ], 'Counterpart', + help="Motor Vehicle Accident Counterpart", sort=False, states={'required': Equal(Eval('injury_type'), 'motor_vehicle')}) - safety_gear = fields.Selection([ (None, ''), ('yes', 'Yes'), ('no', 'No'), ('unknown', 'Unknown'), - ], 'Safety Gear', help="Use of Safety Gear - Helmet, safety belt...",sort=False, - states={'required': Equal(Eval('injury_type'), 'motor_vehicle')}) - + ], 'Safety Gear', + help="Use of Safety Gear - Helmet, safety belt...", sort=False, + states={'required': Equal(Eval('injury_type'), 'motor_vehicle')}) alcohol = fields.Selection([ (None, ''), ('yes', 'Yes'), ('no', 'No'), - ('suspected','Suspected'), + ('suspected', 'Suspected'), ('unknown', 'Unknown'), ], 'Alcohol', required=True, help="Is there evidence of alcohol use by the injured person" - " in the 6 hours before the accident ?",sort=False) + " in the 6 hours before the accident ?", sort=False) drugs = fields.Selection([ (None, ''), ('yes', 'Yes'), ('no', 'No'), - ('suspected','Suspected'), + ('suspected', 'Suspected'), ('unknown', 'Unknown'), ], 'Other Drugs', required=True, help="Is there evidence of drug use by the injured person" - " in the 6 hours before the accident ?",sort=False) + " in the 6 hours before the accident ?", sort=False) injury_details = fields.Text('Details') - + # Add victim-perpretator relationship for violence-related injuries victim_perpetrator = fields.Selection([ (None, ''), @@ -171,10 +173,10 @@ ('official', 'Official / Legal'), ('stranger', 'Stranger'), ('other', 'other'), - ], 'Relationship', help="Victim - Perpetrator relationship",sort=False, + ], 'Relationship', + help="Victim - Perpetrator relationship", sort=False, states={'required': Equal(Eval('injury_type'), 'violence')}) - violence_circumstances = fields.Selection([ (None, ''), ('fight', 'Fight'), @@ -185,7 +187,8 @@ ('other_crime', 'Committing a crime (other)'), ('other', 'Other'), ('unknown', 'Unknown'), - ], 'Context', help="Precipitating Factor",sort=False, + ], 'Context', + help="Precipitating Factor", sort=False, states={'required': Equal(Eval('injury_type'), 'violence')}) injury_method = fields.Selection([ @@ -198,12 +201,12 @@ ('choking', 'Choking/strangulation'), ('other', 'Other'), ('unknown', 'Unknown'), - ], 'Method', help="Method of Injury",sort=False, + ], 'Method', + help="Method of Injury", sort=False, states={'required': Equal(Eval('injury_type'), 'violence')}) + # Place of occurrance . Not used in motor vehicle accidents - # Place of occurrance . Not used in motor vehicle accidents - place_occurrance = fields.Selection([ (None, ''), ('home', 'Home'), @@ -216,8 +219,10 @@ ('transportation', 'Public transportation'), ('sports', 'Sports event'), ('unknown', 'Unknown'), - ], 'Place', help="Place of occurrance",sort=False, - states={'required': Not(Equal(Eval('injury_type'), 'motor_vehicle'))}) + ], 'Place', + help="Place of occurrance", sort=False, + states={ + 'required': Not(Equal(Eval('injury_type'), 'motor_vehicle'))}) disposition = fields.Selection([ (None, ''), @@ -228,8 +233,9 @@ ('daa', 'Discharge Against Advise'), ('transferred', 'Transferred'), ('doa', 'Dead on Arrival'), - ], 'Disposition', help="Place of occurrance",sort=False, required=True) - + ], 'Disposition', + help="Place of occurrance", sort=False, required=True) + def get_patient(self, name): return self.name.patient.rec_name @@ -246,7 +252,7 @@ def on_change_with_urladdr(self): # Generates the URL to be used in OpenStreetMap # The address will be mapped to the URL in the following way - # If the latitud and longitude of the Accident / Injury + # If the latitud and longitude of the Accident / Injury # are given, then those parameters will be used. ret_url = '' @@ -268,8 +274,8 @@ super(Iss, cls).__setup__() t = cls.__table__() cls._sql_constraints = [ - ('code_uniq', Unique(t,t.code), - 'This ISS registration Code already exists'), + ('code_uniq', Unique(t, t.code), + 'This ISS registration Code already exists'), ] @classmethod @@ -278,10 +284,9 @@ 'invisible': Not(Equal(Eval('injury_type'), 'motor_vehicle')), }), ('//group[@id="violent_injury"]', 'states', { - 'invisible': Not(Equal(Eval('injury_type'), 'violence')), + 'invisible': Not(Equal(Eval('injury_type'), 'violence')), }), ('//group[@id="iss_place"]', 'states', { - 'invisible': Equal(Eval('injury_type'), 'motor_vehicle'), + 'invisible': Equal(Eval('injury_type'), 'motor_vehicle'), }), ] -
