Commit 8be5fa03 authored by LammLukas's avatar LammLukas

Implemented tool to generate random RWTHOnline lists and deleted old example_data

parent 6298f061
This diff is collapsed.
"""
Script to generate random user data in RWTHOnline .csv format
Author: L. Lamm (lamm@ifam.rwth-aachen.de)
"""
from src.participant import Participant
from src.utils import write_csv
"""Generate list of participants"""
participant_list = Participant.generate_random_participant_list(50)
"""Arrange Data for .csv export"""
file_data = [['STUDY_PROGRAMME',
'CODE_OF_STUDY_PROGRAMME',
'Studienplan_Version',
'SPO_KKONTEXT',
'REGISTRATION_NUMBER',
'FAMILY_NAME_OF_STUDENT',
'FIRST_NAME_OF_STUDENT',
'GESCHLECHT',
'DATE_OF_ASSESSMENT',
'GUEL_U_AKTUELLE_ANTRITTE_SPO',
'GRADE',
'REMARK',
'Number_Of_The_Course',
'SEMESTER_OF_The_COURSE',
'COURSE_TITLE',
'Examiner',
'Start_Time',
'TERMIN_ORT',
'DB_Primary_Key_Of_Exam',
'DB_Primary_Key_Of_Candidate',
'COURSE_GROUP_NAME',
'FILE_REMARK',
'EMAIL_ADDRESS',
'ECTS_GRADE',
'Information']]
for participant in participant_list:
file_data.append(['Masterstudium - Musterstudiengang',
'9999 99 999',
'3000',
'[3000] Musteringenieurwesen',
str(participant.Matriculation),
str(participant.Lastname),
str(participant.Firstname),
'D',
'01.01.3000',
str(participant.NumberOfTrials),
'',
'',
'99PV99999',
'00W',
'Musterwissenschaften',
'Max Mustermann Dr.-Ing. Univ.-Prof.',
'12:00',
'BS I (2131|101), BS II (2131|102)',
'999999',
'999999',
'',
'',
str(participant.Lastname) + '(at)rwth-aachen.de',
''])
"""Export data to .csv file"""
write_csv('./data/example_inputdata.csv', file_data)
......@@ -7,6 +7,7 @@ from src.exportable import Exportable
from randomuser import RandomUser
from random import randint
class Participant(Exportable):
"""Class for object of type Participant"""
def __init__(self, firstname=None, lastname=None, matriculation=None, number_of_trials=None):
......@@ -28,7 +29,7 @@ class Participant(Exportable):
@staticmethod
def generate_random_participant():
"""Generates a random participant using randomuser package"""
user = RandomUser()
user = RandomUser({'nat': 'us'})
participant = Participant(firstname=user.get_first_name(),
lastname=user.get_last_name(),
number_of_trials=randint(1,3),
......
......@@ -4,12 +4,11 @@ Package providing various utilities for the Miraculix software
Author: L. Lamm (lamm@ifam.rwth-aachen.de)
"""
import csv
import sqlite3
def write_csv(file, data):
"""Write data to .csv file"""
with open(file, "w+", newline='') as outfile:
with open(file, "w+", newline='', encoding='utf-8') as outfile:
file_writer = csv.writer(outfile, delimiter=';')
for row in data:
file_writer.writerow(row)
......
Metadata-Version: 1.1
Name: randomuser
Version: 1.5.1
Summary: Python class for generating random user data using https://randomuser.me API
Home-page: http://connordelacruz.com/python-randomuser/
Author: Connor de la Cruz
Author-email: connor.c.delacruz@gmail.com
License: MIT
Download-URL: https://github.com/connordelacruz/python-randomuser/archive/1.5.1.tar.gz
Description: Python Random User Generator
============================
|pypi|
|license|
|github|
.. |pypi| image:: https://img.shields.io/pypi/v/randomuser.svg
:alt: PyPI
:target: https://pypi.python.org/pypi/randomuser
.. |license| image:: https://img.shields.io/pypi/l/randomuser.svg
:alt: PyPI - License
.. |github| image:: https://img.shields.io/badge/GitHub--green.svg?style=social&logo=github
:alt: GitHub
:target: https://github.com/connordelacruz/python-randomuser
Python class for generating random user data using
`randomuser.me <https://randomuser.me>`__ API.
Basic Usage
-----------
.. code:: python
from randomuser import RandomUser
# Generate a single user
user = RandomUser()
# Generate a list of 10 random users
user_list = RandomUser.generate_users(10)
Both ``RandomUser()`` and ``RandomUser.generate_users()`` can optionally
accept a dictionary of parameter names to desired values using the
``get_params`` optional parameter:
.. code:: python
# Generate a random female user
user = RandomUser({'gender': 'female'})
# Generate a list of 10 random users from Canada
user_list = RandomUser.generate_users(10, {'nat': 'ca'})
For more information on what parameters can be specified, see the
`randomuser.me documentation <https://randomuser.me/documentation>`__.
.. readme-only
Method Overview
---------------
For details on the RandomUser class and optional parameters for these
methods, see the
`documentation <http://connordelacruz.com/python-randomuser/randomuser.html>`__.
Getter Methods
~~~~~~~~~~~~~~
- ``get_cell()``
- ``get_city()``
- ``get_dob()``
- ``get_email()``
- ``get_first_name()``
- ``get_full_name()``
- ``get_gender()``
- ``get_id()``
- ``get_id_number()``
- ``get_id_type()``
- ``get_info()``
- ``get_last_name()``
- ``get_login_md5()``
- ``get_login_salt()``
- ``get_login_sha1()``
- ``get_login_sha256()``
- ``get_nat()``
- ``get_password()``
- ``get_phone()``
- ``get_picture()``
- ``get_postcode()``
- ``get_registered()``
- ``get_state()``
- ``get_street()``
- ``get_username()``
- ``get_zipcode()``
Platform: UNKNOWN
MANIFEST.in
README.rst
randomuser.py
setup.cfg
setup.py
randomuser.egg-info/PKG-INFO
randomuser.egg-info/SOURCES.txt
randomuser.egg-info/dependency_links.txt
randomuser.egg-info/not-zip-safe
randomuser.egg-info/top_level.txt
\ No newline at end of file
..\__pycache__\randomuser.cpython-37.pyc
..\randomuser.py
PKG-INFO
SOURCES.txt
dependency_links.txt
not-zip-safe
top_level.txt
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment