The first aspect of developing a good database design involves pencil and paper sketches to determine: table fields, field sizes, and relationships. Keep your tables small and try not to repeat data- i.e. apply “normalization” (discussed in a later chapter). The table fields can be obtained form either the Medicare National Standard Format, from the more recent CCR standards (another excellent CCR site). You can, of course, borrow the table structures of the MWEP back-end tables.
Here are the following data relationships, of which 4 basic types exist:
“one to one” | This relationship is used to break up large tables with multiple fields into logical data groupings. An example would be patients to insurance information. This type of logical normalization is prudent, since some patients will have insurance and thus carry a one-to-one association with an insurance record while those that don’t won’t have the associated record, thus saving space. |
“one to many” | This relationship includes the patient to medications relationship as well as the patient to account service dates relationships. In both of these situations there will be numerous elements in the “many” (medications or dates of service) that apply to the “one” (the patient record). |
“many to one” | This relationship is less commonly used, but can be ideal for certain
situations, s.a. when you have a group of billings for a certain service
date and you need a table that summarizes the data into one record. In
this situation you will have:
|
“many to many” | This relationship could come in handy when you need a relationship between 2 tables in which all members can have multiple associations in the opposite tables, s.a. is the case when one posts groups of widgets. |
In Access, you later could electronically post your relationships by clicking on the top toolbar: Tools à Relationships. You'll end up with the following applet:
You will need to:
The flat database table layout consists of a single, two-dimensional array of data elements, where all members of a given column are assumed to be similar values, and all members of a row are assumed to be related to one another. For instance, columns for name and chart number might be used as a part of a system security database. Each row would have the specific chart number associated with a specific user. Columns of the table often have a type associated with them, defining them as character data, date or time information, integers, or floating point numbers. This model is the basis of the spreadsheet, and represented the most common format in the first database implemented during the 1960’s and 1970’s. The flat database table model are considered somewhat inflexible due to their rigid structure and heavy reliance on applications programs to perform even the most routine processing.
The relational database table layout allows multiple tables to be used together through the use of pointers (or references), thus eliminating redundant data. In the late 1970s, this model originated in the academic research community and eventually became available in commerce, such as IBM DB2 and Oracle. In relational databases data is stored in tables made up of one or more columns. The data stored in each column must be of a single data type such as Character, Number or Date. A collection of values from each column of a table is called a record or a row in the table. Different tables can have the same column in common. This feature is used to explicitly specify a relationship between two tables. Values appearing in column A in one table are shared with another table.
Below are two examples of tables in a relational database for a local medical practice:
Notice that these 2 tables have a common linking field- the numeric “ACCT” field. In most cases there must also exist key fields that represent special columns that are used to uniquely identify rows or records in the table. You do not have to define a primary key, but it's usually a good idea. If you don't define a primary key, Access asks you if you would like to create one when you save the table. To add a key field, select the primary key button:
This allows you to have one patient with multiple medications, or a Master/Detail relationship. In the example above, the Patients table would have the “ACCT” field as the key field, and the Medications table would have the “ACCT” as well as the “Med_Name” fields as key fields thus allowing for unique records each with the same account number. Alternatively, a date/time, a sequential, or a random number field.
Working with Database Fields
Access database fields are created by entering a field name, a field data type, and other field information such as field description, field size, indexing, and of course whether or not it is a key field. The field description is an option to identify the fields purpose; it appears in the status bar during data entry. After you enter each field's name and data type, you can specify how each field is used by entering properties in the property area. Before you enter any properties, however, you should enter all of you fields names and data types.
The following table shows the various Access field data types:
Data Type |
Used For |
Text |
Text or combinations of text, numbers, and punctuations. These numbers cannot be used in calculations, such as social security numbers. Size: up to 255 characters. |
Memo |
Lengthy text and numbers, such as notes or descriptions. Size: up to 64,000 characters. |
Number |
Numeric data to be used for mathematical calculations. For calculations involving money, use the currency type. Set the FieldSize property to define the specific Number type. Size: 1, 2, 4, or 8 bytes. |
Date/Time |
Dates and times. Size: 8 bytes. |
Currency |
Currency values. Use the currency data type to prevent rounding off during calculations. Accurate to 15 digits to the left of the decimal point and 4 digits to the right. Size: 8 bytes. |
AutoNumber |
Unique sequential or random numbers automatically inserted when a record is added. Size: 4 bytes. |
Boolean |
Fields that will contain only one of two values, such as Yes/No, True/False, On/Off. Size: 1 bit. |
OLE Object |
Objects (such as Microsoft Word documents, Microsoft Excel spreadsheets, pictures, sounds, or other binary data), created in other programs using the OLE protocol, which can be linked to or embedded into an Access table. You must use a bound object frame in a form or report to display the OLE object. |
Hyperlink |
Field that will store hyperlinks. A hyperlink can be a UNC path or a URL. |
Lookup Wizard |
Creates a field that allows you to choose a value from another table or from a list of values using a combo box. Choosing this option in the data type list starts a wizard to define this for you. |
For numeric data types, the field size enables you to further define the type of number, which in turn determines the storage size. The table below shows the seven possible settings in the Numeric Field Size property. You should make the field size the smallest one possible, since Access runs faster with smaller field sizes.
Numeric Field Size Properties |
|||
Setting |
Description |
Decimal Precision |
Storage Size |
Byte |
Stores numbers from 0 to 255 (no fractions). |
None |
1 byte |
Integer |
Stores numbers from –32,768 to 32,767 (no fractions). |
None |
2 bytes |
Long Integer |
(Default) Stores numbers from –2,147,483,648 to 2,147,483,647 (no fractions). |
None |
4 bytes |
Decimal |
Stores numbers from -10^38 -1 through 10^38 -1 (.adp) |
28 |
12 bytes |
Single |
Stores numbers from –3.402823E38 to |
7 |
4 bytes |
Double |
Stores numbers from –1.79769313486231E308 to –4.94065645841247E–324 for negative values and from 1.79769313486231E308 to 4.94065645841247E–324 for positive values. |
15 |
8 bytes |
Replication ID |
Globally unique identifier (GUID) |
N/A |
16 bytes |
You can begin your Back-end program development by making a new Access database capsule. Click on File à New à then in the “New File” window, select “Blank database…”. At that point, a popup window call “File New Database” will be seen. Name your new database (in the example, the name is “dbNewDatabase.mdb”), and select a new folder to save it in if the default folder is not the one you want. Once you are finished, click on “Create”. Below you’ll see a blank new database container.
There are many small, free, and fairly complete Access databases out there either on the internet or from inside disks that come with instructional MS Access books. Sites with numerous inexpensive “solutions” include:
Buy “Microsoft Access 2000 Bible” which will include a program called “Check Writer” which is an excellent starting point for your future MS Access product. The all-inclusive book sells for less than $2.00. The Check Writer software is free with that book, or you can buy it online here for $50 to $600.
Alternatively, you can choose one of MS Access’ existing database types, set up by a database wizard which will guide you I using the software.
As discussed earlier, the single most important thing that distinguishes relational from the older flat style database is the table links. In the medical database example presented, the Patients table is related to the Medications table by virtue of the “ACCT” field appearing in both tables. Access has a means to make this relationship explicit using the Relationships screen. Access uses this information when designing reports, forms and queries that require more than one table to be displayed.
To get started, display the Relationships screen by pulling down the Tools menu and selecting the Relationships menu item. The blank Relationships screen will appear:
Now right click on the Relationships screen à Show Table to add more tables:
To connect the Customers table with the Accounts table to form a relationship, click on the ACCT field in the Patients table and drag it over on top of the ACCT field on the Medications table. Upon releasing the mouse button, the Edit Relationships dialog box will appear, and you’ll be able to set up at least one relationship between the tables to be linked:
Access will do its best to determine the Relationship Type (almost always One-to-Many).
One additional step to be taken is the check off the box labeled "Enforce Referential Integrity". This option puts constraints into effect such that a Medications record can not be created without a valid Patient chart and Access will also prevent a user from deleting a Customer record if a related Accounts record exists. At this point, click on the Create button to create the relationship.
If you wish to delete a relationship, simply click on the relationship line and press the delete button.
Once you have finished placing all of your tables into one container, you can use the Database Splitter Wizard to make a front-end encasement for your future forms and reports whose datasets will be based on linked versions of the original tables. Small lookup tables are occasionally best left on the front-end for speedier lookup lists. Click on ToolsàDatabase Utilitiesà Database Splitter to split the Back-end tables.
At some point you need to determine what type of Back-end architecture your program is going to have as Back-end. As a developer of small to medium office systems, I am still an avid user of the “file-server” JET table structure. Over the years it has
Can handle up to 2GB of data.
Data computation is limited to a single thread.
The condition under which each database engine is the most effective with Access 2000 in the small business organization is as follows. In summary, the Jet Database Engine, a “file-server” architecture that locally does all the computation and recordset manipulation, should be used if:
You want the highest compatibility with Access 97 or earlier versions. [not important anymore]
Your environment has a small number (<20) of simultaneous users.
You have very low resources, such as memory or disk. Another way of stating this is, "You don't want to blow your dough on a Back-end dedicted server."
In certain instances, processing the data at the level of the end-user computer can be preferred, unlike what happens in a client-server setup.
Ease-of-use is a premium. [VERY IMPORTANT!!!]
Use the MSDE database engine, a “client-server” architecture where the computation and recordset manipulation is done on a dedicated server, if:
You want to develop from a single code base, from a single user to thousands of users. [i.e. for a hospital, not a small office]
You expect a future need for greater scalability. [i.e. you want to blow even more money in the future for power you may not need]
You require easy merge replication with the central server. [you can replicate your Jet databases too, but even Microsoft suggests being careful if your table grows to too large a size, with any platform when replicating your data.
You need the best security. [You can code in decent security within Jet 4.0.]
You need greater reliability, such as transaction logging.
Your system is online 24 hours a day, 7 days a week. [You can automate the backup process via code, as I've done with my programs]
You need stored procedures and triggers.
The future for these softwares looks promising. As for JET,
SQL Server Express is the newest version of SQL Server 2005 that can be
t helps developers build robust and reliable applications by providing a powerful database that is not only free and but easy to use. You can design schemas, add data, and query local databases, all inside the Visual Studio 2005 environment. If you need more advanced database features, then SQL Server Express can be seamlessly upgraded to more sophisticated versions of SQL Server. On the downside, itThe Upsizing Wizard is an add-on tool that will take your Access database into the SQL Server environment. It is available from a variety of sources, including your MS Office 2000 (or higher) software disks and the Microsoft Developer Network. For an introduction to and demonstration of using the MS Access Upsizing Wizard as well as information on what to check prior to upsizing, design considerations, suggested troubleshooting techniques for common upsizing issues and additional resources for information, please refer to “How to Use the MS Access Upsizing Wizard” at
At this point, begin creating your tables with the fields that you wish to assign in a normalized manner. You should refer to the back-end tables in the MWEP for assistance. You should start with at least` the following tables:
As you develop your UserForms, you will find that you will need many more tables, s.a. for data lookup and for other patient data.
Bibliography:
Contents:
Database models
Developing A Blank Back-end Container
Using An Existing Database Project
Creating and Using Your First Table
Splitting Your Database
Jet 4.0 vs. MSDE vs. SQL Back-ends
Using the Upsize Wizard to Move Your Back-end Architecture from
JET to MSDE
Applying this Tutorial to Your EMR Project