We are currently working on the forum. For the short-term, all forum content will be in read-only format. We apologize for the interruption and look forward to collaborating with you shortly. All the best in your research!

Problem with updating Person ID

We are trying to update Person ID for a subject to a value that exists in another study and it won't let us, it says:

"Person ID has been used by another subject, please choose a unique one.
Another subject has been assigned this Study Subject ID. Please choose a unique identifier."

There is no problem to use an existing Person ID when enrolling the subject. The problem only occurs when editing the subject record.

Has anyone found any workarounds to this?



  • leandroamparoleandroamparo Posts: 15
    via Email
    what i know is that you can change the person id, but it is unique for the
    whole system as the study subject id.
  • mvirtosumvirtosu Posts: 276 ✭✭
    What we are trying to accomplish is linking subjects across studies, so yes one unique subject Person ID would link to different study subject IDs in different studies.
  • kristiakkristiak Posts: 1,340 ✭✭✭

    Use the following settings: Also make sure that the person ID is unique, PID, social security number. This will prevent entering the same patient twice. Also, don't run several studies in the same instance of OC.

    Person ID Required?: Required Optional Not Used
    Show Person ID on CRF Header?: Yes No
    How to Generate the Study  Subject ID?:      Manual Entry Auto-generated and Editable Auto-generated and Non-editable
  • haenselhaensel Posts: 602 ✭✭✭
    That's the best option you can take.
    kristiak said:

    Also, don't run several studies in the same instance of OC.

  • agoodwinagoodwin Posts: 131 admin
    via Email
    Hello Mihai,

    As far as I know, Person ID should work as expected. Meaning; you can have
    1 Person ID with more than 1 associated Study Subject ID. If you are trying
    to update the Person ID to one that exists already, the sex and DOB must
    match. The assumption is that if they are the same person, those values
    must be the same. Please let us know if that works.


    On Wed, Jul 16, 2014 at 7:02 AM, haensel
  • haenselhaensel Posts: 602 ✭✭✭
    edited July 2014
    Hi Alicia

    I checked the source code of OC-3.3 and it looks like this:
    1. UpdateSubjectServlet [line 268] uses the SubjectDAO.findByUniqueIdentifier to find another subject with the same PersonID but different subject id.
    2. SubjectDAO [line 278] uses a SQL query 'findAnotherByIdentifier' that looks like this:
      1. SELECT * FROM subject WHERE unique_identifier = ? and subject_id !=?
    3. in UpdateSubjectServlet [line 269] the subject id is checked (sub1.getId() > 0) and if this expression is true, the "person_ID_used_by_another_choose_unique" error message is added

    To summarize this, the error is thrown if there is another subject with the same PersonID (as described by Mihai).



  • haenselhaensel Posts: 602 ✭✭✭
    One more addition. In the source code the PersonID is named "uniqueIdentifier" which might explain why it is implemented like this.
  • haenselhaensel Posts: 602 ✭✭✭
    There is even a second check that prevents from reusing the same PersonID

    SubjectBean subjectWithSameId = sdao.findByUniqueIdentifier(uniqueIdentifier);
    if (subjectWithSameId.isActive() && subjectWithSameId.getId() != subject.getId()) {
       Validator.addError(errors, "uniqueIdentifier",  resexception.getString("another_assigned_this_ID_choose_unique"));

    there are substitutions for findByUniqueIdentifier that seem to address this problem
    • findByUniqueIdentifierAndAnyStudy
    • findByUniqueIdentifierAndStudy
    • findByUniqueIdentifierAndParentStudy

    I hope this helps


  • mvirtosumvirtosu Posts: 276 ✭✭
    Thank you all for responding. Yes, Person ID is called unique_identifier in the database. And yes, we are providing the same DOB and sex and it just does not work in edit mode, it only works when you first enroll the study subject.

    This check posted by Christian above does not make sense to me:

    if (subjectWithSameId.isActive() && subjectWithSameId.getId() != subject.getId())

    If you are trying to edit an existing person ID to something that already exists in the subject table, of course that the ids are going to be different, after all you can't have duplicates in this table anyway. So in this case, instead of throwing the error, just ask the user for confirmation "this Person ID already exists in the database in another study, are you sure you want to make this change?".

    Hope this makes sense,

This discussion has been closed.