OHDSI Home | Forums | Wiki | Github

[SOLVED] Is it possible to use long integer (77 digits) as a Person_ID

Hi community! My project is trying to gather patient data in OMOP CDM from many hospitals where patients may have cross visits between hospitals, but the patients’ hospital numbers (HN) are totally different. We really want a unique person_ID for each patient, but we don’t want to use the raw CitizenID. Thus, we plan to use SHA256 hashing on the CitizenID and convert the result to an Integer. This method will help us create a unique but de-identified ID. However, the length of the Integer will be super long, like 77 digits.

So, my question is, is it possible to use a long integer (77+ digits) as a Person_ID, or is there any other method that we can use for every hospital to create a unique Person_ID?

Thank you so much!"

Hi Ravi,

Sure, you can use bigint for person_ID, we do the same for all our conversion. It will affect only on final CDM database size.


oh… wait I missed that you want to use (77+ digits) bigint max has 9,223,372,036,854,775,807
so guess you need to find to generate person id differently

1 Like

Hi Anton,

Thank you so much for your helpful suggestion. Apparently, I have found that BIGINT can only cover a maximum length of 19 digits. Is there any possible way to accommodate integers with 70+ more digits in the ID of the table? If not, is there any other method we can use to create a unique Person_ID for every hospital?


you can move SHA256 to person_source_value
and for person_id use something like row_number() or etc.

I mean,
Person.Person_id will be autogenerated identifier int/bigint, this value will be uses in other CDM tables
Person.Person_source_value is string and you can use your original person_id (70+) value.
Finally, you can easily map between autogenerated identifier and the initial person_id

1 Like

Hi Anton,

This sounds great to me. Thank you so much

Best regards,

1 Like