top of page

Deciding Attributes for Entities

Writer's picture: Rahul VyasRahul Vyas

Updated: Nov 9, 2024

ER Diagram with Attributes

Now that we have our entities decided, it’s time to decide attributes for each entity.


Think of each entity as a container for specific information about different parts of our system, like patients, doctors, appointments, and so on. But what exactly do these entities store? That’s where attributes come in!


Think of entities as tables with attributes as columns and data as rows. Consider the following as an example:


Doctor (Entity or Table)

Id (PK)

Name

ContactNo

Qualification

1

John Doe

1234567899

BHMS

2

Mary Jane

9876543211

MBBS, BHMS

3

...

...

...

Note: Each entity becomes a table in our database. Each attribute becomes a column. Data is stored as rows.

We need to identify each row as a unique item, so that it can be differentiated from other items. For example, in case of Doctor table above, how does the system differentiate between John and Mary?


The system differentiates between each row using the Id column, which you will need for each entity. This is called the Primary Key (PK in short) in the database lingo.


Next we need to determine what type of data we need to store in each attribute. For Id the type is number (integer or int) in the example above.


How do we decide which attributes should be created for each entity? There are three ways:


  1. Go through the requirements again.

  2. Use your knowledge of the system which you are designing or common sense.

  3. Ask the person who helped you with requirements, meet again and discuss what information they want for each entity.


The attributes for each entity after following each of the steps listed above, here is our list.


Doctor

  1. Id: A unique number that identifies each doctor in the system.

  2. Name: The doctor’s full name, like "Dr. Sarah Smith."

  3. ContactNo: The doctor’s phone number for professional contact.

  4. Qualification: The doctor’s qualifications, like "MD" or "Homeopathic Specialist," showing their expertise.


Clinic

  1. Id: A unique number that identifies each clinic in the system.

  2. Name: The name of the clinic, for example, "Green Valley Clinic."

  3. Address: The clinic’s location, including street, city, and postal code.

  4. WorkingDays: The days of the week the clinic is open, like "Monday to Friday."

  5. StartTime: The time the clinic opens each day.

  6. EndTime: The time the clinic closes each day.


Availability

  1. Id: A unique number that identifies each availability record.

  2. WorkingDays: The days the doctor is available, like "Monday, Wednesday, Friday."

  3. StartTime: The time the doctor starts seeing patients on those days.

  4. EndTime: The time the doctor stops seeing patients on those days.


Staff

  1. Id: A unique number that identifies each staff member in the system.

  2. Name: The full name of the staff member, like "Emily White."

  3. ContactNo: The staff member’s phone number for internal communications.


Medicine

  1. Id: A unique number that identifies each type of medicine.

  2. Name: The name of the medicine, like "Aspirin."

  3. Description: Details about the medicine, such as what it treats or its ingredients.


Patient

  1. Id: A unique number that identifies each patient in the system.

  2. Name: The full name of the patient, like "Jane Doe."

  3. DateOfBirth: The date the patient was born, used to calculate age or verify identity.

  4. Gender: The patient’s gender, typically shown as a single letter (e.g., "M" for male, "F" for female).

  5. ContactNo: The patient’s phone number for appointment reminders or contact.

  6. Address: The patient’s home address, where they live.


Appointment

  1. Id: A unique number that identifies each appointment.

  2. Date: The date the appointment is scheduled, for example, "2024-05-12."

  3. StartTime: The time the appointment begins.

  4. EndTime: The time the appointment is expected to end.

  5. Status: Describes the state of the appointment, such as "Completed" or "Missed."


AppointmentNote

  1. Id: A unique number that identifies each set of notes for an appointment.

  2. Symptom: A description of the patient’s symptoms, like "headache, dizziness."

  3. Advice: The doctor’s advice for the patient, such as "rest and stay hydrated."

  4. TestsSuggested: Any tests the doctor recommends, like "blood test" or "x-ray."

  5. PrivateNotes: Any notes the doctor wants to keep private, only visible to them.


Prescription

  1. Id: A unique number that identifies each prescription.

  2. Dosage: Instructions on how much of the medicine should be taken, like "2 tablets."

  3. UsageInstructions: Detailed instructions on how to take the medicine, like "Take with food twice a day."

  4. Quantity: The amount of medicine prescribed, such as "30 tablets."


User

  1. Id: A unique number that identifies each user in the system.

  2. Username: A name or code the user uses to log in, like a handle or nickname.

  3. Password: A secret code or key that keeps each user’s account secure.

  4. Name: The full name of the user, for example, "John Doe."

  5. ContactNo: The user’s phone number so they can be contacted.

  6. Email: The user’s email address, which can be used for notifications or account recovery.


Role

  1. Id: A unique number that identifies each type of role in the system.

  2. Name: The role’s name, such as "Doctor," "Patient," or "Staff," which defines what the user can do.


Tip: You can use a tool like ChatGPT to find suggestions for attributes to help you start with something.

As you can see we are creating a database for our as this is the first step in any system. But system or database design is incomplete without relationships between different entities or tables. In the next part, we will see what types of relationships may exist between different entities and how to translate them to the language of data.

留言


© 2024 coder000

  • Facebook Clean
  • Twitter Clean
bottom of page