Normal Topic Database design question (Read 1674 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Database design question
Mar 12th, 2004 at 3:43pm
Print Post Print Post  
I am trying to figure out the best method to use for creating a customer record id. I would really value the input from you folks on the forum.

I have now created test Sesame applications using different methods of creating record ids. The old Q&A @number style and using a combination of layout elements.

In Q&A I used a sequential numbering system to create unique record ids. The reason for this was that it was an indexed field used as the main method of searching. In Sesame we do not use indexing so this reason is not valid.

In an article in Inside Sesame it describes using a combination of elements to create the record id such as first 3 letters of last name plus last 4 of zip. This has some benefits like being able to figure out id quickly and it is easy to create and maintain.

However it is very conceivable that you will have duplicates. I ran a test on some existing data and have many duplicates even using part of first, entire last plus entire zip.

On record entry this is easily dealt with by using a pop-up list to determine the correct customer but if I use this numbering system and plan to use it in my xlookups or with posting wont this be a problem.

Am I missing something?

If I plan on using features like Xlookup and Posting do I need to use the unique numbering method?

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Database design question
Reply #1 - Mar 12th, 2004 at 3:47pm
Print Post Print Post  
If you need to be able to get/post values from/to a specific record, then it is critical that you be able to uniquely identify which record you want.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Database design question
Reply #2 - Mar 12th, 2004 at 3:57pm
Print Post Print Post  
Thanks for the fast reply  Smiley

This information is so critical to understand and comprehend so the correct decisions are made in the design stages of planning for my particular needs. 

I now feel a little more confident with my methodology.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
TJCajun
Junior Member
**
Offline


"Laissez les bons temps
rouler"

Posts: 72
Location: Louisiana
Joined: Nov 25th, 2002
Re: Database design question
Reply #3 - Mar 12th, 2004 at 4:52pm
Print Post Print Post  
Bob, you are right, the use of partial name values and zip or partial zip values can produce non-unique values.  The use of something like @Number to generate sequential records should eliminate the chances of non-uniqueness, but doesn't help with customer record "recognition" if you want to pull it from a pick list or such.  (Whereas use of letters of first/last names and zip, would probably allow you to recognize which customer record you wanted to select).

NOTE:  "Recognizing" a customer record from a picklist, is entirely a different thing than selecting a (hopefully, and it better be!) unique record via XLookup or posting to a unique record.

There probably needs to be some "error trapping" in the process of the unique record creation procedure, so that when a (hopefully) unique value is generated to positively and uniquely identify that record, this value is checked against all such other values in the database.  If such is done, then perhaps use of letters from first/last name, and digits from something more unique than a zip code (perhaps telephone number, or social security number if known) would work.  Problem with phone numbers is that customer may change phone numbers, and if you generate a "unique" record for the customer with the newer phone number, you may now have 2 records in the database for the same customer.  Those record ID values are "unique" unto themselves, but do NOT provide for a SINGLE, unique record for that customer!

Hope my rambling has been of some help.
T.J.
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Database design question
Reply #4 - Mar 12th, 2004 at 7:09pm
Print Post Print Post  
Unique Number creation is always very important part of application. Practically all different systems of creating unique number has some limitation and sometimes one can combine the different systems to deal with the problem.  I have to create multiple unique# to accomodate my needs.  I will describe how do I produce various Unique numbers in my applications.

1.  I use @number only when Unique Number created in Mass Update because
     a.  Reading it does not make any sense
     b.  The number changes when you go in @add mode and escape it, system takes it as if it was used but in reality that number was not used and consequently it will create a break in the sequence and cause error in loops.
     c.  You can use only one number counter per application.

2. I have to deal with patients. Most of the Insurance company and Medicare assign SS# as ID, so for me in patient file SS# is one of the Unique numbers. What about Medicaid patient? Fortunately in Illinois they are assigned 9 digits recipient number, so that takes care of problem there. How about young children who do not have SS# ?  I take birthdate @num(YYYY/MM/DD) that makes 8 digits and the last one to allow another 10 patient with the same birthdate, starting from 1, 2..to 0. I have not gone past two as of yet in the last 14 years. It flags me if the number was already assigned, so I increase the end digit by one.  I believe, one can apply this to name + zipcode +1 to 0 (and if you allow alphabets that will create another 26 new possibilites. ) that should take care of duplicates.

For the other Unique number for the same file I use for today's date @num (YYYY/MM/DD) + 001 for the first patient for that date and increase sequentially, this number becomes the reference number for billing and is also utilized for giving sequential# for that date. It helps automatically poping up the information about next patient when patient goes to nursing station or examination room etc. for this I have to use @xlookupr ("data\application.db", 999999999999, "Q", "Q") Q being the unique field, on form entry event.

I still have need to produce one more unique number for the day in the other application, I can see one patient many times but I see the patient once a day only so ID + @date (YYMMDD) is the other unique number, that basically deals with patient data on the particular day.

I practically ran into problem when using variable integer because it could not hold value high enough to do @xlookupr command for data retrival but Mark bailed me out with that suggesting that Double variable does not have such limitation.

One can use globalvalue( ) to create multiple uniuqe number but looking at them would not make any sense.

My explanation and use might not be easily understandable and I might not be making it any easier to understand but they have been working perfectly for several years for me.  Please excuse me for not being very clear and rambling kind of way to present myself.


  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Database design question
Reply #5 - Mar 12th, 2004 at 8:34pm
Print Post Print Post  
TJ, Thanks for the reply. It all helps !

Bharat,

Thanks, your response made a lot of sense. We have similar needs to deal with.  I can relate very well to what you are saying. I am approaching the point that I need to stop just learning and experimenting and start putting in place a working system. I am trying to anticipate some long term issues.(so much for my extreme programming modality) My fear in continuing to use the social security number is that patients are becoming more and more reluctant to give them out, A large part of the cardiac patients we treat are extremely old and have trouble remembering their ssn and the way things are going with hippa  they  will stop us from having the ssn on paperwork soon.

I am currently taking many of the pieces I have experimented with and am figuring what worked, what users liked and what users do not like and will start putting them together in a cohesive manner. The biggest objection / problem I get from the users that I have not delt with and have not decided how to handle yet is the command tree. It seems like I might end up with more buttons that the user presses and less access to the command tree.

Have you become comfortable with the users using the command tree or what are you planning.

(Anyone else who has opinions or thoughts please feel free to jump in)
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Database design question
Reply #6 - Mar 12th, 2004 at 9:08pm
Print Post Print Post  
Quote:
A large part of the cardiac patients we treat are extremely old and have trouble remembering their ssn and the way things are going with hippa  they  will stop us from having the ssn on paperwork soon.


I believe most of them have Medicare and medicare ID is the same as SS# plus one or two more alphbet and digit or mixed like A, M1, C2, D, ( I do not use them in ID, but they have a separate element assigned to it).  The day medicare stops using ss#, they will have to assign some unique ID. Insurance companies are also using SS# for ID and they will have to assign some number if they decide not to use SS#.  May be two digits from Insurance company plus assigned ID will make unique#.  We will have to decide howmany digits unique number should contain after they establish some guidelines about their Non-SS# ID.

Quote:
Have you become comfortable with the users using the command tree or what are you planning. 


Command Tree is definitely not as user friendly as the menu system. I plan to have a menu system for employees.  I haven't put everything together yet, and I am glad I did not because if there is a problem with @xlookupr (@fn, 999999999999, "ID", "ID") command has a problem in networked application, I would not have gone much further and along the way had many Maalox moments.  I hope Sesame Development come out with some menu system before version 2.0 else we will have to deal with the work-around menu system using a form in "add" mode and using @selectTreeItem ( ) and hiding command tree from them. I believe it is workable until something better comes out.
  
Back to top
 
IP Logged