[Cubicweb] cubicweb-questionnaire : changing "Answer"

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Thu Mar 20 15:51:52 CET 2014


Hi,

Antoine, I think it's best to create a ticket for this issue here:
	http://www.cubicweb.org/project/cubicweb-questionnaire
Then you can associate a patch to the ticket and wait for it to be reviewed.

Still, I'm not certain how to handle the attribute 'Answer.value' the
type of which depends on the value of another attribute 'Question.type'
in an related entity. Ideas anyone?

Should we have an abstract class "Answer"?
	Answer
	├── AnswerIndex
	├── AnswerNumerical
	└── AnswerText
Like Measure in brainomics?
	Measure
	├── Scan
	├── GenomicMeasure
	└── QuestionnaireRun

Dimitri

Le 18/03/2014 15:03, Dimitri Papadopoulos Orfanos a écrit :
> Dear all,
> 
> The "Answer" entity defined in the "questionnaire" cube has an attribute
> "value" of type "float". This attribute is interpreted as either an
> index in an array of possible answers, or a numerical value, based on
> the value of the "type" attribute of the associated "Question".
> 
> We feel adding new textual answers is not easy:
> * query list of possible answers,
> * split into list of possible answers,
> * append new answers missing from the existing list,
> * join the list of possible answers,
> * insert possible answers,
> * insert new textual answers as an index.
> 
> Instead we suggest:
> * Change the type of the "value" attribute from "float" to "str" (or
> "unicode").
> * Expand the possible values of the "type" attribute of the "Question"
> entity: add "index" to "numerical" and "text".
> * Handle the "value" attribute of "Answer" differently based on the
> value of the "type" attribute of the associated "Question" entity.
> 
> We could submit a patch.
> 
> What would you recommend? Would you consider a patch for inclusion?
> 
> Best,

-- 
Dimitri Papadopoulos
CEA/Saclay
I2BM, NeuroSpin
F-91191 Gif-sur-Yvette cedex, France



More information about the Cubicweb mailing list