How dwayneselsig/somtodayopenapi2microsoftschooldatasync works
Project type and purpose
• This is a .NET console-application (C#) whose sole purpose is to fetch data from the Somtoday Connect OpenAPI, transform it into Microsoft School Data Sync (SDS) CSV format (V1 or V2.1), and write the CSV files to disk.
• It is an open-source integration tool, not a full-stack web app. It runs on a schedule (e.g., Windows Task Scheduler) and logs status to the Windows Event Viewer.
File structure
• SomtodayOpenAPI2MicrosoftSchoolDataSync/Program.cs – entry point that loads configuration, invokes business logic, and handles high-level orchestration.
• Helpers/ – contains components:
– OpenAPIHelper.cs: handles HTTP calls to Somtoday Connect (authentication, paging, error handling).
– BusinessLogicHelper.cs: implements core sync logic (filtering by location, applying unique IDs, date/year-end logic, guardian sync toggles).
– SDScsvHelperV1.cs and SDScsvHelperV2.cs: transform in-memory models into SDS-compliant CSV rows.
– FileHelper.cs: creates output directories, writes CSV files to disk.
– SettingsHelper.cs and SomEnvironmentConfig.cs: read and validate settings from App.config.
– EventLogHelper.cs: writes informational and error entries to Windows Event Viewer.
• Models/ – DTOs representing OpenAPI resources (lesgroepen, leerlingen, docenten) and CSV row schemas.
• OpenAPIs/ – auto-generated client proxy (openapi.json & openapi.cs) for Somtoday Connect REST endpoints.
• App.config – contains all runtime settings (environment, filters, client credentials, output folder, formatting choices, toggles).
• SomtodayOpenAPI2MicrosoftSchoolDataSync.csproj & packages.config – NuGet dependencies (e.g., Newtonsoft.Json, HTTP client libraries).
README for additional insights
• Describes the high-level workflow: fetch lesson groups, filter out items without teachers or students, assign unique IDs, sanitize invalid characters, generate CSV, and log to Event Viewer.
• Configuration options drive branching behavior (TEST vs. PROD, location filtering, guardian sync, CSV version, year-end cleanup).
• Intended to be run nightly via a scheduler.
Detail
• Every Helper class and its role.
• Call out the App.config settings block as the root of behavior toggles.
• Do not over-complicate – the system is a linear pipeline with well-defined stages.