Commit 71872dbf authored by Ángel Ramírez Isea's avatar Ángel Ramírez Isea
Browse files

refactor: Limpieza de código.

parent 2b067b08
......@@ -11,8 +11,7 @@ from dateutil.relativedelta import relativedelta
class CommedPatientEvaluation(models.Model):
_name = 'commed.patient_evaluation'
_description = 'Patient Evaluation'
STATES = {'signed': [('readonly', True)]}
# TODO: in views: STATES = {'signed': [('readonly', True)]}
def compute_age_from_dates(dob, deceased, dod, gender, caller, extra_date):
""" Get the person's age.
......@@ -71,13 +70,12 @@ class CommedPatientEvaluation(models.Model):
return self.evaluation_start
code = fields.Char('Code', help="Unique code of the evaluation")
name = fields.Many2one('commed.patient', 'Patient', states=STATES)
name = fields.Many2one('commed.patient', 'Patient')
appointment = fields.Many2one(
'commed.appointment',
'Appointment',
domain=[('patient_id', '=', name)],
help='Enter or select the appointment related to this evaluation',
states=STATES
)
related_condition = fields.Many2one(
'commed.patient_disease',
......@@ -89,9 +87,8 @@ class CommedPatientEvaluation(models.Model):
'Start',
required=True,
default=datetime.now(),
states=STATES
)
evaluation_endtime = fields.Datetime('End', states=STATES)
evaluation_endtime = fields.Datetime('End')
evaluation_length = fields.Datetime(
'Evaluation length',
default=evaluation_duration,
......@@ -116,7 +113,6 @@ class CommedPatientEvaluation(models.Model):
'commed.appointment',
'Next Appointment',
domain=[('name', '=', name)],
states=STATES
)
healthprof = fields.Many2one(
'commed.practitioner',
......@@ -132,11 +128,7 @@ class CommedPatientEvaluation(models.Model):
states={'in_progress': [('invisible', True)]},
help="Health Professional that finished the patient evaluation"
)
specialty = fields.Many2one(
'commed.specialty',
'Specialty',
states=STATES
)
specialty = fields.Many2one('commed.specialty', 'Specialty')
visit_type = fields.Selection(
[
('new', 'New health condition'),
......@@ -146,8 +138,7 @@ class CommedPatientEvaluation(models.Model):
('well_man', 'Well Man visit'),
],
'Visit',
sort=False,
states=STATES
sort=False
)
urgency = fields.Selection(
[
......@@ -156,8 +147,7 @@ class CommedPatientEvaluation(models.Model):
('c', 'Medical Emergency'),
],
'Urgency',
sort=False,
states=STATES
sort=False
)
computed_age = fields.Integer(
'Age',
......@@ -176,26 +166,22 @@ class CommedPatientEvaluation(models.Model):
information_source = fields.Char(
'Source',
help="Source of Information, eg : Self, relative, friend.",
default='Self',
states=STATES
default='Self'
)
reliable_info = fields.Boolean(
'Reliable',
help="Uncheck if the information provided seems not reliable",
default=True,
states=STATES
default=True
)
derived_from = fields.Many2one(
'commed.practitioner',
'Derived from',
help='Health Professional who derived the case',
states=STATES
help='Health Professional who derived the case'
)
derived_to = fields.Many2one(
'commed.practitioner',
'Derived to',
help='Health Professional to derive the case',
states=STATES
help='Health Professional to derive the case'
)
evaluation_type = fields.Selection(
[
......@@ -204,136 +190,114 @@ class CommedPatientEvaluation(models.Model):
],
'Type',
sort=False,
default='outpatient',
states=STATES
default='outpatient'
)
chief_complaint = fields.Char('Chief Complaint', states=STATES)
notes_complaint = fields.Text('Complaint details', states=STATES)
present_illness = fields.Text('Present Illness', states=STATES)
evaluation_summary = fields.Text('Clinical and physical', states=STATES)
chief_complaint = fields.Char('Chief Complaint')
notes_complaint = fields.Text('Complaint details')
present_illness = fields.Text('Present Illness')
evaluation_summary = fields.Text('Clinical and physical')
glycemia = fields.Float(
'Glycemia',
help='Last blood glucose level. Can be approx. In mg/dL or mmol/L.',
states=STATES
help='Last blood glucose level. Can be approx. In mg/dL or mmol/L.'
)
hba1c = fields.Float(
'Glycated Hemoglobin',
help='Last Glycated Hb level. Can be approx. In mmol/mol.',
states=STATES
help='Last Glycated Hb level. Can be approx. In mmol/mol.'
)
cholesterol_total = fields.Integer(
'Last Cholesterol',
help='Last cholesterol reading. Can be approx. In mg/dL or mmol/L.',
states=STATES
help='Last cholesterol reading. Can be approx. In mg/dL or mmol/L.'
)
hdl = fields.Integer(
'Last HDL',
help='Last HDL Cholest. reading. Can be approx. In mg/dL or mmol/L.',
states=STATES
help='Last HDL Cholest. reading. Can be approx. In mg/dL or mmol/L.'
)
ldl = fields.Integer(
'Last LDL',
help='Last LDL Cholest. reading. Can be approx. In mg/dL or mmol/L.',
states=STATES
help='Last LDL Cholest. reading. Can be approx. In mg/dL or mmol/L.'
)
tag = fields.Integer(
'Last TAGs',
help='Triacylglycerol(triglicerides) level. Can be approx. In mg/dL or\
mmol/L.',
states=STATES
)
systolic = fields.Integer(
'Systolic Pressure',
help='Systolic pressure expressed in mmHg',
states=STATES
help='Systolic pressure expressed in mmHg'
)
diastolic = fields.Integer(
'Diastolic Pressure',
help='Diastolic pressure expressed in mmHg',
states=STATES
help='Diastolic pressure expressed in mmHg'
)
bpm = fields.Integer(
'Heart Rate',
help='Heart rate expressed in beats per minute',
states=STATES
help='Heart rate expressed in beats per minute'
)
respiratory_rate = fields.Integer(
'Respiratory Rate',
help='Respiratory rate expressed in breaths per minute',
states=STATES
help='Respiratory rate expressed in breaths per minute'
)
osat = fields.Integer(
'Oxygen Saturation',
help='Arterial oxygen saturation expressed as a percentage',
states=STATES
help='Arterial oxygen saturation expressed as a percentage'
)
malnutrition = fields.Boolean(
'Malnutrition',
help='Check this box if the patient show signs of malnutrition. If '
'associated to a disease, please encode the correspondent disease on '
'the patient disease history. For example, Moderate protein-energy '
'malnutrition, E44.0 in ICD-10 encoding',
states=STATES
'malnutrition, E44.0 in ICD-10 encoding'
)
dehydration = fields.Boolean(
'Dehydration',
help='Check this box if the patient show signs of dehydration. If '
'associated to a disease, please encode the correspondent disease on '
'the patient disease history. For example, Volume Depletion, E86 in '
'ICD-10 encoding',
states=STATES
'ICD-10 encoding'
)
temperature = fields.Float('Temperature', help='°C', states=STATES)
temperature = fields.Float('Temperature', help='°C')
weight = fields.Float(
'Weight',
digits=(3, 2),
help='Weight in kilos',
states=STATES
help='Weight in kilos'
)
height = fields.Float(
'Height',
digits=(3, 1),
help='Height in centimeters',
states=STATES
help='Height in centimeters'
)
bmi = fields.Float(
'BMI',
digits=(2, 2),
help='Body mass index',
states=STATES
help='Body mass index'
)
head_circumference = fields.Float(
'Head',
help='Head circumference in centimeters',
states=STATES
help='Head circumference in centimeters'
)
abdominal_circ = fields.Float(
'Waist',
digits=(3, 1),
help='Waist circumference in centimeters',
states=STATES
help='Waist circumference in centimeters'
)
hip = fields.Float(
'Hip',
digits=(3, 1),
help='Hip circumference in centimeters',
states=STATES
help='Hip circumference in centimeters'
)
whr = fields.Float(
'WHR',
digits=(2, 2),
help='Waist to hip ratio. Reference values:\n'
'Men: < 0.9 Normal / 0.9-0.99 Overweight / > 1 Obesity\n'
'Women: < 0.8 Normal / 0.8-0.84 Overweight / > 0.85 Obesity',
states=STATES
'Women: < 0.8 Normal / 0.8-0.84 Overweight / > 0.85 Obesity'
)
# TODO: Abstraer Glasgow que también está en commed_icu
loc = fields.Integer(
'Glasgow',
default=15,
help='Level of Consciousness on Glasgow Coma Scale: <9 severe, 9-12 '
'Moderate, >13 minor',
states=STATES
'Moderate, >13 minor'
)
loc_eyes = fields.Selection(
[
......@@ -344,8 +308,7 @@ class CommedPatientEvaluation(models.Model):
],
'Glasgow - Eyes',
sort=False,
default='4',
states=STATES
default='4'
)
loc_verbal = fields.Selection(
[
......@@ -357,8 +320,7 @@ class CommedPatientEvaluation(models.Model):
],
'Glasgow - Verbal',
default='5',
sort=False,
states=STATES
sort=False
)
loc_motor = fields.Selection(
[
......@@ -371,19 +333,16 @@ class CommedPatientEvaluation(models.Model):
],
'Glasgow - Motor',
default='6',
sort=False,
states=STATES
sort=False
)
tremor = fields.Boolean(
'Tremor',
help='If associated to a disease, please encode it on the patient '
'disease history',
states=STATES
'disease history'
)
violent = fields.Boolean(
'Violent behaviour',
help='Check if the patient is aggressive or violent at the moment',
states=STATES
help='Check if the patient is aggressive or violent at the moment'
)
mood = fields.Selection(
[
......@@ -397,101 +356,80 @@ class CommedPatientEvaluation(models.Model):
('fl', 'Flat')
],
'Mood',
sort=False,
states=STATES
sort=False
)
orientation = fields.Boolean(
'Orientation',
help='Check if the patient is disoriented in time and/or space',
states=STATES
help='Check if the patient is disoriented in time and/or space'
)
memory = fields.Boolean(
'Memory',
help='Check if the patient has problems in short or long term memory',
states=STATES
help='Check if the patient has problems in short or long term memory'
)
knowledge_current_events = fields.Boolean(
'Knowledge of current events',
help='Check if the patient can not respond to public notorious events',
states=STATES
help='Check if the patient can not respond to public notorious events'
)
judgment = fields.Boolean(
'Judgment',
help='Check if the patient can not interpret basic scenario solutions',
states=STATES
help='Check if the patient can not interpret basic scenario solutions'
)
abstraction = fields.Boolean(
'Abstraction',
help='The patient presents abnormalities in abstract reasoning',
states=STATES
help='The patient presents abnormalities in abstract reasoning'
)
vocabulary = fields.Boolean(
'Vocabulary',
help='Check this box if the patient lacks basic intelectual capacity, '
'when she/he can not describe elementary objects',
states=STATES
'when she/he can not describe elementary objects'
)
calculation_ability = fields.Boolean(
'Calculation ability',
help='Check if the patient can not solve simple arithmetic problems',
states=STATES
help='Check if the patient can not solve simple arithmetic problems'
)
object_recognition = fields.Boolean(
'Object recognition',
help='Check if the patient suffers from any sort of gnosia disorders,'
' such as agnosia, prosopagnosia, etc.',
states=STATES
' such as agnosia, prosopagnosia, etc.'
)
praxis = fields.Boolean(
'Praxis',
help='Check if the patient is unable to make voluntary movements',
states=STATES
help='Check if the patient is unable to make voluntary movements'
)
diagnosis = fields.Many2one(
'commed.pathology',
'Main Condition',
help='Presumptive Diagnosis. If no diagnosis can be made, encode the '
'main sign or symptom',
states=STATES
'main sign or symptom'
)
secondary_conditions = fields.One2many(
'commed.secondary_condition',
'evaluation_id',
'Other Conditions',
help='Other conditions found on the patient',
states=STATES
help='Other conditions found on the patient'
)
diagnostic_hypothesis = fields.One2many(
'commed.diagnostic_hypothesis',
'evaluation_id',
'Hypotheses / DDx',
help='Other Diagnostic Hypotheses / Differential Diagnosis (DDx)',
states=STATES
help='Other Diagnostic Hypotheses / Differential Diagnosis (DDx)'
)
signs_and_symptoms = fields.One2many(
'commed.signs_and_symptoms',
'evaluation_id',
'Signs and Symptoms',
help='Enter the Signs and Symptoms for the patient in this evaluation',
states=STATES
)
psychological_assessment = fields.Text(
"Psychological Assessment",
states=STATES
)
info_diagnosis = fields.Text(
'Presumptive Diagnosis: Extra Info',
states=STATES
help='Enter the Signs and Symptoms for the patient in this evaluation'
)
directions = fields.Text('Plan', states=STATES)
psychological_assessment = fields.Text("Psychological Assessment")
info_diagnosis = fields.Text('Presumptive Diagnosis: Extra Info')
directions = fields.Text('Plan')
actions = fields.One2many(
'commed.directions',
'name',
'Procedures',
help='Procedures / Actions to take',
states=STATES
help='Procedures / Actions to take'
)
notes = fields.Text('Notes', states=STATES)
notes = fields.Text('Notes')
discharge_reason = fields.Selection(
[
('home', 'Home / Selfcare'),
......@@ -511,7 +449,6 @@ class CommedPatientEvaluation(models.Model):
institution = fields.Many2one(
'commed.center',
'Institution',
states=STATES
)
report_evaluation_date = fields.Datetime(
'Evaluation Date and time',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment