medical_app.backend.models

Module Contents

Classes

User

Patient

Medic

Record

Functions

prune_keys_with_none_value(→ dict)

Remove keys if value is None

Attributes

association_table

medical_app.backend.models.prune_keys_with_none_value(input_dict: dict) dict

Remove keys if value is None

Parameters:

input_dict – dict with potential none values

Returns:

pruned dict

class medical_app.backend.models.User(**kwargs)

Bases: medical_app.backend.db.Model

empty_string_forbidden_cols: Set
id
first_name
last_name
email
format_for_json(**kwargs) Dict[str, Any]

Return dict representation of user.

Returns:

dict representation of class

insert() Dict[str, Any]

Insert user into db.

Returns:

dict representation of user.

delete() int

Delete self from db.

Returns:

id of deleted user

medical_app.backend.models.association_table
class medical_app.backend.models.Patient(**kwargs)

Bases: User

__tablename__ = 'patient'
id: sqlalchemy.orm.Mapped[int]
medics: sqlalchemy.orm.Mapped[List[Medic]]
records: sqlalchemy.orm.Mapped[List[Record]]
__mapper_args__
format_for_json(**kwargs) Dict[str, Any]

Return dict that can easily be jsonified.

Parameters:

include_medics_long – Whether to include detailed representation of medics, defaults to True

Returns:

dict representation of class to be jsonified

class medical_app.backend.models.Medic(**kwargs)

Bases: User

__tablename__ = 'medic'
id: sqlalchemy.orm.Mapped[int]
patients: sqlalchemy.orm.Mapped[List[Patient]]
__mapper_args__
format_for_json(**kwargs) Dict[str, Any]

Return dict that can easily be jsonified.

Parameters:

include_medics_long – Whether to include detailed representation of medics, defaults to True

Returns:

dict representation of class to be jsonified

add_patient(patient: Patient) Dict[str, Any]

Add patient to medic.

Parameters:

patient_id – id of patient to add

Returns:

dict represenation of self to be jsonified

update(**kwargs) Dict[str, Any]

Update medic with given kwargs.

Returns:

dict representation of updated medic.

class medical_app.backend.models.Record

Bases: medical_app.backend.db.Model

id
title
description
date_diagnosis
date_symptom_onset
date_symptom_offset
patient_id: sqlalchemy.orm.Mapped[int]
format_for_json() Dict[str, Any]

Return dict that can easily be jsonified.

Returns:

dict representation of record to be jsonified

insert() Dict[str, Any]

Insert record into db.

Returns:

dict representation of record.

delete() int

Delete self from db.

Returns:

id of deleted user