I am making software for patients record keeping in a clinic . I have written a peewee model for setting up tables to store record of each patient visit and patient contact and a relative table that store name of parent or husband (in case female patient is married)
import peewee
from app.datastore.core import db as _db
class Patient(peewee.Model):
""" Patinets table """
name = peewee.CharField(max_length=90)
townCity = peewee.CharField(max_length=200)
contactnumber = peewee.CharField(max_length=20)
age = peewee.IntegerField(default=0)
gender = peewee.CharField(max_length=9)
email = peewee.CharField(max_length=1024, null=True)
postalAddress = peewee.TextField()
def __repr__(self):
return "<Patient Id: {}>".format(self.id)
class Meta:
database = _db
class Relative(peewee.Model):
""" Visit attendence """
patient = peewee.ForeignKeyField(Patient,
related_name="patient")
relation = peewee.CharField(max_length=10)
relativeName = peewee.CharField(max_length=90)
class Meta:
database = _db
# the below table continues to increment on each visit of new or old patient by frontdesk.
class PatientAttendOnVisit(peewee.Model):
""" Attendence or visit record """
patient = peewee.ForeignKeyField(Patient,
related_name="patient")
dateTimeofvisit = peewee.DateTimeField()
attendtype = peewee.CharField(max_length=12) # walkin or appointment
department = peewee.CharField(max_length=9) # medicine or dental
class Meta:
database = _db
# the below table continues to increment on each patient visit by doctor
class PatientCheckup(peewee.Model):
"""
Patient Checkup table stores what patient reports on each visit
to doctor like symptoms, diagnosis and presciption
"""
patient = peewee.ForeignKeyField(Patient,
related_name="patient")
chiefcomplaint = peewee.TextField()
symptoms = peewee.TextField()
diagnosis = peewee.TextField()
treatment = peewee.TextField()
presciption = peewee.TextField()
dateTimeofvisit = peewee.ForeignKeyField(PatientAttendOnVisit)
class Meta:
database = _db
I am very new to database driven application with no knowledge of db design please help me design the best database and schema ?