Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
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
- type SqlRecord = Map String SqlValue
- data SqlTable = SqlTable {}
- requestsTable :: SqlTable
- studentsTable :: SqlTable
- (!) :: Convertible SqlValue a => SqlRecord -> String -> a
- findWithDefault :: Convertible SqlValue a => a -> String -> SqlRecord -> a
- insert :: Convertible a SqlValue => String -> a -> SqlRecord -> SqlRecord
- adjust :: (Convertible SqlValue a, Convertible b SqlValue) => String -> (a -> b) -> SqlRecord -> SqlRecord
- quickQueryMap :: Connection -> String -> [SqlValue] -> IO [SqlRecord]
- tableExists :: Connection -> String -> IO Bool
- createTable :: Connection -> SqlTable -> IO ()
- dropTable :: Connection -> SqlTable -> IO ()
- insertRecord :: Connection -> SqlTable -> SqlRecord -> IO ()
- insertRecords :: Connection -> SqlTable -> [SqlRecord] -> IO ()
- commit :: IConnection conn => conn -> IO ()
- type PilotID = String
- type StudentID = String
- type TaskID = String
- type NodeID = String
- type InputID = String
- type StudentModel = Evidence
- collectSource :: Monad m => XML -> m String
- collectInputs :: Monad m => XML -> m [(InputID, XML)]
- collectIDs :: Monad m => XML -> m (StudentID, TaskID)
- collectSolution :: Monad m => XML -> m Solution
- defaultEntry :: [SqlTable] -> SqlRecord
- recordN :: Connection -> Int -> IO (Maybe SqlRecord)
- allEvidence :: Connection -> IO (Map (StudentID, TaskID) Evidence)
- allEvidenceStudents :: Connection -> IO (Map StudentID Evidence)
- allPartialModels :: Connection -> IO (Map StudentID [(TaskID, Evidence)])
- allStudentModels :: Connection -> IO [(StudentID, StudentModel)]
- allHumanAssessments :: Connection -> IO (Map (StudentID, TaskID) [(NodeID, Maybe String, Maybe String)])
- tasksDone :: Connection -> StudentID -> IO [TaskID]
- latestRecord :: Connection -> IO (Maybe SqlRecord)
- latestEvidence :: Connection -> StudentID -> IO Evidence
- latestPartialModels :: Connection -> StudentID -> IO [(TaskID, Evidence)]
- latestStudentModel :: Connection -> StudentID -> IO StudentModel
- latestStudentReport :: Connection -> String -> StudentID -> IO StudentReport
- latestInsertRowID :: Connection -> String -> IO (Maybe Int)
- records2table :: [SqlRecord] -> Map (StudentID, TaskID) Evidence
- allRecords :: Connection -> IO [SqlRecord]
- finalRecords :: Connection -> IO [SqlRecord]
- taskRecords :: Connection -> String -> IO [SqlRecord]
- studentRecords :: Connection -> String -> IO [SqlRecord]
- countStudents :: Connection -> IO Int
- countEntries :: Connection -> IO [((String, String), Int)]
- countStudentEntries :: Connection -> IO [(String, Int)]
- countTaskEntries :: Connection -> IO [(String, Int)]
Documentation
An SqlTable
collects information that will be useful in constructing SQL
statements.
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.
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.
type StudentModel = Evidence Source #
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.
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.