Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Feb 16, 2017
2 parents b6e2dbf + 5e58cbb commit 940e688
Show file tree
Hide file tree
Showing 37 changed files with 2,294 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ harness/var/goleveldb_data/LOCK

harness/var/goleveldb_data/LOG


*.zip
94 changes: 94 additions & 0 deletions app/naprr/naprr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package main

import (
"flag"
"github.com/nats-io/nats-streaming-server/server"
"github.com/nsip/nias2/naprr"
"log"
"net"
"os"
// "os/exec"
// "os/signal"
// "runtime"
// "time"
)

var rewrite = flag.Bool("rewrite", false, "rewrite regenerates all reports without re-loading data")

func main() {

flag.Parse()

wd, _ := os.Getwd()
log.Println("working directory:", wd)

if !*rewrite {
log.Println("removing old files...")
clearNSSWorkingDirectory()
}

log.Println("Launching stream server...")
ss := launchNatsStreamingServer()
defer ss.Shutdown()

if !*rewrite {
log.Println("Starting data ingest...")

di := naprr.NewDataIngest()
di.Run()

log.Println("Generating report data...")
rb := naprr.NewReportBuilder()
rb.Run()
}

log.Println("Writing report files...")
rw := naprr.NewReportWriter()
rw.Run()

log.Println("Done.")

// runtime.Goexit()
}

func clearNSSWorkingDirectory() {

// remove existing logs and recreate the directory
err := os.RemoveAll("nss")
err = os.Mkdir("nss", os.ModePerm)
if err != nil {
log.Println("Error trying to remove nss working directory")
}
}

func launchNatsStreamingServer() *server.StanServer {

stanOpts := server.GetDefaultOptions()

stanOpts.ID = "nap-rr"
stanOpts.MaxChannels = 30000
stanOpts.MaxMsgs = 2000000
stanOpts.MaxBytes = 0 //unlimited
stanOpts.MaxSubscriptions = 10000

stanOpts.StoreType = "FILE"
stanOpts.FilestoreDir = "nss"
// stanOpts.Debug = true

ss := server.RunServerWithOpts(stanOpts, nil)

return ss

}

// getAvailPort asks the OS for an unused port.
// There's a race here, where the port could be grabbed by someone else
// before the caller gets to Listen on it, but in practice such races
// are rare. Uses net.Listen("tcp", ":0") to determine a free port, then
// releases it back to the OS with Listener.Close().
func getAvailPort() int {
l, _ := net.Listen("tcp", ":0")
r := l.Addr()
l.Close()
return r.(*net.TCPAddr).Port
}
20 changes: 20 additions & 0 deletions app/naprr/templates/codeframe_hdr.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- "Test Name"}},
{{- "Test Type"}},
{{- "Test Level"}},
{{- "Domain"}},
{{- "Item ID"}},
{{- "Item Subdomain"}},
{{- "Item Max. Score"}},
{{- "Item Correct Ans."}},
{{- "Item Descriptor"}},
{{- "Item Examplar Link"}},
{{- "Item Difficulty"}},
{{- "Item Type"}},
{{- "Item Weight"}},
{{- "Item Marking Type"}},
{{- "Item loc. in Testlet"}},
{{- "Testlet Node"}},
{{- "Testlet loc. in Test"}},
{{- "Testlet Name"}},
{{- "Testlet ID"}},
{{- "Testlet Max. Score"}}
20 changes: 20 additions & 0 deletions app/naprr/templates/codeframe_row.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{ printf "\"%s\"" .Test.TestContent.TestName}},
{{- .Test.TestContent.TestType}},
{{- .Test.TestContent.TestLevel}},
{{- .Test.TestContent.TestDomain}},
{{- .Item.TestItemContent.NAPTestItemLocalId}},
{{- .Item.TestItemContent.Subdomain}},
{{- .Item.TestItemContent.MaximumScore}},
{{- .Item.TestItemContent.CorrectAnswer}},
{{- .Item.TestItemContent.ItemDescriptor}},
{{- .Item.TestItemContent.ExemplarURL}},
{{- .Item.TestItemContent.ItemDifficulty}},
{{- .Item.TestItemContent.ItemType}},
{{- "Item Weight"}},
{{- .Item.TestItemContent.MarkingType}},
{{- .GetItemLocationInTestlet .Item.ItemID}},
{{- .Testlet.TestletContent.Node}},
{{- .Testlet.TestletContent.LocationInStage}},
{{- .Testlet.TestletContent.TestletName}},
{{- .Testlet.TestletContent.LocalId}},
{{- .Testlet.TestletContent.TestletMaximumScore}}
45 changes: 45 additions & 0 deletions app/naprr/templates/codeframe_writing_hdr.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{- "Test Name"}},
{{- "Test Type"}},
{{- "Test Level"}},
{{- "Domain"}},
{{- "Item ID"}},
{{- "Item Subdomain"}},
{{- "Item Max. Score"}},
{{- "Item Correct Ans."}},
{{- "Item Descriptor"}},
{{- "Item Examplar Link"}},
{{- "Item Difficulty"}},
{{- "Item Type"}},
{{- "Item Weight"}},
{{- "Item Marking Type"}},
{{- "Item loc. in Testlet"}},
{{- "Testlet Node"}},
{{- "Testlet loc. in Test"}},
{{- "Testlet Name"}},
{{- "Testlet ID"}},
{{- "Testlet Max. Score"}},
{{- "Genre"}},
{{- "Stimulus"}},
{{- "Descriptor"}},
{{- "Audience Descriptor"}},
{{- "Audience Max"}},
{{- "Ch./Sett. Descriptor"}},
{{- "Ch./Sett. Max"}},
{{- "Cohesion Descriptor"}},
{{- "Cohesion Max"}},
{{- "Ideas Descriptor"}},
{{- "Ideas Max"}},
{{- "Para. Descriptor"}},
{{- "Para. Max"}},
{{- "Persuasive Devices Descriptor"}},
{{- "Persuasive Devices Max"}},
{{- "Punctuation Descriptor"}},
{{- "Punctuation Max"}},
{{- "Sentence Structure Descriptor"}},
{{- "Sentence Structure Max"}},
{{- "Spelling Descriptor"}},
{{- "Spelling Max"}},
{{- "Text Structure Descriptor"}},
{{- "Text Structure Max"}},
{{- "Vocabulary Descriptor"}},
{{- "Vocabulary Max"}}
45 changes: 45 additions & 0 deletions app/naprr/templates/codeframe_writing_row.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ printf "\"%s\"" .Test.TestContent.TestName}},
{{- .Test.TestContent.TestType}},
{{- .Test.TestContent.TestLevel}},
{{- .Test.TestContent.TestDomain}},
{{- .Item.TestItemContent.NAPTestItemLocalId}},
{{- .Item.TestItemContent.Subdomain}},
{{- .Item.TestItemContent.MaximumScore}},
{{- .Item.TestItemContent.CorrectAnswer}},
{{- .Item.TestItemContent.ItemDescriptor}},
{{- .Item.TestItemContent.ExemplarURL}},
{{- .Item.TestItemContent.ItemDifficulty}},
{{- .Item.TestItemContent.ItemType}},
{{- "Item Weight"}},
{{- .Item.TestItemContent.MarkingType}},
{{- .GetItemLocationInTestlet .Item.ItemID}},
{{- .Testlet.TestletContent.Node}},
{{- .Testlet.TestletContent.LocationInStage}},
{{- .Testlet.TestletContent.TestletName}},
{{- .Testlet.TestletContent.LocalId}},
{{- .Testlet.TestletContent.TestletMaximumScore}},
{{- .Item.TestItemContent.WritingGenre}},
{{- "Writing Stimulus"}},
{{- "Text Descriptor"}},
{{- .GetWritingRubricDescriptor "Audience"}},
{{- .GetWritingRubricMax "Audience"}},
{{- .GetWritingRubricDescriptor "Character and Setting"}},
{{- .GetWritingRubricMax "Character and Setting"}},
{{- .GetWritingRubricDescriptor "Cohesion"}},
{{- .GetWritingRubricMax "Cohesion"}},
{{- .GetWritingRubricDescriptor "Ideas"}},
{{- .GetWritingRubricMax "Ideas"}},
{{- .GetWritingRubricDescriptor "Paragraphing"}},
{{- .GetWritingRubricMax "Paragraphing"}},
{{- .GetWritingRubricDescriptor "Persuasive Devices"}},
{{- .GetWritingRubricMax "Persuasive Devices"}},
{{- .GetWritingRubricDescriptor "Punctuation"}},
{{- .GetWritingRubricMax "Punctuation"}},
{{- .GetWritingRubricDescriptor "Sentence Structure"}},
{{- .GetWritingRubricMax "Sentence Structure"}},
{{- .GetWritingRubricDescriptor "Spelling"}},
{{- .GetWritingRubricMax "Spelling"}},
{{- .GetWritingRubricDescriptor "Text Structure"}},
{{- .GetWritingRubricMax "Text Structure"}},
{{- .GetWritingRubricDescriptor "Vocabulary"}},
{{- .GetWritingRubricMax "Vocabulary"}}
7 changes: 7 additions & 0 deletions app/naprr/templates/domainscore_hdr.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- "Test Name"}},
{{- "PSI"}},
{{- "Scaled Score Value"}},
{{- "Raw Score"}},
{{- "Scaled Score Stnadard Error"}},
{{- "Student Domain Band"}},
{{- "Student Proficiency"}}
7 changes: 7 additions & 0 deletions app/naprr/templates/domainscore_row.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ printf "\"%s\"" .Test.TestContent.TestName}},
{{- .Response.PSI}},
{{- .Response.DomainScore.ScaledScoreValue}},
{{- .Response.DomainScore.RawScore}},
{{- .Response.DomainScore.ScaledScoreStandardError}},
{{- .Response.DomainScore.StudentDomainBand}},
{{- .Response.DomainScore.StudentProficiency}}
25 changes: 25 additions & 0 deletions app/naprr/templates/participation_hdr.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- "DOB"}},
{{- "Sex"}},
{{- "Ind. Status"}},
{{- "LBOTE"}},
{{- "YearLevel"}},
{{- "ASL School ID"}},
{{- "HomeSchooled"}},
{{- "Parent1 School Education"}},
{{- "Parent1 NonSchool Education"}},
{{- "Parent 1 Occupation"}},
{{- "Parent2 School Education"}},
{{- "Parent2 NonSchool Education"}},
{{- "Parent2Occupation"}},
{{- "PlatformID"}},
{{- "School Name"}},
{{- "School Postcode"}},
{{- "School State"}},
{{- "School Suburb"}},
{{- "School Geolocation"}},
{{- "SchoolSector"}},
{{- "Writing"}},
{{- "Reading"}},
{{- "Spelling"}},
{{- "Grammar and Punctuation"}},
{{- "Numeracy"}}
27 changes: 27 additions & 0 deletions app/naprr/templates/participation_row.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{ .Student.BirthDate}},
{{- .Student.Sex}},
{{- .Student.IndigenousStatus}},
{{- .Student.LBOTE}},
{{- .Student.YearLevel}},
{{- .Student.ASLSchoolId}},
{{- .Student.HomeSchooledStudent}},
{{- .Student.Parent1SchoolEducation}},
{{- .Student.Parent1NonSchoolEducation}},
{{- .Student.Parent1Occupation}},
{{- .Student.Parent2SchoolEducation}},
{{- .Student.Parent2NonSchoolEducation}},
{{- .Student.Parent2Occupation}},
{{- .Student.GetOtherId "NAPPlatformStudentId"}},
{{- printf "\"%s\"" .School.SchoolName}},
{{- with $sci := index .School.SchoolContactList.SchoolContact 0 }}
{{- $sci.ContactInfo.Address.PostalCode}},
{{- $sci.ContactInfo.Address.StateProvince}},
{{- $sci.ContactInfo.Address.City}},
{{- end}}
{{- .School.SchoolGeographicLocation}},
{{- .School.SchoolSector}},
{{- index .Summary "Writing"}},
{{- index .Summary "Reading"}},
{{- index .Summary "Spelling"}},
{{- index .Summary "Grammar and Punctuation"}},
{{- index .Summary "Numeracy"}}
7 changes: 7 additions & 0 deletions app/naprr/templates/score_summary_hdr.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- "Test Name"}},
{{- "ASL School ID"}},
{{- "Domain National Average"}},
{{- "Domain School Average"}},
{{- "Domain Jurisdiction Average"}},
{{- "Domain Top National 60%"}},
{{- "Domain Bottom National 60%"}}
7 changes: 7 additions & 0 deletions app/naprr/templates/score_summary_row.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ printf "\"%s\"" .Test.TestContent.TestName}},
{{- .Summ.SchoolACARAId}},
{{- .Summ.DomainNationalAverage}},
{{- .Summ.DomainSchoolAverage}},
{{- .Summ.DomainJurisdictionAverage}},
{{- .Summ.DomainTopNational60Percent}},
{{- .Summ.DomainBottomNational60Percent}}
1 change: 0 additions & 1 deletion app/napval/napval.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package main

import (
"github.com/nsip/nias2/lib"
"github.com/nsip/nias2/napval"
"log"
"runtime"
Expand Down
Loading

0 comments on commit 940e688

Please sign in to comment.