P4Message {Proc4} | R Documentation |
The function P4Message()
creates an object of class
"P4Message"
. The other functions access fields
of the messages.
P4Message(uid, context, sender, mess, timestamp = Sys.time(), details = list(), app = "default", processed=FALSE) m_id(x) app(x) uid(x) mess(x) context(x) sender(x) timestamp(x) details(x) ## S4 method for signature 'P4Message' toString(x,...) ## S4 method for signature 'P4Message' show(object) ## S3 method for class 'P4Message' all.equal(target, current, ..., checkTimestamp = FALSE, check_ids = TRUE)
uid |
A character object giving an identifier for the user or student. |
context |
A character object giving an identifier for the context, task, or item. |
sender |
A character object giving an identifier for the sender. In the four-process architecture, this should be one of “Activity Selection Process”, “Presentation Process”, “Evidnece Identification Process”, or “Evidence Accumulation Process”. |
mess |
A character object giving a message to be sent. |
timestamp |
The time the message was sent. |
details |
A list giving the data to be sent with the message. |
app |
An identifier for the application using the message. |
processed |
A logical flag: true if the message has been processed and false otherwise. |
x |
A message object to be queried, or converted to a string. |
... |
|
object |
A message object to be converted to a string. |
target |
A P4Message to compare. |
current |
A P4Message to compare. |
checkTimestamp |
Logical flag. If true, the timestamps are compared as part of the equality test. |
check_ids |
Logical flag. If true, the database ids are compared as part of the equality test. |
This class represents a semi-structured data object with certain
header fields which can be indexed plus the free-form details()
field which contains the body of the message. It can be serielized in
JSON format (using as.json
in the Mongo database (using the
mongolite
package).
Using the public methods, the fields can be read but not set. The
generic functions are exported so that other object can extend the
P4Message
class. The m_id
function accesses the mongo
ID of the object (the _id
field).
The function all.equal.P4Message
checks two messages for
identical contents. The flags checkTimestamp
and
check_ids
can be used to suppress the checking of those
fields. If timestamps are checked, they must be within .1 seconds to
be considered equal.
An object of class P4Message
.
The app()
, uid()
, context()
, sender()
, and
mess()
functions all return a character scalar. The
timestamp()
, function returns an object of type POSIXt
and the details()
function returns a list.
The function all.equal.P4Message
returns either ‘TRUE’ or a
vector of mode "character" describing the differences between
target
and current
.
Russell G. Almond
Almond, R. G., Steinberg, L. S., and Mislevy, R.J. (2002). Enhancing the design and delivery of Assessment Systems: A Four-Process Architecture. Journal of Technology, Learning, and Assessment, 1, http://ejournals.bc.edu/ojs/index.php/jtla/article/view/1671.
P4Message
— class
parseMessage
, saveRec
,
getOneRec
mess1 <- P4Message("Fred","Task 1","Evidence ID","Scored Response", as.POSIXct("2018-11-04 21:15:25 EST"), list(correct=TRUE,selection="D")) stopifnot( app(mess1) == "default", uid(mess1) == "Fred", context(mess1) == "Task 1", sender(mess1) == "Evidence ID", mess(mess1) == "Scored Response", timestamp(mess1) == as.POSIXct("2018-11-04 21:15:25 EST"), details(mess1)$correct==TRUE, details(mess1)$selection=="D" ) mess2 <- P4Message("Fred","Task 1","Evidence ID","Scored Response", as.POSIXct("2018-11-04 21:15:25 EST"), list(correct=FALSE,selection="E")) all.equal(mess1,mess2) stopifnot(!isTRUE(all.equal(mess1,mess2)))