New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a field in the questionnaire from a database like the address of the replier enhancement #11

Open
julienfr112 opened this Issue Dec 7, 2012 · 16 comments

Comments

Projects
None yet
5 participants
@julienfr112

julienfr112 commented Dec 7, 2012

I'm trying to modify the latex.py in the stamp directory to modify the tex text , for example remplacing Address by the value of a dict that i would have populate maybe in the ids command.

@benzea

This comment has been minimized.

Member

benzea commented Dec 7, 2012

That sounds very useful. Inside LaTeX we could simply use pgfkeys and put the data into a tree structure. Something like:

\pgfkeys{/sdaps/ID/key1=1,/sdaps/ID/key2=2}

Then it can easily be used by querying the data inside the questionnaire.

The next question is how to get the data into SDAPS. The ids command would make sense, but how to define a separator or similar? I don't have a good idea right now. Some file format that allows storage of IDs and other key/value data that belongs to the ID would make sense.

@benzea

This comment has been minimized.

Member

benzea commented Dec 7, 2012

Hm, as a quick way to implement it one could \input the data instead of telling SDAPS about it.

@benzea

This comment has been minimized.

Member

benzea commented Dec 7, 2012

I tried to create a proof of concept based on the idea. You can have a look at http://benjamin.sipsolutions.net/tmp/sdaps-variable-test.tar.bz2.

@julienfr112

This comment has been minimized.

julienfr112 commented Dec 10, 2012

Amazing, thanks so much. I'll try that asap.

@pkimber

This comment has been minimized.

pkimber commented Oct 24, 2013

So... I am guessing this enhancement would allow us to print (for example) a name which is linked to the stamp (id) of the questionnaire? We would like to give each questionnaire to a specific person.

What is the status of this issue? Is there anything I can do to help get this working?

Thank you 👍

@benzea

This comment has been minimized.

Member

benzea commented Oct 24, 2013

Yes, that is the general idea.

The status is that nothing is happening currently. I don't have a need for this myself (and I am the main person working on SDAPS), so I am not pushing this forward.

In theory the whole thing is pretty simple (heck, the test above does kind of work). The interesting part is what kind of support should be in the main SDAPS program, and how the interaction with LaTeX (and maybe even ODT Projects) should happen.

The LaTeX side is pretty simple; the main issue is to ensure that the layout won't be destroyed for weird input strings.

@ferdisdot

This comment has been minimized.

Member

ferdisdot commented Oct 24, 2013

I think a \parbox should solve this issue as it could be fixed in width and height: http://www.golatex.de/wiki/%5Cparbox.

So put all data inside a parbox and there should not be any problems with a changing layout.

@ferdisdot

This comment has been minimized.

Member

ferdisdot commented Oct 24, 2013

Sorry for the link to a german documentation here is an englisch version: http://en.wikibooks.org/wiki/LaTeX/Boxes#minipage_and_parbox

@pkimber

This comment has been minimized.

pkimber commented Oct 25, 2013

Very good. I will give this a go. Thank you 👍

@tornadof3

This comment has been minimized.

tornadof3 commented Jan 8, 2015

Hello

Thank you for the proof of concept about adding eg 'name of student' to top of test paper based on ID etc.

I can't get the stamp command as above to work with the suggested commands and sample data. Here's the output below. Have there been any recent changes to SDAPS that prevent this working? I'm new to SDAPS today and using v1.1.8 [it seems great!]. Thanks.

user@user-VirtualBox:~/quest1/quest2$ sdaps test stamp --existing

- SDAPS -- stamp

Running pdflatex now twice to generate the stamped questionnaire.
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Error: Error running "pdflatex" to compile the LaTeX file.
Error: An error occured during creation of the report. Temporary files left in '/tmp/tmpqv2ZdN'.
Traceback (most recent call last):
File "/usr/bin/sdaps", line 23, in
sys.exit(sdaps.main())
File "/usr/lib/python2.7/dist-packages/sdaps/init.py", line 64, in main
return cmdline'_func'
File "/usr/lib/python2.7/dist-packages/sdaps/script.py", line 105, in decorated_function
result = function(cmdline)
File "/usr/lib/python2.7/dist-packages/sdaps/cmdline/stamp.py", line 56, in stamp
return stamp.stamp(survey, output, cmdline)
File "/usr/lib/python2.7/dist-packages/sdaps/stamp/init.py", line 90, in stamp
create_stamp_pdf(survey, output_filename, questionnaire_ids)
File "/usr/lib/python2.7/dist-packages/sdaps/stamp/latex.py", line 67, in create_stamp_pdf
raise AssertionError('PDF file not generated')
AssertionError: PDF file not generated

@benzea

This comment has been minimized.

Member

benzea commented Jan 8, 2015

The error message is not very helpful as is. Could you provide the generated .log file (it is in the temporary folder '/tmp/tmpqv2ZdN' in this case). It might be a lot of different things, but i don't think that the general concept failed. It is more likely that the ID is simply not in the file containing the data or the file is not in the SDAPS folder.

@benzea

This comment has been minimized.

Member

benzea commented Jan 9, 2015

Uhoh. This is not good.

It looks like I broke the LaTeX search path while adding some security features and that broke opening files from the project directory (to secure http://demo.sdaps.org a bit). This will also affect any images or similar resources that might be used right now.

@tornadof3

This comment has been minimized.

tornadof3 commented Jan 10, 2015

Ah, so does this mean it won't work at present?

@benzea

This comment has been minimized.

Member

benzea commented Jan 10, 2015

Yes. I think it was broken by commit a6ca773 so 1.1.7 is not affected by this particular bug, but 1.1.8 is. I have not yet investigated it more.

benzea added a commit that referenced this issue Jan 10, 2015

Correctly set LaTeX search path.
This problem broke stamping if any additional files are required to
compile the LaTeX document (mentioned in issue #11).
@benzea

This comment has been minimized.

Member

benzea commented Jan 10, 2015

Well, that was an easy fix.

@tornadof3

This comment has been minimized.

tornadof3 commented Jan 12, 2015

OK, that last commit seems to have worked well, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment