Forum OpenACS Development: Assessment/ad_form questions

Collapse
Posted by Carl Robert Blesius on
http://your-site/assessment/asm-admin/item-edit-general

Tried to enter a big question and got a big error (not sure why it didn't just truncate the content silently b/c it is a varying(1000) character type).

Questions:
1. What are the diadvantages to switching the character type to text in the case of assessment question display etc.? Performance?
2. General comment: we should be catching these kind of problems in assessment and giving end users nice clean friendly error messages back (in this case: "sorry your entry is too long, please try again"). Any reason this is not standard practice? Can we automate this somehow so that ad_form catches basic things like mismatch in size of input and space in the DB (e.g. making it easier for developers to do the right thing)

Carl

P.S. Question text in error message is a fictional patient used for teaching

Database operation "dml" failed (exception ERROR, "ERROR: value too long for type character varying(1000)
")

ERROR: value too long for type character varying(1000)

SQL: insert into as_itemsi
(revision_id, object_type, creation_user, creation_date, creation_ip, title, description, item_id, object_package_id, mime_type , subtext, field_name, field_code, required_p, data_type, max_time_to_complete, points)
values ('270333', 'as_items', '496', NULL, '123.232.224.174', 'Which of the following would be the most appropriate opioid order?
X is a 43-year-old woman who was recently diagnosed with advanced colon cancer with metastatic disease in her liver and right hip. She had been doing well (pain severity range 0-2/10), but is now complaining of 6/10 pain (i.e., moderate pain) in the right hip, especially with movement. She describes her pain as deep and aching. She denies that the pain is radiating, electric in quality, or associated with paresthesias or weakness, or new onset bowel or bladder dysfunction. She has tried acetaminophen 1 gm every 6 hours, which provided little relief. She also has used ibuprofen 800 mg q 8 hours, which had been controlling the pain at rest much better, but the pain interferes with her daily activities. From your exam and her history, you believe that she is experiencing bony pain from a metastatic lesion in her hip. You develop a plan to treat her pain that includes continuation of her non-steroidal anti-inflammatory agent, initiation of bisphosphonates, evaluation for radiation therapy, and initiation of a short-acting opioid along with daily senna. ', 'X is a 43-year-old woman who was recently diagnosed with advanced colon cancer with metastatic disease in her liver and right hip. She had been doing well (pain severity range 0-2/10), but is now complaining of 6/10 pain (i.e., moderate pain) in the right hip, especially with movement. She describes her pain as deep and aching. She denies that the pain is radiating, electric in quality, or associated with paresthesias or weakness, or new onset bowel or bladder dysfunction. She has tried acetaminophen 1 gm every 6 hours, which provided little relief. She also has used ibuprofen 800 mg q 8 hours, which had been controlling the pain at rest much better, but the pain interferes with her daily activities. From your exam and her history, you believe that she is experiencing bony pain from a metastatic lesion in her hip. You develop a plan to treat her pain that includes continuation of her non-steroidal anti-inflammatory agent, initiation of bisphosphonates, evaluation for radiation therapy, and initiation of a short-acting opioid along with daily senna. ', '270063', '95713', NULL , NULL, 'QUE_270063', NULL, 't', 'varchar', NULL, '0')
while executing
"ns_pg_bind dml nsdb0 {insert into as_itemsi
(revision_id, object_type, creation_user, creation_date, creation_ip, title, descripti..."
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
("postgresql" arm line 2)
invoked from within

Collapse
Posted by Dave Bauer on
Hey Carl,

Two options here

1) Change to varchar(4000). That makes it easy to support Oracle.
2) Change to clob (oracle) or text (postgresql) This makes it a little inconvenient to support Oracle, but we have a half dozen clobs all around already for assessment and section.

Collapse
Posted by Dave Bauer on
More specifically

I suggest

for .LRN 2.2 relea se (imminent) add form validation.

then we change the datatype to text/clob and do the proper testing of upgrade scripts etc that are required for such a change.

As an aside, in general, ad_form knows nothing about the length of the column or even if you are inseting the data collected into the database at all. It seems to make sense to make it easier to validate length before inserting into the database though.