Tool that syncs the G4S API to a a local SQL database.
- Written by Ben Dobbs from Archway Learning Trust
- bdobbs@archwaytrust.co.uk
- Released under GNU General Public License v3.0
Feel free to use and ammend under the terms of the GNU license but we are unable to offer support or modifications.
You will need a Microsoft SQL Server and initially an AD user account with privaledges for database creation.
- Ammend the connection string in appsettings.json to point to your server.
- Install https://dotnet.microsoft.com/en-us/download/dotnet/7.0
- Using an account with sufficient privaledges run G4SApiSync.exe
- This first run either creates the database or updates it to the latest version.
- Connect to your SQL database using SSMS, right click on the table called sec.AcademySecurity and then "Edit Top 100".
- Add a row for each academy. "CurrentAcademicYear" for 2020/2021 would be 2021.
- AcademyCode in this table should be a unique aconym for the academy.
Run G4SApiSync.exe with an account that has read/right privaledges on the database.
We let G4SApiSync run on a schedule using Task Scheduler on the server hosting the database.
You can change the current accademic year field in sec.AcademySecurity to get data from previous years. It is all tagged in the database so doesn't over write.
To enable behaviour data you need to use SSMS to edit sec.AcademySecurity.
- Change GetBehaviour to True.
- If BehaviourFrom and BehaviorTo are left NULL then it will sync the last 7 days.
- If you enter a date range within the currently selected dataset it will get behaviour for those dates.
To enable session attendance data you need to use SSMS to edit sec.AcademySecurity.
- Change GetSessionAttendance to True.
- If AttendanceFrom and AttendanceTo are left NULL then it will sync the last 7 days.
- If you enter a date range within the currently selected dataset it will get data for those dates.
To enable session attendance data you need to use SSMS to edit sec.AcademySecurity.
- Change GetLessonAttendance to True.
- If AttendanceFrom and AttendanceTo are left NULL then it will sync yesterdays lesson attendance data.
- If you enter a date range within the currently selected dataset it will get data for those dates.
After initial setup you should run scripts in the SQL Scripts folder. They will:
- Create views to help query database.
- Set recovery mode simple which will stop the log file getting too large.