Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

I need to increase the answer code length

  • guillem
  • guillem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago - 6 years 9 months ago #155832 by guillem
Dear Community,

For a research project I need to reuse some standardized codes (SNOMED CT & Health Care Provider Taxonomy Codes) as answer codes.

Our hospital IT department says that this is not possible with limesurvey because only 5 alphanumeric characters are allowed and we need 10…

How easy (or difficult) is it to hack our limesurvey platform (2.05 version) to increase the answer code length?


Thank you for your help

Guillem
Last edit: 6 years 9 months ago by guillem.
The topic has been locked.
More
6 years 9 months ago - 6 years 9 months ago #155838 by Ben_V
Replied by Ben_V on topic I need to increase the answer code length
Hi Guillem,

I wonder if we can expect some good news about this limit in the coming soon LS 3 version… :unsure:

Actually this is an old -undervalued- well known issue and you can find in this forum some other related posts, mainly written when the possibility to use underscores was removed (allowed until LS 2.00 version). FYI, I personally started the following discussion in the french forum (considering your first name I suppose you are Catalan and likely able to understand french, right ?):
=> www.limesurvey.org/community/forums/fren...nde-interopérabilité

This 5 chars limit is in my opinion critical for (growing) users needing to work with standardized codes, references, >5 chars zip codes (like India), etc. (on the other hand, I think that not allowing underscore is nowadays not critical since big standards don't use it anymore.)

I can't really answer your question but I guess it should be tricky to hack LS core code for this purpose. If you really have to handle SNOMED & NUCC as answer codes, you should consider to use REDCaP for your study...

Edit: I'm not sure if increasing VARCHAR(5) in the db have unwanted effects or not but you can try as proposed here:
bugs.limesurvey.org/view.php?id=7593

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 6 years 9 months ago by Ben_V.
The following user(s) said Thank You: guillem
The topic has been locked.
More
6 years 9 months ago #155846 by Ben_V
Replied by Ben_V on topic I need to increase the answer code length
If want to do give this some try, install a new instance ( github.com/LimeSurvey/LimeSurvey/tree/2.06lts ) and try the following after replacing values by your new code length


1) Update "varchar(5)" 'code' column in 'lime_answers' & 'lime labels' tables

2) Update application/models/Answer.php (#79)
Code:
array('code','length', 'min' => 1, 'max'=>5),

3) Update application/views/admin/labels/labelview_view.php (#75)
Code:
maxlength='5' size='6'

4) Update application/views/admin/survey/Question/answerOptions_view.php (lines #98 & #113)
Code:
maxlength='5' size='5'


Test the more you can... &give us some feedbacks ;)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: guillem
The topic has been locked.
  • guillem
  • guillem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago #155859 by guillem
Replied by guillem on topic I need to increase the answer code length
Nice! We will give this a serious try in the next few days and let you know :)

Thank you very much!
The topic has been locked.
More
6 years 9 months ago - 6 years 9 months ago #155928 by Ben_V
Replied by Ben_V on topic I need to increase the answer code length

1) Update "varchar(5)" 'code' column in 'lime_answers' & 'lime labels' tables

2) Update application/models/Answer.php (#79)

Code:
array('code','length', 'min' => 1, 'max'=>5),

3) Update application/views/admin/labels/labelview_view.php (#75)
Code:
maxlength='5' size='6'

4) Update application/views/admin/survey/Question/answerOptions_view.php (lines #98 & #113)
Code:
maxlength='5' size='5'



SQL code for 1) (15 chars) :
Code:
ALTER TABLE `lime_answers` CHANGE `code` `code` VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '';
ALTER TABLE `lime_labels` CHANGE `code` `code` VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '';

The last but not the least:
5) Edit application/helpers/admin/activate_helper.php (#313 #385 #388)
Code:
string(5)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 6 years 9 months ago by Ben_V.
The following user(s) said Thank You: guillem
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
6 years 9 months ago - 6 years 9 months ago #155930 by tammo
Replied by tammo on topic I need to increase the answer code length
Isn't this very dangerous, since when updating possibly one (disastrous!), multiple (also disastrous) or all these modified files may be overwritten?

Shouldn't this be sent to the developers either as a change request, and when it is very important, with some money or as a well documented Pull Request?

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Last edit: 6 years 9 months ago by tammo.
The following user(s) said Thank You: Ben_V, guillem
The topic has been locked.
More
6 years 9 months ago - 6 years 9 months ago #155934 by Ben_V
Replied by Ben_V on topic I need to increase the answer code length
Hi Tammo,

tammo wrote: Isn't this very dangerous, since when updating possibly one (disastrous!), multiple (also disastrous) or all these modified files may be overwritten?

As you already know, GNU GPL licensed softwares allow to adapt the code to fit all your needs, so it's easy to understand that you can't get everything (huge customization + keep receiving standard updates from the master branch)
This said you're 100% right; This have to be said and said again:
Do not apply any standard actualization to customized installations except if you know exactly what you are updating. Always write down all your critical changes and backup db & files.

tammo wrote: Shouldn't this be sent to the developers either as a change request, and when it is very important, with some money or as a well documented Pull Request?

I'm sorry but I'm not really sure about how answer your question for the following key reasons:

1) We are not exactly talking about a new feature but about the dev team agreement to increase a critical value (sounds easy but possible side effects).
2) This limit is well known; there are some existing (old & recent) related entries in the forum & feature(s) request(s)
Additionally you may find a clear allusion included in Tom's todo list (around 2012).
manual.limesurvey.org/User:TMSWhite

TMSWhite wrote: At present, the main features which still need to be ported include:

  • new tables to support item banking and standardization of items using LOINC and SNOMED


Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 6 years 9 months ago by Ben_V.
The topic has been locked.
  • guillem
  • guillem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago #155951 by guillem
Replied by guillem on topic I need to increase the answer code length
First thanks to all the people contributing to this fabulous software…

I understand perfectly that limesurvey was originally made for surveys and not for building databases requiring strict codification in a research environment like Redcap does.

Fortunately, Ben's words (and good 1st feedback from our IT Dept.) make me think that everything is possible. Skipping updates it's not very critical when you can fulfill major requirements.

When I say that everything is possible, this of course depends on your technical skills and available time. Without IT support, I will probably have to give up with limesurvey, so it will be a really great enhancement if there is, in a near future, a significant increase of answer codes length (or a setting for this).
Unfortunately, when working with standardized codification, 5 allowed characters is pretty nothing and limesurvey almost useless. In other words, why should I invent a dirty new 5 chars code for "Behavioral neurology & neuropsychiatry" medical subspecialty when "2084B0040X" is used all over the (open data) world, where more and more, everything have to be properly labeled and interoperable.

Thanks again,

Guillem
The topic has been locked.
More
6 years 9 months ago - 6 years 9 months ago #155977 by Ben_V
Replied by Ben_V on topic I need to increase the answer code length

guillem wrote: [...]everything have to be properly labeled and interoperable.


No worries... trust in your annotation team :laugh:

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 6 years 9 months ago by Ben_V.
The topic has been locked.
More
6 years 8 months ago #156048 by Ben_V
Replied by Ben_V on topic I need to increase the answer code length
FYI, just added a note here:

bugs.limesurvey.org/view.php?id=7593

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose