How dspsforms/dspsadvisingflow works
1. Repository shape
- This is a three-part system: dspsmisc-backend, dspsmisc-ionic, and dspsmisc-print.
- The backend exposes the data and workflow APIs; the Ionic app is the main operational UI for staff/students; the print app is a separate Angular client optimized for printable form views and document-style rendering.
2. Backend as the system hub
- dspsmisc-backend is the server-side application, organized into routes, controllers, models, middleware, and config.
- The route/controller layer handles form management, user management, search, signatures, and “own form” flows.
- The presence of many models plus modelsOld strongly suggests a document-database-style persistence layer with schema evolution and legacy compatibility.
3. Main domain objects
- The core business objects are accommodation/intake forms and related student/user records.
- Form families are explicit in both backend and clients: aap1, aap2, aap2child, bluesheet, and greensheet.
- Shared schemas such as common-form-schema, signature-model, student-model, user-model, random-key.model, and version-details-schema indicate the system tracks lifecycle, signatures, and audit/version history.
4. Workflow-oriented UI split
- dspsmisc-ionic is the primary application used by DSPS staff and other roles to create, edit, view, and search forms.
- Its structure is route/page-based, with major areas for authentication, DSPS staff operations, instructor workflows, student tabs, landing pages, and print view.
- The form UI is heavily componentized, with dedicated subcomponents for each section of each form type rather than a single generic form screen.
5. Staff form processing pipeline
- The staff side centers on dsps-staff/form, which includes create/edit/list/view/search flows plus validation and transformation services.
- forms.service, data-transform.service, and form-validators act as the client-side orchestration layer between form components and backend APIs.
- The architecture supports multi-step forms, pagination, conditional sections, and signatures via reusable components like sig-create, sig-view, elem-with-sig, and joint-sig-view.
6. Student-facing workflows
- The Ionic app also contains student-oriented flows: signup, email verification, login, password reset, and a student tabs area.
- The README notes a separate student information submission application exists elsewhere; in this repo, the Ionic app still includes student interaction points for login and review/view operations.
- Components such as student-signup, validate-signup, reset-password-*, and single-sign-on show that identity onboarding is part of the same system boundary.
7. Authentication and authorization boundary
- Role-based access is enforced in both client and server.
- Backend middleware includes checks for logged-in users and role gates such as admin, DSPS, faculty, instructor, staff, and student.
- The clients mirror this with Angular route guards, so navigation and API access are both constrained by role.
8. Messaging, email, and verification
- The backend has dedicated middleware for email notifications and password reset/verification flows, plus an email server/transport creator.
- There is also captcha verification middleware and random-key status updates, which suggests self-service actions are protected by one-time tokens and anti-abuse checks.
- These are not side features; they are part of the identity and form-signature lifecycle.
9. Search and lookup as first-class operations
- Search is a distinct subsystem in both backend and client, with search-controller, search-routes, and staff search pages/components.
- The system supports querying forms and student records, which is important for audit, follow-up, and historical workflow retrieval.
10. Signature and legal recordkeeping
- Signature handling is a major architectural concern, not a UI embellishment.
- Backend signature-controller and frontend signature components indicate signatures are persisted, displayed, and probably tied to specific form states.
- The README explicitly frames the product as legal/audit-oriented, so immutable history and signed artifacts are part of the core data model.
11. Print subsystem as a separate client
- dspsmisc-print is a second Angular application, distinct from the Ionic app, focused on presentation/printing rather than data entry.
- It reuses the same domain concepts and many of the same form components, but adds print-specific UI pieces such as print-view, view-form, generic, and print-oriented assets/styles.
- It also includes sub-site-communicator, which suggests cross-window or cross-site coordination with the main application.
12. Shared domain duplication across clients
- The Ionic and print apps both contain similar model files and many parallel form components.
- This indicates the architecture favors duplicated client implementations over a shared library, likely to allow differing UX requirements while preserving the same form semantics.
13. Operational and deployment concerns
- The repository includes dbBackup.sh, production server templates, build scripts, and environment templates, so deployment is handled outside the app code but is clearly part of the architecture.
- The print app also bundles third-party assets like Chart.js and Bootstrap, showing that rendering fidelity and document-style output matter operationally.
14. High-level data flow
- Users authenticate in a client, which calls the backend API.
- The backend authorizes the user, loads/stores student and form documents, records signatures and history, and sends email notifications where needed.
- The Ionic app is the main transactional client; the print app is used to render finalized or printable views of the same underlying records.
15. Architecture diagram guidance
- A useful diagram would show three deployable applications around one shared backend.
- Inside the backend, draw separate lanes for authentication, form CRUD, search, signatures, notifications, and persistence/models.
- On the client side, distinguish the main workflow UI from the print-only UI, and show shared domain concepts flowing between both and the backend.
Main entry points: routes API routes · user-controller.js User ctrl · print-view View routes · models Form models
Components 23
Backend
API server, middleware, routes, and persistence models.
- Server · Main backend entrypoint and deployment process.
dspsmisc-backend/server.js - API routes · Form, user, search, own-form, and signature endpoints.
dspsmisc-backend/routes - Form ctrl · Form lifecycle, common-form, and own-form workflows.
dspsmisc-backend/controllers/form-controller.js - User ctrl · User management and account-related operations.
dspsmisc-backend/controllers/user-controller.js - Search ctrl · Lookup and retrieval for forms and student records.
dspsmisc-backend/controllers/search-controller.js - Signature ctrl · Signature persistence and signed-record operations.
dspsmisc-backend/controllers/signature-controller.js - Auth gates · Logged-in and role checks for admin, DSPS, faculty, instructor, staff, and student.
dspsmisc-backend/middleware - Notify flow · Email verification, password reset, and DSPS/student notifications.
dspsmisc-backend/middleware/email-notify-dsps.js - Security flow · Captcha verification, random-key status updates, and user identity extraction.
dspsmisc-backend/middleware/verify-captchav3.js - Form models · AAP1, AAP2, AAP2-child, Bluesheet, Greensheet, and shared form schemas.
dspsmisc-backend/models - People models · Student, temporary student, user, and feedback records.
dspsmisc-backend/models/student-model.js - Audit models · Version details, meta history, signatures, and random keys.
dspsmisc-backend/models/version-details-schema.js
Ionic App
Primary operational client for staff and student workflows.
- Ionic app · Primary operational UI for staff and students.
dspsmisc-ionic/src/app/app-routing.module.ts - Auth area · Login, signup, email validation, reset password, SSO, and role guards.
dspsmisc-ionic/src/app/auth - Staff ops · Staff landing area for form creation, editing, listing, view, and search.
dspsmisc-ionic/src/app/dsps-staff - Form services · Form API service, validators, transforms, and operation status tracking.
dspsmisc-ionic/src/app/dsps-staff/form/forms.service.ts - Form UI · Componentized AAP1, AAP2, Bluesheet, and Greensheet editors and viewers.
dspsmisc-ionic/src/app/dsps-staff/form/component - Student tabs · Student list and student view-form area inside the client boundary.
dspsmisc-ionic/src/app/student-tabs - Print view · Client-side printable view entry point used from the main app.
dspsmisc-ionic/src/app/print-view
Print App
Angular client specialized for printable form views.
- Print app · Separate Angular application for printable and document-style rendering.
dspsmisc-print/src/app/app-routing.module.ts - Site bridge · Cross-window/sub-site coordination used by the print client.
dspsmisc-print/src/app/auth/sub-site-communicator - View routes · Print-view and view-form pages for final rendered records.
dspsmisc-print/src/app/print-view - Print forms · Printable AAP, Bluesheet, Greensheet, signature, and label/value components.
dspsmisc-print/src/app/dsps-staff/form/component
Connections 28
- Server → API routes: serves · Server exposes the route layer.
- API routes → Form ctrl: dispatches · Routes delegate form lifecycle actions to controllers.
- API routes → User ctrl: dispatches · Routes delegate account operations.
- API routes → Search ctrl: dispatches · Routes delegate lookup requests.
- API routes → Signature ctrl: dispatches · Routes delegate signature actions.
- Form ctrl → Form models: reads/writes · Form controllers persist domain documents.
- User ctrl → People models: reads/writes · User controllers manage people records.
- Signature ctrl → Audit models: persists · Signatures and version history are recorded as audit data.
- Search ctrl → People models: queries · Search spans student and user records.
- Search ctrl → Form models: queries · Search spans stored forms.
- Auth gates → API routes: protects · Role gates wrap backend endpoints.
- Notify flow → User ctrl: supports · Verification and reset flows support account actions.
- Security flow → Signature ctrl: protects · Token and captcha checks support sensitive flows.
- Ionic app → Auth area: routes to · Client entry includes identity and role flows.
- Ionic app → Staff ops: routes to · Primary operational navigation lands in staff workflows.
- Staff ops → Form services: uses · Staff pages orchestrate API and validation logic.
- Form services → API routes: calls · Client services talk to backend endpoints.
- Staff ops → Form UI: renders · Staff workflow pages mount form-specific components.
- Form UI → Form models: matches · Client form families mirror backend document shapes.
- Auth area → User ctrl: authenticates · Login, signup, reset, and verification reach user APIs.
- Student tabs → User ctrl: reads · Student tabs interact with student/account data.
- Print view → View routes: hands off · The main app offers a print-oriented route.
- Print app → Site bridge: coordinates · Print client communicates with its host site.
- Print app → View routes: routes to · Print app entry focuses on render-only pages.
- View routes → Print forms: composes · Printable pages assemble form-specific UI pieces.
- Print forms → Form models: matches · Print components reuse the same underlying form semantics.
- View routes → API routes: reads via API · Final printable records are loaded from the backend.
- Form UI → Print forms: shared domain · Both clients implement parallel domain-specific form UI.