Solved

Generating ID and GUID

Posted on 2008-10-11
7
417 Views
Last Modified: 2012-08-14
I have defined a PatientInfo table with following fields

PatientGUID      uniqueidentifier  not NULL
PatientID           bigint                 not NULL
LastName          Varchar(50)       not NULL
FirstName          Varchar(50)       not NULL
MiddleName       Varchar(50)
Gender              SmallInt             not NULL
VoterID              Varchar(50)
PAN                    Varchar(50)
DLNo                  Varchar(50)

PatientID can be a incrementing number starting from 1 while PatientGUID has to be generated in such a way that no two patient records have same GUID even on different installations - may be adding NIC MAC address or something.

What is the best way to generate these IDs?
0
Comment
Question by:sunnycoder
  • 4
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
rionroc earned 300 total points
ID: 22696593
Hello

The best way to generate GUID is the finger print template.
But in your case, since there is no device attach with your program, you can use the ( PATIENT ID + LastName + Firstname  + Middle Name + Gender + Voter ID)

eq.
Patiend id: 234
Lastname: Roc
FirstName: Rob
MiddleName: Tab
Gender: Male
Voter id: 125

Bring out the first letter or number:
Result is:
Patient GUID: 2RRTM1

Or you can add some digits for long trusted Globally Unique Identifier.


Great is our GOD.
:)
0
 
LVL 12

Expert Comment

by:rionroc
ID: 22696612
Oh!

You can add also the date like:
Patient GUID: 2RRTM1-OC0812
OC is for month october
08 is for year 2008
12 is for day 12

You can also add the time.
Patient GUID: 2RRTM1-OC0812-141505
14 is for the hours
15 is for the minutes
05 is for the seconds

I don't think there will be an identical GUID for that system.
And also it is an autogerated GUID if you apply that.


Great is our GOD.
:)
0
 
LVL 45

Author Comment

by:sunnycoder
ID: 22696617
VoterID is not a mandatory field - that increases the chance of a clash. Wondering if same patient registered at two different installation should have the same patientGUID. If yes then system specific GUID might be a bad ... hmm I need to give this a second thought.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 12

Expert Comment

by:rionroc
ID: 22696724
Hello

>>VoterID is not a mandatory field.
Well don't include the Voters ID in our GUID system.

>>Wondering if same patient registered at two different installation should have the same patientGUID.
It's not bad at all, our guid system has a date and time value, so it will never have an identical id.


Great is our GOD.
:)
0
 
LVL 13

Assisted Solution

by:TechTiger007
TechTiger007 earned 200 total points
ID: 22696779
For creating PatientID you can create a "Sequence" in your database
http://www.ss64.com/ora/sequence_c.html.
In your code you will have to call SequenceName.NextVal, the value will be auto incremented by your database so you wont have to worry about creating/incrementing it

For creating a GUID you can use .NET's built in GUID class
GUID.NewGUID() will give you a globally unique identifier which uses NIC, current time, etc to create an unique identifier every time

Hope that helps
0
 
LVL 12

Expert Comment

by:rionroc
ID: 22697148
Hello TechTiger007


Thanks for that answer, it gives direction to my comments for sunnycoder.



Great is our GOD.
:)
0
 
LVL 45

Author Closing Comment

by:sunnycoder
ID: 31505406
Thank you
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now