From 38425c00a6b887b0cd8cde20f591a10ef508af3e Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Thu, 27 Apr 2017 15:34:57 +1000 Subject: [PATCH] Output of Yr3W status to text file --- README.md | 4 ++++ naprr/README.md | 17 ++++++++++++++++- naprr/streamreader.go | 29 ++++++++++++++++++++++++----- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5254a28..80a5208 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ In Windows, `gonias.bat` launches the required processes for an examination year The web interface to the validator can be accessed at `http://localhost:1325` by default; you can configure the Web Server Port in `nias.toml` +## Running NAPlan Results & Reporting modules + +Separate executables are run to process NAPLAN Results and Reporting processing; see [NAPRR readme](./naprr/README.md) + # Code Structure NIAS2 relies on the following infrastructure: diff --git a/naprr/README.md b/naprr/README.md index 57227d9..6f83711 100644 --- a/naprr/README.md +++ b/naprr/README.md @@ -1,4 +1,8 @@ -The naprr executable runs as a single binary, and launches its own streaming server instance within the application. +# NAPLAN Result and Reporting code + +## NAPLAN Results and Reporting processing + +The `naprr` executable runs as a single binary, and launches its own streaming server instance within the application. The unzipped binary files should have the `naprr` executable, an `/in` directory and a `/templates` directory. The `/templates` directory contains templates for the various report formats, in [Golang's template language](https://golang.org/pkg/text/template/). The `/in` directory contains zipped XML files to be processed by the `naprr` executable; the zip distribution comes packaged with `/in/master_nap.xml.zip` as a test xml results file. This will get processed automatically when the executable is run. @@ -22,3 +26,14 @@ All reports have been generated as requested, except for `codeframe_writing.csv` To test the reporting engine only, as opposed to data parsing, delete the `/out` directory then run the `naprr` executable with the flag `-rewrite`. This will simply regenerate the reports without reloading the data. Report formats are all governed by templates so they can be modified, but will be better once a UI is in place. + +## NAPLAN Year 3 Writing preprocessing code + +The `napyr3w` executable runs as a single binary. It processes both Pearson format and FujiXerox format files for Year 3 Writing results, and converts them into SIF/XML files consistent with those received from the NAPLAN Online Assessment Platform. + +* Any Pearson format files are expected to be in the `in/Pearson` directory, as fixed format txt files. +* Any FujiXerox format files are expected to be in the `in/FujiXerox` directory, as csv format files. +* The program generates a report of which students are matched between the Pearson or FujiXerox files, and any XML files received from the platform. For that reason, the `/in` directory is still expected to contain a zipped XML file of results. + +* The SIF/XML output is generated to the file `yr3w/codeframe_writing.xml`. This includes a dummy Year 3 Writing codeframe, to which test results are attached. +* A report of matches and mismatches between the students in the Pearson/FujiXerox files and the SIF/XML results file is generated to the file `yr3w/codeframe_report.txt`. diff --git a/naprr/streamreader.go b/naprr/streamreader.go index 7bf7156..c5dbc57 100644 --- a/naprr/streamreader.go +++ b/naprr/streamreader.go @@ -8,10 +8,12 @@ package naprr import ( "encoding/gob" + "fmt" "github.com/nats-io/go-nats-streaming" "github.com/nsip/nias2/lib" "github.com/nsip/nias2/xml" "log" + "os" ) type StreamReader struct { @@ -489,11 +491,28 @@ func (sr *StreamReader) remapStudents(srd *StudentAndResultsData, student_ids ma yr3wmatches.Matches = append(yr3wmatches.Matches, k) } log.Printf("%v\n", yr3wmatches) - payload, err := sr.ge.Encode(yr3wmatches) - if err != nil { - log.Println("unable to encode yr 3 writing status report: ", err) - } - sr.sc.Publish(REPORTS_YR3W_STATUS, payload) + /* + payload, err := sr.ge.Encode(yr3wmatches) + if err != nil { + log.Println("unable to encode yr 3 writing status report: ", err) + } + */ + //sr.sc.Publish(REPORTS_YR3W_STATUS, payload) + // create directory for the school + fpath := "yr3w/" + err := os.MkdirAll(fpath, os.ModePerm) + check(err) + + // create the report data file in the output directory + // delete any ecisting files and create empty new one + fname := fpath + "codeframe_report.txt" + err = os.RemoveAll(fname) + f, err := os.Create(fname) + check(err) + defer f.Close() + payload := fmt.Sprintf("Matches: %v\nYr3W only: %v\nXML only: %v\n", + yr3wmatches.Matches, yr3wmatches.Yr3w_mismatches, yr3wmatches.Xml_mismatches) + f.WriteString(payload) srd.Students = newStudents return srd