Advise-me-0.1: Assessment services for the Advise-Me project

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell98

Database.Data

Contents

Description

Access to the request database. This module provides transparent access to the information stored in the database, and ensures that it is read in a sensible way.

Synopsis

Documentation

type SqlRecord = Map String SqlValue Source #

SQL records are read into a map.

data SqlTable Source #

An SqlTable collects information that will be useful in constructing SQL statements.

Constructors

SqlTable 

Fields

(!) :: Convertible SqlValue a => SqlRecord -> String -> a Source #

Obtain the value of a record at a certain column. Differs from ! in that the value will be converted from an SqlValue.

findWithDefault :: Convertible SqlValue a => a -> String -> SqlRecord -> a Source #

Obtain the value of a record at a certain column, with a given default. Differs from findWithDefault in that the value will be converted from an SqlValue.

insert :: Convertible a SqlValue => String -> a -> SqlRecord -> SqlRecord Source #

Insert a value of a record into a certain column.

adjust :: (Convertible SqlValue a, Convertible b SqlValue) => String -> (a -> b) -> SqlRecord -> SqlRecord Source #

Update the value of a record at a certain column.

quickQueryMap :: Connection -> String -> [SqlValue] -> IO [SqlRecord] Source #

Like quickQuery, but obtains SqlRecords instead of lists.

tableExists :: Connection -> String -> IO Bool Source #

Test if the given table exists.

createTable :: Connection -> SqlTable -> IO () Source #

Create the given table if it does not already exist.

dropTable :: Connection -> SqlTable -> IO () Source #

Drop the given table unless it does not exist.

insertRecord :: Connection -> SqlTable -> SqlRecord -> IO () Source #

Insert the given record into a table. Assumes that the record contains at least all the columns of the table.

insertRecords :: Connection -> SqlTable -> [SqlRecord] -> IO () Source #

Insert the given records into a table. Assumes that the record contains at least all the columns of the table.

commit :: IConnection conn => conn -> IO () #

Commit any pending data to the database.

Required to make any changes take effect.

collectSource :: Monad m => XML -> m String Source #

Extract the source from an XML request element.

collectInputs :: Monad m => XML -> m [(InputID, XML)] Source #

Extract the input elements from an XML request element.

collectIDs :: Monad m => XML -> m (StudentID, TaskID) Source #

Extract the student and task ID from an XML request element.

defaultEntry :: [SqlTable] -> SqlRecord Source #

Make a default entry, where all columns are set to null.

recordN :: Connection -> Int -> IO (Maybe SqlRecord) Source #

Obtain the record at a certain row.

allEvidence :: Connection -> IO (Map (StudentID, TaskID) Evidence) Source #

Get the evidence for every student/task pair.

allEvidenceStudents :: Connection -> IO (Map StudentID Evidence) Source #

Get the evidence for every student.

allPartialModels :: Connection -> IO (Map StudentID [(TaskID, Evidence)]) Source #

Get the most recent partial models for every task, for every student.

allStudentModels :: Connection -> IO [(StudentID, StudentModel)] Source #

Get the most recent student model for every student.

allHumanAssessments :: Connection -> IO (Map (StudentID, TaskID) [(NodeID, Maybe String, Maybe String)]) Source #

Get all human assessments, if any exist in the database

tasksDone :: Connection -> StudentID -> IO [TaskID] Source #

Get all Tasks a student has finished and all Tasks they have yet to finish.

latestRecord :: Connection -> IO (Maybe SqlRecord) Source #

Get the latest record added to the database.

latestEvidence :: Connection -> StudentID -> IO Evidence Source #

Get all evidence collected for a particular student.

latestPartialModels :: Connection -> StudentID -> IO [(TaskID, Evidence)] Source #

Get all partial (calculated!) evidence models for a particular student.

latestStudentModel :: Connection -> StudentID -> IO StudentModel Source #

Get most recent student model for a particular student.

latestStudentReport :: Connection -> String -> StudentID -> IO StudentReport Source #

Get student report for a particular student.

latestInsertRowID :: Connection -> String -> IO (Maybe Int) Source #

Obtain latest row insertion ID of a particular table.

records2table :: [SqlRecord] -> Map (StudentID, TaskID) Evidence Source #

Turn records into a table of evidence.

allRecords :: Connection -> IO [SqlRecord] Source #

Obtain all records from the requests table, optionally combined with the students table, if the latter is present.

finalRecords :: Connection -> IO [SqlRecord] Source #

Obtain the final entry for every student.

taskRecords :: Connection -> String -> IO [SqlRecord] Source #

Obtain all entries associated with a particular task.

studentRecords :: Connection -> String -> IO [SqlRecord] Source #

Obtain all entries associated with a particular student.

countStudents :: Connection -> IO Int Source #

Obtain the total number of students.

countEntries :: Connection -> IO [((String, String), Int)] Source #

Obtain the number of entries for each student/task pair. Should be 0 or 1...

countStudentEntries :: Connection -> IO [(String, Int)] Source #

Obtain the number of requests for each student.

countTaskEntries :: Connection -> IO [(String, Int)] Source #

Obtain the number of requests for each task.

Orphan instances