Skip to content

Commit b9eacbf

Browse files
authored
Merge pull request #1 from ralmond/NoMongo
No mongo, Mongo pulled out of test suite, too.
2 parents ddb1656 + df357d2 commit b9eacbf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4731
-156
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*~
2+
#*#
3+
.#*
4+
5+
#EAEngineMongo.R#
6+
.Rhistory

ChangeLog

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,109 @@
1+
2020-04-03 Russell Almond <ralmond@Cherry>
2+
3+
* R/EAEngine.R (BNEngine): Removed netDirectory field as this
4+
properly belongs in PnetWarehouse.
5+
6+
2020-04-01 Russell Almond <ralmond@Cherry>
7+
8+
* R/StudentRec.R (newSR): Added warning when replacing a student model.
9+
(getSR): Added code to generate ID in the NDB case.
10+
11+
2020-03-31 Russell Almond <ralmond@Cherry>
12+
13+
* R/StudentRec.R (getSR): Changed this protocol so it returns null
14+
if the record does not exist. This way we can test for existance
15+
if necessary.
16+
(saveSR): Added function to set the _id in no database version.
17+
18+
19+
* R/EngineGears.R (getRecordForUser): Moved building new record if
20+
null functionality to here.
21+
22+
23+
* R/StudentRec.R (saveSR): Make sure this always returns the recrod.
24+
25+
2020-03-30 Russell Almond <ralmond@Cherry>
26+
27+
* R/EngineGears.R (accumulateEvidence): Changed to use the
28+
updateRecord function.
29+
30+
* R/StudentRec.R (updeateRecord): Added this function, as it
31+
seemed like burrying it in accumulateEvdience was a bad idea.
32+
33+
* R/EAEngine.R (fetchNextEvidence, markEvidence): Added this as a formal
34+
function, so we could document it more clearly.
35+
36+
2020-03-29 Russell Almond <ralmond@Cherry>
37+
38+
* R/EngineGears.R (updateSM): Modified so that it checks both name
39+
and title.
40+
41+
2020-03-25 Russell Almond <ralmond@Cherry>
42+
43+
* R/EngineGears.R (loadManifest): Need to assign to
44+
eng$warehouseObj, not eng$warehouse() as latter does not have
45+
assignment method.
46+
47+
* R/EAEngine.R: (eng$setManifest) Killed call to warehouse() in
48+
setManifest method, again, circular loading pattern.
49+
50+
* R/EngineGears.R (loadManifest): Added test for zero row manifest
51+
to avoid circular loading.
52+
53+
2020-03-21 Russell Almond <ralmond@Cherry>
54+
55+
* R/EAEngineNDB.R (BNEngineNDB): Changed listeners to listenerSet.
56+
57+
* R/EAEngineMongo.R (BNEngineMongo): Changed listeners to
58+
listenerSet.
59+
60+
* R/EAEngine.R: Changed protocol so that ListenerSet is created
61+
before engine. This allows more flexibility in configurion
62+
(with/without database).
63+
64+
2020-03-15 Russell Almond <ralmond@Cherry>
65+
66+
* R/StudentRec.R (StudentRecordSet$recorddb): Make sure that "" is
67+
intepreted as no database.
68+
69+
2020-03-02 Russell Almond <ralmond@Cherry>
70+
71+
* R/StudentRec.R (unparseHist, parseHist): killing these functions
72+
as they are not being used.
73+
(unparseStats, stats2json, parseStats): Added flattening features
74+
which allows for either nested, or unested JSON.
75+
(strsplit2, unflattenNames): Auxiliary functions used in
76+
flattening and unflattening stat lists.
77+
78+
2020-03-01 Russell Almond <ralmond@Cherry>
79+
80+
* R/StudentRec.R (parseStudentRecord): Addes some as.characters to
81+
get rid of excessive listiness.
82+
83+
2020-02-19 Russell Almond <ralmond@Cherry>
84+
85+
* R/StudentRec.R (parseStudentRecord, as.jlist): History list is
86+
delicate, need to protect with serialization.
87+
88+
* R/EngineGears.R (configStats): saveStats is an R6 method of
89+
eng. This needs to be moved onto the working branch.
90+
91+
92+
2020-02-15 Russell Almond <ralmond@Cherry>
93+
94+
* R/EngineGears.R: Regular functions and S4 generics and methods
95+
moved to this file.
96+
97+
* R/EAEngineNDB.R (BNEngineNDB): No database version of the EA
98+
engine.
99+
100+
* R/EAEngineMongo.R (BNMongoEngine): Split off Mongo-dependent
101+
pieces.
102+
103+
* R/EAEngine.R (BNEngine): Split the main engine up into a core
104+
engine and the peices that use Mongo, and a Mongo-free piece for
105+
the DataArcade link.
106+
1107
2018-08-14 Rusell Almond <ralmond@Cherry>
2108

3109
* DESCRIPTION (Depends): Renamed package EABN, as this version is

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Package: EABN
2-
Version: 0.5-1
3-
Date: 2019/11/28
2+
Version: 0.5-2
3+
Date: 2020/02/15
44
Title: Evidence Accumulation Bayes Net Engine
55
Author: Russell Almond
66
Maintainer: Russell Almond <ralmond@fsu.edu>
77
Depends: R (>= 3.0), methods, mongolite, jsonlite, Peanut (>= 0.8), Proc4 (>= 0.3), futile.logger
88
Description: Extracts observables from a sequence of events.
99
License: Artistic-2.0
1010
URL: http://pluto.coe.fsu.edu/Proc4
11-
Collate: Evidence.R StudentRec.R EAEngine.R EAEngineMongo.R EngineGears.R
11+
Collate: Evidence.R StudentRec.R EAEngine.R EAEngineMongo.R EAEngineNDB.R EngineGears.R

NAMESPACE

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import(futile.logger)
77
importFrom("mongolite","mongo")
88
importFrom("jsonlite", "toJSON", "fromJSON","base64_enc","base64_dec")
99

10-
export(StudentRecord, sm, stats, evidence, "evidence<-",
10+
export(StudentRecord, sm, "sm<-", stats, evidence, "evidence<-",
1111
statNames, histNames, stat,
12-
history, parseStudentRecord,parseStats,stats2json,unparseStats,
13-
fetchSM, unpackSM, markEvidence, getSR, saveSR, newSR,
14-
parseHist, unparseHist)
15-
exportClasses(StudentRecord)
12+
history, parseStudentRecord, parseStats, stats2json, unparseStats,
13+
fetchSM, unpackSM, updateRecord,
14+
StudentRecordSet, getSR, saveSR, newSR, clearSRs)
15+
exportClasses(StudentRecord,StudentRecordSet)
1616
exportMethods(evidence, "evidence<-",
1717
sm, stats, app, uid, context, timestamp, mess,
1818
as.jlist, toString, show, statNames, histNames, stat,
@@ -22,15 +22,15 @@ export(EvidenceSet, parseEvidence, seqno, "seqno<-", observables)
2222
exportClasses(EvidenceSet)
2323
exportMethods(seqno, "seqno<-")
2424

25-
exportClass(BNMongoEngine)
26-
export(BNMongoEngine, loadManifest, setupDefaultSR,
25+
exportClass(BNEngine,BNEngineMongo)
26+
export(BNEngine,BNEngineMongo, loadManifest, setupDefaultSR,
2727
logEvidence, accumulateEvidence, configStats, updateStats,
2828
announceStats, baselineHist, updateHist, getRecordForUser,
29-
handleEvidence, mainLoop, updateSM)
30-
exportMethods(notifyListeners)
29+
handleEvidence, mainLoop, updateSM, fetchNextEvidence, markProcessed)
30+
exportMethods(notifyListeners,fetchNextEvidence,markProcessed)
3131

32-
exportClass(BNSQLEngine)
33-
export(BNSQLEngine)
32+
exportClass(BNEngineNDB)
33+
export(BNEngineNDB)
3434

3535

3636

R/EAEngine.R

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
setClassUnion("NullRecordSet",c("StudentRecordSet","NULL"))
2+
setClassUnion("NullListenerSet",c("ListenerSet","NULL"))
23

34

45
BNEngine <-
56
setRefClass("BNEngine",
67
c(
78
app = "character",
8-
session="Psession",
99
srs = "NullRecordSet",
1010
profModel = "character",
11-
listenerSet="ListenerSet",
11+
listenerSet="NullListenerSet",
1212
statistics="list",
1313
histNodes="character",
1414
warehouseObj="PnetWarehouse",
@@ -24,7 +24,7 @@ BNEngine <-
2424
fetchStats = function() {
2525
stop("Abstract method.")
2626
},
27-
saveStats = function(statmat) {
27+
saveStats = function(stats) {
2828
stop("Abstract method.")
2929
},
3030
evidenceSets = function() {
@@ -33,9 +33,11 @@ BNEngine <-
3333
setProcessed= function (mess) {
3434
mess@processed <- TRUE
3535
saveRec(mess,evidenceSets())
36+
mess
3637
},
3738
setError= function (mess,e) {
3839
markAsError(mess,evidenceSets(),e)
40+
mess
3941
},
4042
fetchNextEvidence = function() {
4143
stop("Abstract Method")
@@ -59,13 +61,15 @@ BNEngine <-
5961
warehouseObj
6062
},
6163
setManifest = function(manifest) {
62-
warehouse() # Initialize Warehouse
63-
WarehouseManifest(warehouseObj) <<- manifest
64+
if (nrow(manifest) > 0L) {
65+
## warehouse() # Warehouse is now pre-installed.
66+
WarehouseManifest(warehouseObj) <<- manifest
67+
}
6468
},
6569
fetchManifest = function() {
6670
stop("Abstract method.")
6771
},
68-
saveManifest = function(manifest) {
72+
saveManifest = function(manif) {
6973
stop("Abstract method.")
7074
},
7175
isActivated = function() {
@@ -83,10 +87,8 @@ BNEngine <-
8387
## key="Name")
8488

8589

86-
BNEngine <- function(app="default",warehouse,listeners=list(),
87-
username="",password="",host="localhost",
88-
port="",dbname="EARecords",processN=Inf,
89-
P4dbname="Proc4", waittime=.25, profModel=character(),
90+
BNEngine <- function(app="default",session,listenerSet=NULL,
91+
waittime=.25, profModel=character(),
9092
...) {
9193
stop("BNEngine now abstract, use BNMongoEngine or BNSQLEngine.")
9294
}
@@ -97,9 +99,19 @@ setMethod("app","BNEngine",function (x) x$app)
9799
## Listener notification.
98100
setMethod("notifyListeners","BNEngine",
99101
function(sender,mess) {
100-
sender$listenerSet$notifyListeners(mess)
102+
if (!is.null(sender$listenerSet))
103+
sender$listenerSet$notifyListeners(mess)
101104
})
102105

106+
setGeneric("fetchNextEvidence",
107+
function (eng) standardGeneric("fetchNextEvidence"))
108+
setMethod("fetchNextEvidence","BNEngine",
109+
function(eng) eng$fetchNextEvidence())
110+
111+
setGeneric("markProcessed",
112+
function(eng,eve) standardGeneric("markProcessed"))
113+
setMethod("markProcessed","BNEngine",
114+
function(eng,eve) eng$setProcessed(eve))
103115

104116

105117

0 commit comments

Comments
 (0)