예제 #1
0
파일: feather.py 프로젝트: Livruen/sdaps
from sdaps.utils.ugettext import ugettext, ungettext

_ = ugettext

export = export_subparser.add_parser('feather',
                                     help=_("Export data to feather file."))
export.add_argument(
    '-o',
    '--output',
    help=_("Filename to store the data to (default: data_%%i.feather)"))
export.add_argument('-f',
                    '--filter',
                    help=_("Filter to only export a partial dataset."))
export.set_defaults(direction='export')
script.add_project_argument(export)


@script.connect(export)
@script.logfile
def feather(cmdline):
    import pandas
    import sdaps.pandas

    survey = model.survey.Survey.load(cmdline['project'])

    if cmdline['direction'] == 'export':
        if cmdline['output']:
            filename = cmdline['output']
        else:
            filename = survey.new_path('data_%i.feather')
예제 #2
0
파일: csvdata.py 프로젝트: sdaps/sdaps
_ = ugettext


parser = script.add_subparser("csv",
    help=_("Import or export data to/from CSV files."),
    description=_("""Import or export data to/from a CSV file. The first line
    is a header which defines questionnaire_id and global_id, and a column
    for each checkbox and textfield. Note that the import is currently very
    limited, as you need to specifiy the questionnaire ID to select the sheet
    which should be updated."""))

subparser = parser.add_subparsers(dest='subcommand', required=True)

export = subparser.add_parser('export',
    help=_("Export data to CSV file."))
script.add_project_argument(export)

export.add_argument('-o', '--output',
    help=_("Filename to store the data to (default: data_%%i.csv)"))
export.add_argument('-d', '--delimiter',
    help=_("The delimiter used in the CSV file (default ',')"),
    default=',',
    action='store')
export.add_argument('-f', '--filter',
    help=_("Filter to only export a partial dataset."))
export.add_argument('--images',
    help=_("Export images of freeform fields."),
    dest='export_images',
    action='store_const',
    const=True,
    default=False)
예제 #3
0
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from sdaps import model
from sdaps import script
from sdaps.cmdline import report_subparser

from sdaps.utils.ugettext import ugettext, ungettext
_ = ugettext

parser = report_subparser.add_parser(
    "tex",
    help=_("Create a PDF report using LaTeX."),
    description=_("""This command creates a PDF report using LaTeX that
    contains statistics and freeform fields."""))
script.add_project_argument(parser)

parser.add_argument(
    '--suppress-images',
    help=
    _('Do not include original images in the report. This is useful if there are privacy concerns.'
      ),
    dest='suppress',
    action='store_const',
    const='images')
parser.add_argument('--suppress-substitutions',
                    help=_('Do not use substitutions instead of images.'),
                    dest='suppress',
                    action='store_const',
                    const='substitutions',
                    default=None)