diff --git a/app/naprrql/gql_schemas/naplan_schema.graphql b/app/naprrql/gql_schemas/naplan_schema.graphql index e7562c1..4fe28b5 100644 --- a/app/naprrql/gql_schemas/naplan_schema.graphql +++ b/app/naprrql/gql_schemas/naplan_schema.graphql @@ -69,6 +69,12 @@ type NaplanData { guid_check_report: [GuidCheckDataSet] ## report on test items, testlets, tests extraneous to codeframe codeframe_check_report: [CodeframeCheckDataSet] + ## Request student summaries for the given school and year level of tests + #isrReportItems(schoolAcaraID: String!, testYrLevel: String!): [ISRPrintItem] + isrReportItems(acaraIDs: [String]): [ISRPrintItem] + ## Request student summaries for the given school and year level of tests, with full student details + #isrReportItemsExpanded(schoolAcaraID: String!, testYrLevel: String!): [ISRPrintItemExpanded] + isrReportItemsExpanded(acaraIDs: [String]): [ISRPrintItemExpanded] } ## List of problematic GUIDs in data set @@ -1161,6 +1167,115 @@ type SchoolDetails { ACARAId: String } +## Represents each student as a line of results for priniting +type ISRPrintItem { + ## The student ID (typically localID) + StudentLocalID: String + ## Platform identifier for student + StudentPSI: String + ## Student given name + StudentFirstName: String + ## Student family name + StudentLastName: String + ## Student year level + YearLevel: Int + ## ID of school + SchoolID: String + ## School name + SchoolName: String + ## Reading domainscore, scaled + R_Score: Float + ## Reading mean + R_Mean: Float + ## Reading score comment + R_Comment: String + ## Writing domainscore, scaled + W_Score: Float + ## Writing mean + W_Mean: Float + ## Writing score comment + W_Comment: String + ## Spelling domainscore, scaled + S_Score: Float + ## Spelling mean + S_Mean: Float + ## Spelling score comment + S_Comment: String + ## Grammar domainscore, scaled + G_Score: Float + ## Grammar mean + G_Mean: Float + ## Grammar school comment + G_Comment: String + ## Numearacy domainscore, scaled + N_Score: Float + ## Numearacy mean + N_Mean: Float + ## Numeracy score comment + N_Comment: String +} + +## Represents each student as a line of results for priniting +type ISRPrintItemExpanded { + ## The student + Student: RegistrationRecord + ## ID of school + SchoolID: String + ## School name + SchoolName: String + ## Reading domainscore, scaled + R_Score: Float + ## Reading mean + R_Mean: Float + ## Reading score comment + R_Comment: String + ## Writing domainscore, scaled + W_Score: Float + ## Writing mean + W_Mean: Float + ## Writing score comment + W_Comment: String + ## Spelling domainscore, scaled + S_Score: Float + ## Spelling mean + S_Mean: Float + ## Spelling score comment + S_Comment: String + ## Grammar domainscore, scaled + G_Score: Float + ## Grammar mean + G_Mean: Float + ## Grammar school comment + G_Comment: String + ## Numearacy domainscore, scaled + N_Score: Float + ## Numeracy mean + N_Mean: Float + ## Numeracy score comment + N_Comment: String + ## Reading participation + R_Participation: String + ## Writing participation + W_Participation: String + ## Numeracy participation + N_Participation: String + ## Spelling participation + S_Participation: String + ## Grammar & Punctuation participation + G_Participation: String + ## Reading pathway + R_Pathway: String + ## Writing pathway + W_Pathway: String + ## Numeracy pathway + N_Pathway: String + ## Spelling pathway + S_Pathway: String + ## Grammar & Punctuation pathway + G_Pathway: String +} + + diff --git a/app/naprrql/naprrql.go b/app/naprrql/naprrql.go index 8efd6d7..379a9a7 100644 --- a/app/naprrql/naprrql.go +++ b/app/naprrql/naprrql.go @@ -19,8 +19,9 @@ import ( var ingest = flag.Bool("ingest", false, "Loads data from results file. Exisitng data is overwritten.") var report = flag.Bool("report", false, "Creates .csv reports. Existing reports are overwritten") -var isrprint = flag.Bool("isrprint", false, "Creates .csv files for use in isr printing") -var itemprint = flag.Bool("itemprint", false, "Creates .csv files reporting item results for each student against items") + +// var isrprint = flag.Bool("isrprint", false, "Creates .csv files for use in isr printing") +// var itemprint = flag.Bool("itemprint", false, "Creates .csv files reporting item results for each student against items") var qa = flag.Bool("qa", false, "Creates .csv files for QA checking of NAPLAN results") func main() { @@ -75,27 +76,27 @@ func main() { closeDB() os.Exit(1) } - - // create the isr printing reports - if *isrprint { - // launch web-server - startWebServer(true) - writeISRPrintingReports() + /* + // create the isr printing reports + if *isrprint { + launch web-server + startWebServer(true) + writeISRPrintingReports() // shut down - closeDB() - os.Exit(1) - } - - // create the item reports - if *itemprint { - // launch web-server - startWebServer(true) - writeItemPrintingReports() - // shut down - closeDB() - os.Exit(1) - } + closeDB() + os.Exit(1) + } + // create the item reports + if *itemprint { + // launch web-server + startWebServer(true) + writeItemPrintingReports() + // shut down + closeDB() + os.Exit(1) + } + */ // create the item reports if *qa { // launch web-server diff --git a/app/naprrql/reporting_templates/isr_printing/isrPrinting.gql b/app/naprrql/reporting_templates/isr_printing/isrPrinting.gql deleted file mode 100644 index 3dee934..0000000 --- a/app/naprrql/reporting_templates/isr_printing/isrPrinting.gql +++ /dev/null @@ -1,24 +0,0 @@ -query ISRPrinting($acaraID: String, $yrLevel: String) { - reportItems(schoolAcaraID: $acaraID, testYrLevel: $yrLevel) { - StudentLocalID - StudentFirstName - StudentLastName - SchoolID - SchoolName - R_Score - R_Mean - R_Comment - W_Score - W_Mean - W_Comment - S_Score - S_Mean - S_Comment - G_Score - G_Mean - G_Comment - N_Score - N_Mean - N_Comment - } -} \ No newline at end of file diff --git a/app/naprrql/reporting_templates/isr_printing/isrPrintingExpanded.gql b/app/naprrql/reporting_templates/isr_printing/isrPrintingExpanded.gql deleted file mode 100644 index ba560f7..0000000 --- a/app/naprrql/reporting_templates/isr_printing/isrPrintingExpanded.gql +++ /dev/null @@ -1,71 +0,0 @@ -query ISRPrinting($acaraID: String, $yrLevel: String) { - reportItemsExpanded(schoolAcaraID: $acaraID, testYrLevel: $yrLevel) { - Student { - LocalId - StateProvinceId - OtherIdList - FamilyName - GivenName - MiddleName - PreferredName - IndigenousStatus - Sex - BirthDate - CountryOfBirth - StudentLOTE - VisaCode - LBOTE - AddressLine1 - AddressLine2 - Locality - StateTerritory - Postcode - SchoolLocalId - YearLevel - FTE - Parent1LOTE - Parent2LOTE - Parent1Occupation - Parent2Occupation - Parent1SchoolEducation - Parent2SchoolEducation - Parent1NonSchoolEducation - Parent2NonSchoolEducation - LocalCampusId - ASLSchoolId - TestLevel - Homegroup - ClassGroup - MainSchoolFlag - FFPOS - ReportingSchoolId - OtherSchoolId - EducationSupport - HomeSchooledStudent - Sensitive - OfflineDelivery - } - SchoolID - SchoolName - R_Score - R_Mean - R_Comment - R_Participation - W_Score - W_Mean - W_Comment - W_Participation - S_Score - S_Mean - S_Comment - S_Participation - G_Score - G_Mean - G_Comment - G_Participation - N_Score - N_Mean - N_Comment - N_Participation - } -} diff --git a/app/naprrql/reporting_templates/isr_printing/isrPrintingExpanded_map.csv b/app/naprrql/reporting_templates/isr_printing/isrPrintingExpanded_map.csv deleted file mode 100644 index 76205fb..0000000 --- a/app/naprrql/reporting_templates/isr_printing/isrPrintingExpanded_map.csv +++ /dev/null @@ -1,2 +0,0 @@ -EDID,First Name,Last Name,Date of Birth,Year Level,Sex,Indigenous Status,LBOTE Status,Parent 1 School Education,Parent 1 Non-School Education,Parent 1 Occupation,Parent 2 School Education,Parent 2 Non-School Education,Parent 2 Occupation,Student LOTE,Parent 1 LOTE,Parent 2 LOTE,Country of Birth,Local School Student ID,Diocesan Student ID,TAA Student ID,Platform Student ID,Previous Local School Student ID,Previous Diocesan Student ID,Previous TAA Student ID,Previous Platform Student ID,Education Support,Full Fee Paying Student,Visa Code,Home Schooled Student,Sensitive,Address Line 1,Address Line 2,Locality,Postcode,State,School Code,School Name,R_Score,W_Score,S_Score,G_Score,N_Score,R_Comment,W_Comment,S_Comment,G_Comment,N_Comment,R_Mean,W_Mean,S_Mean,G_Mean,N_Mean,R_Participation,W_Participation,S_Participation,G_Participation,N_Participation -Student.LocalID,Student.GivenName,Student.FamilyName,Student.BirthDate,Student.TestLevel,Student.Sex,Student.IndigenousStatus,Student.LBOTE,Student.Parent1SchoolEducation,Student.Parent1NonSchoolEducation,Student.Parent1Occupation,Student.Parent2SchoolEducation,Student.Parent2NonSchoolEducation,Student.Parent2Occupation,Student.StudentLOTE,Student.Parent1LOTE,Student.Parent2LOTE,Student.CountryOfBirth,Student.LocalId,Student.OtherIdList.OtherId.#[Type==DiocesanStudentId].Value,Student.OtherIdList.OtherId.#[Type==TAAStudentId].Value,Student.OtherIdList.OtherId.#[Type==PreviousLocalId].Value,Student.OtherIdList.OtherId.#[Type==PreviousDiocesanStudentId].Value,Student.OtherIdList.OtherId.#[Type==PreviousTAAStudentId].Value,Student.OtherIdList.OtherId.#[Type==PreviousNAPPlatformStudentId].Value,Student.OtherIdList.OtherId.#[Type==NAPPlatformStudentId].Value,Student.EducationSupport,Student.FFPOS,Student.VisaCode,Student.HomeSchooledStudent,Student.Sensitive,Student.AddressLine1,Student.AddressLine2,Student.Locality,Student.Postcode,Student.StateTerritory,SchoolID,SchoolName,R_Score,W_Score,S_Score,G_Score,N_Score,R_Comment,W_Comment,S_Comment,G_Comment,N_Comment,R_Mean,W_Mean,S_Mean,G_Mean,N_Mean,R_Participation,W_Participation,S_Participation,G_Participation,N_Participation diff --git a/app/naprrql/reporting_templates/isr_printing/isrPrinting_map.csv b/app/naprrql/reporting_templates/isr_printing/isrPrinting_map.csv deleted file mode 100644 index 354f9ce..0000000 --- a/app/naprrql/reporting_templates/isr_printing/isrPrinting_map.csv +++ /dev/null @@ -1,2 +0,0 @@ -EDID,First Name,Last Name,School Code,School Name,R_Score,W_Score,S_Score,G_Score,N_Score,R_Comment,W_Comment,S_Comment,G_Comment,N_Comment,R_Mean,W_Mean,S_Mean,G_Mean,N_Mean -StudentLocalID,StudentFirstName,StudentLastName,SchoolID,SchoolName,R_Score,W_Score,S_Score,G_Score,N_Score,R_Comment,W_Comment,S_Comment,G_Comment,N_Comment,R_Mean,W_Mean,S_Mean,G_Mean,N_Mean \ No newline at end of file diff --git a/app/naprrql/reporting_templates/item_printing/itemPrinting.gql b/app/naprrql/reporting_templates/item_printing/itemPrinting.gql deleted file mode 100644 index 3287857..0000000 --- a/app/naprrql/reporting_templates/item_printing/itemPrinting.gql +++ /dev/null @@ -1,108 +0,0 @@ -query NAPItemResults($acaraID: String) { - item_results_report_by_school(acaraID: $acaraID) { - Test { - TestContent { - LocalId - TestName - TestLevel - TestDomain - TestYear - StagesCount - TestType - } - } - TestItem { - TestItemContent { - NAPTestItemLocalId - ItemName - ItemType - Subdomain - WritingGenre - ItemDescriptor - ReleasedStatus - MarkingType - MultipleChoiceOptionCount - CorrectAnswer - MaximumScore - ItemDifficulty - ItemDifficultyLogit5 - ItemDifficultyLogit62 - ItemDifficultyLogit5SE - ItemDifficultyLogit62SE - ItemProficiencyBand - ItemProficiencyLevel - ExemplarURL - ItemSubstitutedForList { - SubstituteItem - } - ContentDescriptionList { - ContentDescription - } - StimulusList { - Stimulus { - LocalId - TextGenre - TextType - WordCount - TextDescriptor - Content - } - } - NAPWritingRubricList { - NAPWritingRubric { - RubricType - Descriptor - ScoreList { - Score - } - } - } - } - } - Student { - BirthDate - Sex - IndigenousStatus - LBOTE - YearLevel - ASLSchoolId - HomeSchooledStudent - Parent1SchoolEducation - Parent1NonSchoolEducation - Parent1Occupation - Parent2SchoolEducation - Parent2NonSchoolEducation - Parent2Occupation - OtherIdList { - OtherId { - Type - Value - } - } - } - Response { - PathTakenForDomain - ParallelTest - PSI - TestletList { - Testlet { - ItemResponseList { - ItemResponse { - LocalID - Response - ResponseCorrectness - Score - LapsedTimeItem - SequenceNumber - ItemWeight - SubscoreList { - Subscore - } - } - } - } - } - } - } -} - diff --git a/app/naprrql/reporting_templates/item_printing/itemPrinting_map.csv b/app/naprrql/reporting_templates/item_printing/itemPrinting_map.csv deleted file mode 100644 index 040a5e2..0000000 --- a/app/naprrql/reporting_templates/item_printing/itemPrinting_map.csv +++ /dev/null @@ -1,2 +0,0 @@ -Test.TestContent.LocalId,Test.TestContent.TestName,Test.TestContent.TestLevel,Test.TestContent.TestDomain,Test.TestContent.TestYear,Test.TestContent.StagesCount,Test.TestContent.TestType,TestItem.TestItemContent.NAPTestItemLocalId,TestItem.TestItemContent.ItemName,TestItem.TestItemContent.ItemType,TestItem.TestItemContent.Subdomain,TestItem.TestItemContent.WritingGenre,TestItem.TestItemContent.ItemDescriptor,TestItem.TestItemContent.ReleasedStatus,TestItem.TestItemContent.MarkingType,TestItem.TestItemContent.MultipleChoiceOptionCount,TestItem.TestItemContent.CorrectAnswer,TestItem.TestItemContent.MaximumScore,TestItem.TestItemContent.ItemDifficulty,TestItem.TestItemContent.ItemDifficultyLogit5,TestItem.TestItemContent.ItemDifficultyLogit62,TestItem.TestItemContent.ItemDifficultyLogit5SE,TestItem.TestItemContent.ItemDifficultyLogit62SE,TestItem.TestItemContent.ItemProficiencyBand,TestItem.TestItemContent.ItemProficiencyLevel,TestItem.TestItemContent.ExemplarURL,TestItem.TestItemContent.ItemSubstitutedForList.SubstituteItem,TestItem.TestItemContent.ContentDescriptionList.ContentDescription,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,Response.PathTakenForDomain,Response.ParallelTest,Response.PSI,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.LocalID,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.Response,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.ResponseCorrectness,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.Score,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.LapsedTimeItem,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.SequenceNumber,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.ItemWeight -Test.TestContent.LocalId,Test.TestContent.TestName,Test.TestContent.TestLevel,Test.TestContent.TestDomain,Test.TestContent.TestYear,Test.TestContent.StagesCount,Test.TestContent.TestType,TestItem.TestItemContent.NAPTestItemLocalId,TestItem.TestItemContent.ItemName,TestItem.TestItemContent.ItemType,TestItem.TestItemContent.Subdomain,TestItem.TestItemContent.WritingGenre,TestItem.TestItemContent.ItemDescriptor,TestItem.TestItemContent.ReleasedStatus,TestItem.TestItemContent.MarkingType,TestItem.TestItemContent.MultipleChoiceOptionCount,TestItem.TestItemContent.CorrectAnswer,TestItem.TestItemContent.MaximumScore,TestItem.TestItemContent.ItemDifficulty,TestItem.TestItemContent.ItemDifficultyLogit5,TestItem.TestItemContent.ItemDifficultyLogit62,TestItem.TestItemContent.ItemDifficultyLogit5SE,TestItem.TestItemContent.ItemDifficultyLogit62SE,TestItem.TestItemContent.ItemProficiencyBand,TestItem.TestItemContent.ItemProficiencyLevel,TestItem.TestItemContent.ExemplarURL,TestItem.TestItemContent.ItemSubstitutedForList.SubstituteItem,TestItem.TestItemContent.ContentDescriptionList.ContentDescription,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,Response.PathTakenForDomain,Response.ParallelTest,Response.PSI,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.LocalID,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.Response,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.ResponseCorrectness,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.Score,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.LapsedTimeItem,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.SequenceNumber,Response.TestletList.Testlet.0.ItemResponseList.ItemResponse.0.ItemWeight diff --git a/naprrql/gql-client.go b/naprrql/gql-client.go index 3f642b9..6c2cf94 100644 --- a/naprrql/gql-client.go +++ b/naprrql/gql-client.go @@ -12,7 +12,8 @@ import ( "github.com/tidwall/gjson" ) -var DEF_GQL_URL = "http://localhost:1329/graphql" +var DEF_INTERACTIVE_GQL_URL = "http://localhost:1329/graphql" +var DEF_GQL_URL = "http://localhost:1329/report" var DEF_ISR_URL = "http://localhost:1329/isrprint" var DEF_ITEM_URL = "http://localhost:1329/itemprint" diff --git a/naprrql/isrprint-resolvers.go b/naprrql/isrprint-resolvers.go index 3c504b9..7a7cf4a 100644 --- a/naprrql/isrprint-resolvers.go +++ b/naprrql/isrprint-resolvers.go @@ -19,6 +19,7 @@ type ISRPrintItem struct { StudentPSI string StudentFirstName string StudentLastName string + YearLevel string SchoolID string SchoolName string R_Score float64 @@ -63,13 +64,18 @@ type ISRPrintItemExpanded struct { N_Mean float64 N_Comment string N_Participation string + G_Pathway string + R_Pathway string + W_Pathway string + S_Pathway string + N_Pathway string } // // if no isr item exists for this student create one and fill with // known information // -func (isrpi *ISRPrintItem) initialiseISRItem(schoolInfo xml.SchoolInfo, event xml.NAPEvent) { +func (isrpi *ISRPrintItem) initialiseISRItem(schoolInfo xml.SchoolInfo, event xml.NAPEvent, yrLvl string) { isrpi.SchoolID = schoolInfo.LocalId isrpi.SchoolName = schoolInfo.SchoolName @@ -80,7 +86,7 @@ func (isrpi *ISRPrintItem) initialiseISRItem(schoolInfo xml.SchoolInfo, event xm isrpi.StudentLastName = student.FamilyName isrpi.StudentLocalID = student.LocalId isrpi.StudentPSI = student.PlatformId - + isrpi.YearLevel = yrLvl } // @@ -116,7 +122,7 @@ func (isrpi *ISRPrintItem) allocateDomainScoreAndMean(event *xml.NAPEvent, summary = xml.NAPTestScoreSummary{} } - resp := getResponseDomainScore(test.TestID, event.SPRefID) + resp, _ := getResponseDomainScore(test.TestID, event.SPRefID) domain := strings.ToLower(test.TestContent.TestDomain) switch { @@ -155,7 +161,7 @@ func (isrpi *ISRPrintItemExpanded) allocateDomainScoreAndMeanAndParticipation(ev summary = xml.NAPTestScoreSummary{} } - resp := getResponseDomainScore(test.TestID, event.SPRefID) + resp, pathway := getResponseDomainScore(test.TestID, event.SPRefID) domain := strings.ToLower(test.TestContent.TestDomain) switch { @@ -163,22 +169,27 @@ func (isrpi *ISRPrintItemExpanded) allocateDomainScoreAndMeanAndParticipation(ev isrpi.G_Score, _ = strconv.ParseFloat(resp.ScaledScoreValue, 32) isrpi.G_Mean, _ = strconv.ParseFloat(summary.DomainSchoolAverage, 32) isrpi.G_Participation = event.ParticipationCode + isrpi.G_Pathway = pathway case strings.Contains(domain, "num"): isrpi.N_Score, _ = strconv.ParseFloat(resp.ScaledScoreValue, 32) isrpi.N_Mean, _ = strconv.ParseFloat(summary.DomainSchoolAverage, 32) isrpi.N_Participation = event.ParticipationCode + isrpi.N_Pathway = pathway case strings.Contains(domain, "read"): isrpi.R_Score, _ = strconv.ParseFloat(resp.ScaledScoreValue, 32) isrpi.R_Mean, _ = strconv.ParseFloat(summary.DomainSchoolAverage, 32) isrpi.R_Participation = event.ParticipationCode + isrpi.R_Pathway = pathway case strings.Contains(domain, "writ"): isrpi.W_Score, _ = strconv.ParseFloat(resp.ScaledScoreValue, 32) isrpi.W_Mean, _ = strconv.ParseFloat(summary.DomainSchoolAverage, 32) isrpi.W_Participation = event.ParticipationCode + isrpi.W_Pathway = pathway case strings.Contains(domain, "spell"): isrpi.S_Score, _ = strconv.ParseFloat(resp.ScaledScoreValue, 32) isrpi.S_Mean, _ = strconv.ParseFloat(summary.DomainSchoolAverage, 32) isrpi.S_Participation = event.ParticipationCode + isrpi.S_Pathway = pathway default: log.Println("Unknown test domain supplied (allocateDomainScore): ", domain) } @@ -188,7 +199,8 @@ func (isrpi *ISRPrintItemExpanded) allocateDomainScoreAndMeanAndParticipation(ev // // create the resolver functions for isr printing // -func buildISRPrintResolvers() map[string]interface{} { +/* +func buildISRPrintResolversDISABLE() map[string]interface{} { resolvers := map[string]interface{}{} @@ -356,6 +368,7 @@ func buildISRPrintResolvers() map[string]interface{} { return resolvers } +*/ // // returns set of score summary objects for the test/school combination @@ -437,16 +450,16 @@ func getStudent(studentRefID string) xml.RegistrationRecord { } // -// returns a domain score object for this student for this test +// returns a domain score object and Pathway for this student for this test // -func getResponseDomainScore(testID string, studentRefID string) xml.DomainScore { +func getResponseDomainScore(testID string, studentRefID string) (xml.DomainScore, string) { ds := xml.DomainScore{} dsObjs, err := getObjects(getIdentifiers(testID + ":NAPStudentResponseSet:" + studentRefID)) if err != nil || len(dsObjs) == 0 { // log.Println("Unable to find student domain score for id: ", testID, studentRefID) - return ds + return ds, "" } response, ok := dsObjs[0].(xml.NAPResponseSet) @@ -454,7 +467,7 @@ func getResponseDomainScore(testID string, studentRefID string) xml.DomainScore log.Printf("Unable to assert response record for object: %#v", dsObjs[0]) } - return response.DomainScore + return response.DomainScore, response.PathTakenForDomain } diff --git a/naprrql/naplan-executor.go b/naprrql/naplan-executor.go index d8a0e91..7e48def 100644 --- a/naprrql/naplan-executor.go +++ b/naprrql/naplan-executor.go @@ -35,7 +35,8 @@ func buildNAPResolvers() map[string]interface{} { } -func buildISRPrintExecutor() *graphql.Executor { +/* +func buildISRPrintExecutorDISABLE() *graphql.Executor { executor, err := graphql.NewExecutor(buildISRPrintSchema(), "ISRPrint", "", buildISRPrintResolvers()) if err != nil { @@ -45,6 +46,7 @@ func buildISRPrintExecutor() *graphql.Executor { return executor } +*/ func buildItemPrintExecutor() *graphql.Executor { diff --git a/naprrql/naprrql-webserver.go b/naprrql/naprrql-webserver.go index 76b43f6..10d3636 100644 --- a/naprrql/naprrql-webserver.go +++ b/naprrql/naprrql-webserver.go @@ -13,8 +13,10 @@ import ( ) var nap_executor *graphql.Executor -var isr_executor *graphql.Executor -var item_executor *graphql.Executor +var report_executor *graphql.Executor + +// var isr_executor *graphql.Executor +// var item_executor *graphql.Executor // // wrapper type to capture graphql input @@ -47,10 +49,35 @@ func graphQLHandler(c echo.Context) error { } +// +// the graphql handler routine for reports: kept separate since it will be static, +// whereas the main graphql handler can have its contents experimented with +// +func reportHandler(c echo.Context) error { + + grq := new(GQLRequest) + if err := c.Bind(grq); err != nil { + return err + } + + query := grq.Query + variables := grq.Variables + gqlContext := map[string]interface{}{} + + result, err := report_executor.Execute(gqlContext, query, variables, "") + if err != nil { + panic(err) + } + + return c.JSON(http.StatusOK, result) + +} + // // specialist handler for creating isr printing files // -func isrPrintHandler(c echo.Context) error { +/* +func isrPrintHandlerDISABLE(c echo.Context) error { grq := new(GQLRequest) if err := c.Bind(grq); err != nil { @@ -69,10 +96,12 @@ func isrPrintHandler(c echo.Context) error { return c.JSON(http.StatusOK, result) } +*/ // // specialist handler for creating item result printing files // +/* func itemPrintHandler(c echo.Context) error { grq := new(GQLRequest) @@ -92,6 +121,7 @@ func itemPrintHandler(c echo.Context) error { return c.JSON(http.StatusOK, result) } +*/ // // launches the server @@ -99,8 +129,9 @@ func itemPrintHandler(c echo.Context) error { func RunQLServer() { nap_executor = buildNAPExecutor() - isr_executor = buildISRPrintExecutor() - item_executor = buildItemPrintExecutor() + report_executor = buildNAPExecutor() + // isr_executor = buildISRPrintExecutor() + // item_executor = buildItemPrintExecutor() e := echo.New() @@ -115,11 +146,14 @@ func RunQLServer() { // the main graphql handler e.POST("/graphql", graphQLHandler) + // the graphql handler for reports + e.POST("/report", reportHandler) + // special handler for isr printing - e.POST("/isrprint", isrPrintHandler) + // e.POST("/isrprint", isrPrintHandler) // special handler for item printing - e.POST("/itemprint", itemPrintHandler) + // e.POST("/itemprint", itemPrintHandler) // // download the requested pre-generated csv file. diff --git a/naprrql/report-resolvers.go b/naprrql/report-resolvers.go index a73c386..6c3c25a 100644 --- a/naprrql/report-resolvers.go +++ b/naprrql/report-resolvers.go @@ -1191,6 +1191,183 @@ func buildReportResolvers() map[string]interface{} { return results, err + } + // resolver for isr printing results, line per student. + // + resolvers["NaplanData/isrReportItems"] = func(params *graphql.ResolveParams) (interface{}, error) { + + isrPrintItems := make([]ISRPrintItem, 0) + + // validate input params + reqErr := checkRequiredParams(params) + if reqErr != nil { + return nil, reqErr + } + + // get the acara ids from the request params + acaraids := make([]string, 0) + for _, a_id := range params.Args["acaraIDs"].([]interface{}) { + acaraid, _ := a_id.(string) + acaraids = append(acaraids, acaraid) + } + + /* + // get the test year level from the request params + yrLvl := params.Args["testYrLevel"].(string) + // log.Println("Yr Level: ", yrLvl) + */ + + studentISRItems := make(map[string]ISRPrintItem) // index is string = student refid + for _, acaraid := range acaraids { + // get the school info for the acarid supplied + schoolInfo, err := getSchoolInfo(acaraid) + if err != nil { + return isrPrintItems, err + } + // log.Println("School: ", schoolInfo.SchoolName) + + // get tests for yearLevel + for _, yrLvl := range []string{"3", "5", "7", "9"} { + + tests, err := getTestsForYearLevel(yrLvl) + if err != nil { + return isrPrintItems, err + } + // convenience map to avoid revisiting db for tests + testLookup := make(map[string]xml.NAPTest) // key string = test refid + for _, test := range tests { + t := test + testLookup[t.TestID] = t + } + + // get events for each test at this school + events := make([]xml.NAPEvent, 0) + events, err = getTestEvents(tests, schoolInfo.RefId) + if err != nil { + return isrPrintItems, err + } + + // get score summaries for tests at this school + summaries := make([]xml.NAPTestScoreSummary, 0) + summaries, err = getScoreSummaries(tests, schoolInfo.RefId) + if err != nil { + return isrPrintItems, nil + } + // convenience map to avoid revisiting db for summaries + summaryLookup := make(map[string]xml.NAPTestScoreSummary) + for _, summary := range summaries { + s := summary + summaryLookup[s.NAPTestRefId] = s + } + + // iterate events creating collated items for students + for _, event := range events { + _, present := studentISRItems[event.SPRefID] + if !present { + s := ISRPrintItem{} + s.initialiseISRItem(schoolInfo, event, yrLvl) + studentISRItems[event.SPRefID] = s + } + s := studentISRItems[event.SPRefID] + s.allocateDomainScoreAndMean(&event, testLookup, summaryLookup) + studentISRItems[event.SPRefID] = s + } + } + } + + // once collated return the isr print items + for _, isrpi := range studentISRItems { + isrPrintItems = append(isrPrintItems, isrpi) + } + + return isrPrintItems, nil + + } + resolvers["NaplanData/isrReportItemsExpanded"] = func(params *graphql.ResolveParams) (interface{}, error) { + + isrPrintItems := make([]ISRPrintItemExpanded, 0) + + // validate input params + reqErr := checkRequiredParams(params) + if reqErr != nil { + return nil, reqErr + } + + // get the acara ids from the request params + acaraids := make([]string, 0) + for _, a_id := range params.Args["acaraIDs"].([]interface{}) { + acaraid, _ := a_id.(string) + acaraids = append(acaraids, acaraid) + } + studentISRItems := make(map[string]ISRPrintItemExpanded) // index is string = student refid + + /* + // get the test year level from the request params + yrLvl := params.Args["testYrLevel"].(string) + */ + for _, acaraid := range acaraids { + // get the school info for the acarid supplied + schoolInfo, err := getSchoolInfo(acaraid) + if err != nil { + return isrPrintItems, err + } + // log.Println("School: ", schoolInfo.SchoolName) + + // get tests for yearLevel + for _, yrLvl := range []string{"3", "5", "7", "9"} { + tests, err := getTestsForYearLevel(yrLvl) + if err != nil { + return isrPrintItems, err + } + // convenience map to avoid revisiting db for tests + testLookup := make(map[string]xml.NAPTest) // key string = test refid + for _, test := range tests { + t := test + testLookup[t.TestID] = t + } + + // get events for each test at this school + events := make([]xml.NAPEvent, 0) + events, err = getTestEvents(tests, schoolInfo.RefId) + if err != nil { + return isrPrintItems, err + } + + // get score summaries for tests at this school + summaries := make([]xml.NAPTestScoreSummary, 0) + summaries, err = getScoreSummaries(tests, schoolInfo.RefId) + if err != nil { + return isrPrintItems, nil + } + // convenience map to avoid revisiting db for summaries + summaryLookup := make(map[string]xml.NAPTestScoreSummary) + for _, summary := range summaries { + s := summary + summaryLookup[s.NAPTestRefId] = s + } + + // iterate events creating collated items for students + for _, event := range events { + _, present := studentISRItems[event.SPRefID] + if !present { + s := ISRPrintItemExpanded{} + s.initialiseISRItemExpanded(schoolInfo, event) + studentISRItems[event.SPRefID] = s + } + s := studentISRItems[event.SPRefID] + s.allocateDomainScoreAndMeanAndParticipation(&event, testLookup, summaryLookup) + studentISRItems[event.SPRefID] = s + } + } + } + + // once collated return the isr print items + for _, isrpi := range studentISRItems { + isrPrintItems = append(isrPrintItems, isrpi) + } + + return isrPrintItems, nil + } return resolvers