Please join your peers on either March 26 (8pm GMT) or March 28 (8am GMT) to watch as user extraordinaire and forum legend @"lindsay.stevens" demonstrates OpenClinica Insight.

See preview and register at

Insight makes it easy to ask questions of ALL of your clinical and operational data and visualize answers via interactive reports and dashboards. The idea is simple, but the results are powerful: ask your questions, choose your visualizations, then return often for updated, interactive results that link you to all of the underlying data.

Automatic StudySubjectID generation - strange behaviour

Hi Everybody,

I noticed very strange behaviour on one of my production servers. For some studies we use the autogenerated StudySubjectID option in study setup. This was working fine for years but last week for some reason there was a huge jump in this autogenerated index (the patient with StudySubjectID of 590 was followed with new patient with StudySubjectID 160079 ... and the following patients are 160080, 160081 ...).

I was in an impression that OC uses study_subject_study_subject_id_seq sequence to generate these IDs but this does not seem to be true, because when I look into a current value of this sequence it correspond to last primary key from study_subject table. So this one cannot be used to generate StudySubjectID attribute (which is represented with label column in stud_subject table).

Actually I did not find any sequence in OC database that would correspond to my new patients StudySubjectIDs. Does anybody has an idea how OC actually handles this autogeneration of StudySubjectIDs? Eventually I would also welcome some feedback regarding how can I set this counter to some reasonably smaller numbers.




  • kristiakkristiak Posts: 1,281 ✭✭✭
    via Email
    Hi Tomas,

    No I have never seen anything like this. Which version of OC did you use?


  • toskriptoskrip Posts: 253 ✭✭
    This behaviour occurred on OC 3.4. For the beginning I would just like to understand how OC does the SSID generation, because obviously the sequence is used only for the primary key and not for the SSID.

  • GerbenRienkGerbenRienk Posts: 768 ✭✭✭
    Hi Tomas,
    I think that the maximum StudySubjectID is taken, as far as it concerns integers. The new ID will be the max plus 1. And the maximum is per instance, so across all Studies.
    Kind regards,
    Gerben Rienk
  • toskriptoskrip Posts: 253 ✭✭
    edited January 2016
    Hi Gerben,

    Yeah it looks like you are right. In one study with manual StudySubjectID the data entry used wrong value. I corrected it but obviously OC generated oc_oid which (SS_.....) which is fixed. Could it be that OC looks for maximum id within oc_oid column?

  • toskriptoskrip Posts: 253 ✭✭
    Ahh no... I see now. I corrected the wrong one but than I already had another with plus 1 in a table.....

    thanks Gerben
Sign In or Register to comment.