20 KiB
Database
Used database schema is generated by ORM framework Doctrine from ReCodEx API source code. Tables are directly mapped to entities, which are PHP classes annotated with data provided by ORM framework. In the following text there is a brief description of each such entity. There may be some additional database tables for many-to-many relations between entities, but these tables are not discussed in detail because there are only two columns with keys of both related tables in each one. Graphical database schema is added as attachment to this documentation.
Assignment
Assignment table represents exercise assignment in a group. It holds keys of the exercise (exerciseId) and group (groupId) where is the exercise assigned. Other columns are:
- name -- visible assignment identifier
- isPublic -- assignment can be public (visible to students) or private (visible only to supervisor of the group)
- submissionCountLimit -- number of attempts student can make to solve the exercise
- scoreConfig -- configuration for calculating point score; actual syntax depends on used score calculator
- firstDeadline -- date and time after that no new submissions are received
- allowSecondDeadline, secondDeadline -- flag if another deadline is allowed, date and time of that deadline
- maxPointsBeforeFirstDeadline, maxPointsBeforeSecondDeadline -- maximal amount of points for correct solutions for first (respectively second) deadline
- scoreCalculator -- name of used score score calculator or NULL for the default one
- canViewLimitRatios -- flag if student can view percentage of used time and memory limits for each test
- deletedAt -- assignment cannot be deleted due to possible numerous dependencies, but can be hidden from the users; published assignments have NULL value, deleted ones have time of deletion
- version -- which version is the current assignment; changed on every assignment details update
- isBonus -- assignment is bonus one and its points are not counted into overall group score
- pointsPercentualThreshold -- number of points which solution has to gain to get at least some points; if solution gained fewer points then threshold, score will be zero
Comment
Comment entity holds one message published in a comment thread (standalone comments are not permitted).
- commentThread, user -- keys of thread where this comment belongs and author of the comment
- isPrivate -- flag if the comment is for author only or public
- postedAt -- date and time of comment post
- text -- content of the comment
CommentThread
CommentThread entity contains all comments in one thread by one-to-many relation. From database perspective, this table has only one column with primary key and the relation is made by foreign key column in Comment table.
Exercise
Exercise is a structure that describes a programming problem. Exercises can have a tree structure (exerciseId of parent) that can be used to implement an inheritance mechanism, but it's currently not being used.
- author -- key for user entity of the author
- name -- name of the exercise
- version -- version of the exercise; each edit increases this counter
- createdAt -- date and time of creation
- updatedAt -- date and time of last modification
- difficulty -- description of difficulty, currently used ones are easy, medium and hard
- isPublic -- flag if the exercise is publicly visible to all supervisors or only to author
- description -- description for supervisors which is not visible to students after assignment
ExerciseFile
ExerciseFile entity is extension of UploadedFile entity, so they share one database table. Exercise file has some additional data:
- hashName --
sha1sum
of file content, used as name in job configurations - fileServerPath -- URL where the file is stored on file server
- exerciseId -- key of exercise this supplementary file belongs to
ExternalLogin
ExternalLogin entity provides mapping between username in external login service and local user account.
- user -- key to local user entity
- authService -- identifier which external service is the user using
- externalId -- username in that particular external instance
ForgottenPassword
This entity is used for logging requests about password resets.
- user -- key to user who requested the password change (or NULL if not known)
- requestedAt -- date and time of password reset request
- sentTo -- email address where the reset token was sent to
- redirectUrl -- URL where the user is supposed to change his password
- IPaddress -- IP address from where the request came from (parsed from HTTP request header)
Group
Group entity contains data about a group. They can be hierarchical, reference to the parent is obtained by parentGroup key. Top level groups has this field set to NULL. Each group belongs to one instance referenced by instance key. Also, each group has its administrator user referenced by admin key. Other data:
- name -- name of the group
- description -- Markdown styled text description of the group
- threshold -- percentage of maximal points required to complete the course in float between 0 and 1 (or NULL)
- publicStats -- flag if user can view total number of points for other users in the group
- isPublic -- flag if the group is visible for all students in instance or it is hidden (only for members)
- externalId -- external identifier of the group (or NULL), for example course code like NPRG042
- deletedAt -- groups cannot be deleted due to possible numerous dependencies, but can be hidden from the users; active groups have NULL value, deleted ones have time of deletion
GroupMembership
GroupMembership represents relation between group and its members. Also it contains additional data, so this entity is not autogenerated by Doctrine. Essential parts are keys to user and group entities (user and group keys). Additional data:
- status -- user status in the group, one of requested, accepted and rejected
- type -- type of user access, one of student, supervisor and * for all
- requestedAt -- date and time the join request was received (or NULL)
- joindedAt -- date and time the request for joining was accepted (or NULL)
- rejectedAt -- date and time the request for joining was rejected (or NULL)
- studentSince -- date and time when the user became a student, usually time of registration (or NULL)
- supervisorSince -- date and time when the user became a supervisor (or NULL)
HardwareGroup
HardwareGroup entity represents used hardware groups by the backend. Currently this table has to be changed manually when a new hardware group is added, but it is possible to automate this in the future. The hardware group has only one column with data, the textual description.
HardwareGroupAvailabilityLog
This entity provides information about hardware group changes during time. System administrator should keep the data up-to-date with backend state.
- hardwareGroup -- key to HardwareGroup entity
- isAvailable -- flag if the hardware group becomes available or disabled
- loggedAt -- date and time of the change
- description -- reason for the change
Instance
Instance entity represents separation of multiple organizations using the same API server. Each group or user belong to exactly one instance. User permissions are only valid in his instance.
- admin -- key referencing administrator user entity
- name -- visible name of the instance
- description -- Markdown styled textual description
- isOpen -- flag if new user can register themselves in this instance
- isAllowed -- flag if the instance can be used or is disabled for all users
- createdAt -- date and time of instance creation
- updatedAt -- date and time of last modification
- needsLicence -- flag if this instance needs a valid license
- deletedAt -- instance cannot be directly deleted due to possibility of many dependencies, but instead it can be hidden from users by setting this field to date and time of deletion (active instances have NULL value)
Licence
Licence entity gives validity to instance. For normal usage an instance needs valid licence for proper functionality.
- instance -- instance key the licence is bound to
- isValid -- flag if this licence is valid or blocked by administrator
- validUntil -- date and time until the licence is valid (expiration time)
- note -- optional note about the licence
LocalizedText
LocalizedText entity represent text or description of the problem in one language mutation. Exercises and assignments uses these text to display problem description to users. The text can be Markdown styled.
- locale -- language code of locale this text is written in (for example en)
- text -- text content
- createdFrom -- key referring to parent localized text; when editing, new version is created as a child of the original one
- createdAt -- date and time of creation
Login
Login entity holds credentials for logging into ReCodEx system using internal authentication.
- user -- key referring to user entity
- username -- mail of the user
- passwordHash -- hashed password, generated by Nette Passwords::hash() method
Permission
Permission entity holds permissions for user roles. API endpoints can have a permission restriction assigned by annotation @UserIsAllowed(exercises="view-all") which are checked before endpoint invocation. These permission are gained to user roles in this entity.
- role -- key of the role this permission is assigned to
- resource -- resource name, usually same for all endpoints in one presenter; from the example above resource is exercises string
- action -- action, usually different for each endpoint, wildcard can be specified as *; in the example above, view-all is the action
- isAllowed -- flag if the rule is allowed of denied
ReferenceExerciseSolution
ReferenceExerciseSolution contains additional data for reference solution than normal solution created by student submit.
- exercise, solution -- keys referring to exercise this entity is bound to and solution entity used for submitting
- uploadedAt -- date and time of creation
- description -- textual description of used algorithm or other note about the particular solution
ReferenceSolutionEvaluation
ReferenceSolutionEvaluation contains additional data for reference solution evalution than normal evaluation created on student solution evaluation.
- referenceSolution -- key to solution which this evaluation belongs to
- hwGroup -- hardware group which was used during execution on worker
- resultsUrl -- fileserver address from where results of reference evaluation can be internally accessed
- evaluation -- associated general evaluation key
ReportedErrors
All errors which were reported to API from backend are sent as emails to administrator of system and also stored in this entity.
- type -- textual description of error type
- recipients -- list of comma separated email addresses to which error was sent
- subject -- subject as it was sent in email
- sentAt -- date and time when email with error report was sent
- description -- message as it was sent in email
Resource
Resource entity represent different resources used in ReCodEx system. These resources can be used in presenter actions for access restrictions. Resource contain list of permissions in one-to-many relation, but from database perspective this table has only one column with the resource name.
Role
Each ReCodEx user has exactly one role. A role is associated with multiple permissions that determine what actions can a user with that role perform on a resource.
- id -- textual identification of the role
- parentRole -- reference to parent role
- childRoles -- array of roles which have this one as parent; not actual database column, relation stored using parentRole column
- permissions -- permissions which are connected to this role; not actual database column, many-to-one relation stored in Permission entity
RuntimeConfig
RuntimeConfig entity connects job configuration to runtime environment. This entity is backed up on every update, old version is set as createdFrom key in the new version. On student submission one runtime config is chosen based on files extensions and corresponding job configuration is used for evaluation in the backend.
- name -- human readable identifier of runtime configuration
- runtimeEnvironment -- corresponding runtime environment
- jobConfigFilePath -- path to job configuration which is stored at API server
- createdAt -- date and time of entity creation
RuntimeEnvironment
Stores information about supported environments which can be used for evaluation on workers. On student submit the correct environment is determined by extensions of uploaded files.
- name -- human readable name of runtime environment
- language -- language which can be used in this environment
- extensions -- list of extensions in yaml format
- platform -- textual description of platform
- description -- some further description concerning this environment
Solution
Solution is a general entity which is used for all types of evaluations, including students and reference solutions. This entity can be shared between multiple submissions (for example resubmit by supervisor in case of backend failure).
- user -- user key to whom this solution belongs to
- files -- exercise solution files which user uploaded and are associated with solution; not actual database column, one-to-many relation is stored by each file
- runtimeConfig -- runtime configuration key which was used during execution on worker
- evaluated -- true if solution was evaluated and results were processed
SolutionEvaluation
SolutionEvaluation entity represents evaluation of student or reference solution. It contains parsed and processed data received from backend.
- evaluatedAt -- date and time of evaluation creation
- initFailed -- if true then one of the initiation tasks failed thus solution cannot be even compiled
- score -- overall score of user solution (percentual correctness from 0 to 1)
- points -- points which were assigned to user for this solution
- bonusPoints -- bonus points assigned by one of the supervisors
- isValid -- can be used to ban user solution of exercise due to various reasons
- evaluationFailed -- true if whole evaluation failed on worker
- resultYml -- whole yaml file with evaluation results acquired from backend
- testResults -- results of all tests associated with user solution; not actual database table, one-to-many relation is stored by TestResult entities
SolutionFile
SolutionFile entity is extension of UploadedFile entity, so they share one database table. Solution file has one additional column of associated solution key.
Submission
Submission entity corresponds to student submit of assignment. It stores both information about submission and about subsequent evaluation.
- submittedAt -- date and time of submission creation
- note -- user can provide note to exercise solution
- resultsUrl -- URL pointed to fileserver from which results of submission can be internally downloaded
- assignment -- corresponding assignment key to which submission belongs to
- user -- key of user to whom submission belongs to
- submittedBy -- user who submitted solution of exercise, can be supervisor for instance
- solution -- corresponding solution
- asynchronous -- exercise solution was submitted asynchronously, this happens when supervisor or superadmin submit solution for particular user
- evaluation -- evaluation of this submission
SubmissionFailure
A queue of failed submissions which need further attention from the administrator. Administrator can then resolve this issue and information about that will be stored too.
- type -- type of failure, can be for example broker_reject or evaluation_failure
- description -- description of failure which was provided by backend
- submission -- associated submission which failed
- createdAt -- date and time of entity creation
- resolvedAt -- date and time when failure was resolved
- resolutionNote -- user can provide description when failure is resolved
TaskResult
Represents result of one task from particular job execution and has to belong to TestResult entity through testResultId column.
- taskName -- identification of task which is connected with this result
- usedTime -- used execution time needed for this task evaluation
- usedMemory -- used memory needed for this task evaluation
TestResult
TestResult entity represents result of one logical test from job configuration.
- testName -- name of test which was stated in job configuration
- status -- overall status of test
- solutionEvaluation -- evaluation to which test result belongs
- score -- score which was assigned to test evaluation by judge
- memoryExceeded -- true if memory limit was exceeded
- usedMemoryRatio -- float number from 0 to 1 which represents percentage of user solution memory usage against memory limit from configuration
- timeExceeded -- true if time limit was exceeded
- usedTimeRatio -- float number from 0 to 1 which represents percentage of user solution time usage against time limit from configuration
- exitCode -- exit code which whole test returns
- message -- provided only on non-zero exit code
- stats -- textual representation of whole information about evaluation of test which arrived from worker
- judgeOutput -- output textual message from judge
UploadedFile
Entity which represents one file which was uploaded to API server. This entity uses Single Table Inheritance and its children are ExerciseFile and SolutionFile entities.
- name -- original name of file uploaded to API
- localFilePath -- destination where file is stored on API server
- uploadedAt -- date and time of file upload
- fileSize -- size of uploaded file in bytes
- user -- user which uploaded particular file
User
Keeps information about all users registered in ReCodEx.
- degreesBeforeName -- degrees before name which user acquired
- firstName -- first name
- lastName -- surname
- degreesAfterName -- degrees after name
- email -- email address which is used for sending email notifications
- avatarUrl -- url of profile picture
- isVerified -- user verified his email address (not used at the moment)
- isAllowed -- if this field is set to false user cannot sign in to application
- createdAt -- date and time of user registration
- instance -- instance to which user belongs to
- settings -- settings which are connected to this user
- memberships -- array of groups in which is user assigned
- exercises -- exercises which user created and is their author
- role -- role of the user which is used to determine privileges
UserAction
Stores information about what routes on API user visited and some additional information about it. This data is collected only from logged users.
- user -- which user performed API request
- loggedAt -- date and time when action was performed
- action -- action which was requested on API
- params -- GET or POST parameters given by user
- code -- return code which was sent back by API
- data -- if call ended up with an exception, description of thrown exception should be there
UserSettings
User settings belong to some user and contains settings mostly for web application.
- darkTheme -- dark mode will be used in text editor in web application
- vimMode -- turn vim mode keybinding on in text editor used by web application
- defaultLanguage -- default language which will be used in web application
- openedSidebar -- left sidebar will be opened after login