Solved

Generating ID and GUID

Posted on 2008-10-11
7
412 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
visual Basic Net vs c# net 8 56
Change data in datatable 8 18
Create XML 5 34
MVC5 Dataformat String for Phone not working 3 11
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

16 Experts available now in Live!

Get 1:1 Help Now