Home > Articles > Data

This chapter is from the book

Normalization Applied—Review the TEB Database and Refine the Design

With a good understanding of normalization, it is time to apply the concepts to the current project, the Time Entry and Billing Database. To review, the following tables have already been identified:

  • Case
  • Client
  • ClientCase
  • Employee
  • EmployeeCase
  • Invoice
  • TimeEntryDetail

Figure 4.5 shows the relationships between the entities.

Figure 4.5Figure 4.5 Version 4 of the Time Entry and Billing Database model represents the completed first draft of the database model.

Identifying New Columns and Tables

As you might guess, the need will arise for new tables. Before getting to that step, the existing tables must be outfitted with columns. Before going any further, it is also important to note that every time-entry issue has not been contemplated. The sample you are working through contains the basic information required to illustrate and teach the database concepts covered in this book. Let's now build up the data model started in Chapter 3, "An Introduction to Database Design."

EmployeeCase and ClientCase Tables

If you recall, the EmployeeCase and ClientCase tables are many-to-many resolver tables. Clients can be assigned more than one employee. In addition, an employee can be assigned to multiple cases. The same type of relationship exists between clients and cases. Because of the nature of these tables, no additional columns are required.

Employee Table

Let's begin with the Employee table. What type of information needs be stored in the Employee table? At a minimum, the following data elements are required:

  • Employee ID
  • First Name
  • Middle Initial
  • Last Name
  • Social Security Number
  • Address 1
  • Address 2
  • City, State, ZIP Code
  • Home Phone and Work Extension

In addition to those previously listed, a few more elements of information are required. One element is the Employee Classification. In the firm, you have partners, associates, paralegals, legal secretaries, and other administrative staff. Anytime you run into one of the classification items, it is a good bet that another table will be required. Do you remember the discussion on the third normal form? An employee classification is a generic item that is not dependent on the EmployeeID key. With this in mind, an EmployeeClassification table must be added, along with an EmployeeClassificationID foreign key in the Employee table.

Law firms typically have multiple departments. For example, a law firm might have some or all of the following departments: tax, antitrust, civil litigation, intellectual property, insurance, and municipal, to name a few. Sounds like another classification item, doesn't it? Yes, you will be adding another table to the database, called Department. In addition, you must add a field called DepartmentID to the Employee table.

NOTE

Just to keep track of things, the Employee table has the following structure:

  • Employee ID (primary key)
  • Department ID (foreign key to Department table)
  • Employee Class ID (foreign key to Employee Class table)
  • First Name
  • Middle Initial
  • Last Name
  • Social Security Number
  • Address 1
  • Address 2
  • City, State, ZIP Code
  • Home Phone and Work Extension
  • E-Mail Address

In conjunction with the new foreign keys, the following tables have been added to the data model:

  • Department
  • EmployeeClass

The Department table, in addition to having a DepartmentID field, also has a Description field. The EmployeeClass table has an EmployeeClass ID and a Description field.

Client Table

The Client table is pretty straightforward. The following elements of data need to be stored:

  • ClientID (primary key)
  • Client Type (business or individual)
  • First Name
  • Middle Initial
  • Last Name
  • Organization Name
  • Address 1
  • Address 2
  • City, State, ZIP Code
  • Phone
  • E-Mail Address

A few items need to be addressed. First, with respect to Client Type, do you need another table to hold the various types of clients the firm represents? In this case, the answer is no. While conducting your analysis, you have found that only two types of clients will ever exist: businesses and individuals. With this in mind, each client record can have a Client Type field that holds either "B" for business or "I" for individual. In a case like this, there is no practical benefit for having an additional lookup table.

How about contacts? There is no question that in the case of business clients, you will need to provide for contacts. The next question is whether you can have multiple contacts for each client. Most likely, the answer is yes. You will need contact information for the general counsel, a staff attorney, and the CEO, to name but a few. With this in mind, it would appear that clients could have multiple contacts. If you think a Contact table will need to be defined, you are on the right track!

NOTE

The structure of the Contact table is straightforward:

  • ContactID (primary key)
  • First Name
  • Middle Initial
  • Last Name
  • Title
  • Phone
  • Extension
  • E-Mail Address

What about the Title field and the need for a lookup table? Job titles are a generic item. At the same time, job titles can vary from company to company. Here is where you need to make the decision between whether to store the information in a table or link the data with another table and a foreign key. The advantage of having predefined titles stored in a table is consistency. For example, you could control variances between CEO and C.E.O. At the same time, only a handful of job titles will probably exist. When attention turns to building user interfaces, you will be introduced to some techniques that can enforce standards, and at the same time, allow for variances. With this in mind, a separate job title table will not be created. Instead, the title itself will be stored in the contact record.

Case Table

The Case table holds basic information regarding a case, including the title, judge, court, docket number, department, start date, trial date, settlement date, and notes. Is a separate lookup table required for judge and court? The answer in this case is most likely yes. The firm wants to know which cases have been tried before specific judges. In addition, the firm wants to know the breakdown of which cases have been tried in which courts. Using the City of Philadelphia as an example, state, municipal, and federal courts exist. Within these classifications are many types of courts in which a case can be tried. The firm definitely wants to keep track of which cases are tried in which courts.

NOTE

Court cases are calendar driven. In real life, a child table would be associated with the Case table that would keep track of various date-driven items, such as depositions, pretrial motions, answers, hearings, meetings with the trial judge, settlement talks, and so on. This child table would act as a tickler file to notify users when certain items are due or when appearances have to be made. Because these items are not directly related to keeping track of time and billing, this item will be ignored.

The Case table has the following structure:

  • CaseID (primary key)
  • DepartmentID (foreign key to Department table)
  • CourtID (foreign key to Court table)
  • JudgeID (foreign key to Judge table)
  • DocketNumber
  • Title
  • Notes
  • Start Date
  • Trial Date
  • Settlement Date

Every case has to be assigned to a department. For example, a patent case would be assigned to the Intellectual Property Department. What does this facilitate? When it comes time to assign employees to a case, you don't want to assign just any employees to the case. Rather, you want to assign only employees who are part of that department. As you know, an employee must be assigned to a department. As you will see later, organizing data in this manner enables you to filter the list of employees. This helps prevent mistakes, such as assigning a tax attorney to an intellectual property case. Later in the book, you will be introduced to the concepts of business rules and data integrity. As you will see, and as you can probably see already, a sound database design enhances the ability to enforce business rules and data integrity.

The new Court table contains a CourtID field and a Description field. The Judge table contains a JudgeID field, as well as a CourtID field to link with the Court table. In addition, the first name, middle initial, last name, and notes about the judge are stored as well. Even though you might not realize it, this brings up an interesting issue. The Case table has links to both the Court and Judge tables. The Judge table contains a link to the Court table, so the judge must be assigned to a court. If the judge already has a link to a court, why do you need a link to both court and judge in the Case table? This is because another judge could very likely get assigned to your case. Also, these multiple links aid in reporting.

TimeEntryDetail Table

Let's now turn to the TimeEntryDetail table. In the course of analysis, it has already been determined that a TimeEntryDetail record will link with an Invoice record when invoiced. Every TimeEntryDetail record must link to an employee-case-client combination. Remember that a case can involve multiple clients. Therefore, it is not enough to simply link to a case. The issue of which client the time gets billed to would be ambiguous. What else does the TimeEntryDetail need to store? If you have ever filled out a timesheet, you can probably guess what most of the required information will be. Elements such as description of work, date, hours, and rate are a good starting point. In this context, when rate is discussed, it is the billing rate, not the pay rate. What an employee gets paid is beyond the scope of this system. There are more issues with billing rate, so let's take a few moments to discuss those issues.

What does a client pay per hour for services performed? It depends on what the nature of the work is. For example, if administrative tasks, such as photocopying, are being performed, the client might pay $50 per hour for those services. If a paralegal is working on the case, the client might pay $100 per hour for those services, and if an attorney has to appear in court, the client might pay a flat rate of $1,500 for that service. Presently, information regarding default-billing rates is not stored in the database. A billing rate is stored in the TimeEntryDetail table. To ensure consistency and accuracy, a default rate must be stored somewhere. The question is where.

How about the Employee table? Can an employee perform different types of work? The answer is yes. An attorney might confer with the client on the phone, appear in court, or take a deposition. Each of these has different default billing rates. Based on this requirement, the nature of the work seems to define the default rate. Put another way, the default rate depends on the type of work. With this in mind, is the work category stored in the database presently? The answer is no. Therefore, a new table called WorkCategory is required. The details of the new WorkCategory table are discussed shortly. Before moving on, though, do you see how the analysis process of one table can lead to new tables and fields?

The TimeEntryDetail table has the following structure:

  • TimeEntryDetailID (primary key)
  • InvoiceID (foreign key to Invoice table)
  • CaseID (foreign key to Case table)
  • EmployeeID (foreign key to Employee table)
  • ClientID (foreign key to Client table)
  • Description
  • Hours
  • Rate
  • Work Date
  • Work Category

The question at this point is whether the TimeEntryDetail record will point to a related WorkCategory record or whether the information will be carried in the TimeEntryDetail record. In this case, the TimeEntryDetail record needs to be independent of changes to the WorkCategory table. For example, what happens if, when time is charged, the task costs $100 per hour and three weeks later the cost of that service increases to $120 per hour? If a link is all that exists, viewing the details of any TimeEntryDetail record would show the new rate. That scenario simply will not work. Further, the rate in the WorkCategory table is a default rate. The rate, after being added to a new TimeEntryDetail record, can be modified. For these reasons, the actual rate must be stored in the TimeEntryDetail record. Because the Work Category Description can change, that, too, is carried in the TimeEntryDetail record.

How do you know when a specific TimeEntryDetail record has been invoiced? You might think you need a field to indicate whether the item has been invoiced. This is where the InvoiceID field comes into play. This field serves two purposes. First, when a new TimeEntryDetail record is created, this field has a default value of 0. Then, after the TimeEntryDetail record has been included in an invoice, the new InvoiceID field is populated with a value. Therefore, any InvoiceID field equal to 0 in TimeEntryDetail has not been invoiced. This is how you know whether a specific TimeEntryDetail record has been invoiced.

The new WorkCategory table has the following structure:

  • WorkCategoryID (primary key)
  • Description
  • DefaultRate

When you view the latest version of the database model in Figure 4.6, you will not see the WorkCategory table involved in a relationship. In this scenario, the WorkCategory table acts as a template. In other words, after the data in a specific WorkCategory record is used to populate data in TimeEntryDetail, no need exists to refer to the WorkCategory table. The need for relationships and to enforce relationships is very important. These concepts are discussed in Chapter 7, "The Basics of Referential Integrity." Suffice it to say at this point that in some cases, tables exist for the purpose of giving data-entry operations a head start. Remember, after a user picks a WorkCategory, the billing rate can be modified.

Invoice Table

Last but not least is the Invoice table. The Invoice table is very straightforward and has the following structure:

  • InvoiceID (primary key)
  • ClientID (foreign key to Client table)
  • Invoice Number
  • Invoice Date

The Invoice table in this context is nothing more than glue to tie multiple TimeEntryDetail records together. One element in the Invoice table makes it unique—the Invoice Number field. In this context, an invoice number is part static and part sequential. For example, invoice number 150 in the year 2001 would have the following invoice number: 2001-150. In this scenario, the invoice number is part static prefix and part sequential. How do you produce the invoice number? Because you are still in the modeling phase, the mechanics of how to produce invoice numbers is not an issue of concern.

Reviewing the TEB Model

It is definitely time to catch your breath! Figure 4.6 illustrates the latest version of the Time Entry and Billing Database model. It is very different and more expansive than what was completed in Chapter 3. It is said that a picture is worth a thousand words. Figure 4.6 conveys a good understanding of the functions the TEB Database is going to support. It is important to note that a physical database still does not exist. In real practice, you would present this model to the primary customers of the system to ensure the requirements have been met. From a budgetary perspective, this is the time you want to catch any shortfalls in functionality that might exist. If an application can be compared to a house, the database is the foundation. If the foundation is faulty, the house will fall. You can't begin construction until the foundation has been built and has had time to settle. Rush the process, and bad things are sure to follow. This is the time in the development process to ensure your application's foundation has settled.

Figure 4.5Figure 4.6 The latest version of the Time Entry and Billing Database has been outfitted with new columns and tables and has gone through the normalization process.

Ask Questions and Get Your Users Involved!

One way you can determine whether your design is solid is to ask your database questions and determine whether the database can provide answers. For example, ask the question, "Can I determine which attorneys are working on a specific case?" Then, see whether the database can answer that question. In this case, the database can. In analyzing the design, you can see a link between cases and employees. Furthermore, employees are categorized by type in the EmployeeClass table. Obviously, if you ask a question that can't be answered, the database design is not complete.

As you might guess, catching these design gaps now, during the modeling phase, is far less expensive. Whether gaps exist can be determined by employing common sense as opposed to science. For one thing, science can't answer these questions. If you are unsure about which questions to ask, find out what the users of the system want to know. Be sure to solicit questions from all levels of the organization. Recall the earlier discussion of tactical versus strategic needs of a business? Your users will definitely appreciate being involved in the process. The more users are involved, the more likely users will take ownership and be accepting of the system.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020