SIGAD Architecture 🚀 Laravel Records & PostgreSQL Modeling14 min read2,858 words

SIGAD Architecture 🚀 Laravel Records & PostgreSQL Modeling

Discover SIGAD architecture: Laravel records management and PostgreSQL data modeling for an archival records system—stable identities, retention events, safe imports.

SIGAD architectureLaravel records managementarchival records systemPostgreSQL data modelingdocument management system
SIGAD Architecture 🚀 Laravel Records & PostgreSQL Modeling

SIGAD Architecture: Laravel, Vue, and PostgreSQL

From Document Management to Archival Records: Architecture That Holds Up

A document management system can receive and display PDFs without needing to understand what those files represent. An archival records system has a tougher job: it has to preserve classification choices, the events that shape a record's lifecycle, the retention rules that follow, and the history of decisions behind it all. Adding those capabilities isn't mostly about new screens. It's a change to the system's domain model - and that ripples through day-to-day operations.

In this project, we started with an existing document management system that already handled PDF uploads and viewing. The next step was to support 23 requirements for archival classification and retention while keeping current workflows intact. We used PHP 7.4, Laravel 8, PostgreSQL, Vue 3, and Inertia. The biggest decisions weren't UI tweaks; they were about what counts as an archival process, how to apply rule changes safely, and how the new workflow could live alongside existing uploads.

This article walks through the architecture behind that transition. It covers the domain model, how we imported and revised classification plans, how retention can be driven by events, how we integrated with the existing system, and the tests that separate technical behavior from institutional approval.

What changes when a document system becomes an archival system?

A document management system organizes files. An archival system has to do more than store documents - it needs to explain what records those files belong to, what rules were applied, and what events affected their lifecycle. If you treat those as the same kind of problem, you end up with a predictable failure mode: the interface sprouts new fields, but the data model can't preserve the meaning of past decisions.

The key modeling decision was to make the archival process the classified object. PDFs are components of that process, not the process itself. A process can hold metadata, a classification, a typology, archival events, and retention periods. The digital content can then be represented in structures like volumes, parts, or attachments.

For example, a process might include Volume 1 and Volume 2, each tied to a PDF component. That structure answers three questions clearly: what is classified, what the viewer shows, and what stays associated with the record when classification rules change.

Keep the record separate from its files

If classification metadata is attached only to a PDF, multi-volume records become awkward. Each file can look like its own record even when the institution treats them as one process. Then classification or retention rule changes have no reliable unit to operate on.

Separating the process from its components avoids that coupling. The process carries the archival identity and lifecycle. Representations describe how the digital content is organized. Components are the files themselves. It's a more deliberate model than "just a list of uploads," but it makes real scenarios - multiple volumes, later attachments, replacement content - much easier to represent without duplicating process-level metadata.

Put domain rules in services, not controllers

We grouped backend rules into two service areas: classification and SIGAD processes. Classification services handled plans, classes, typologies, codes, institutional imports, movements, and versions of the retention schedule. Process services handled capture, digital representations, archival events, retention projections, reconciliation when rules changed, and disposition.

Controllers stayed focused on receiving requests, validating input, and checking authorization. This separation matters because the same rule can be triggered through different routes or workflows. When the behavior lives in a service, it's easier to test - and we reduce the risk of one endpoint applying a different rule than another.

Database migrations defined how these objects relate. An application_id scoped data to the relevant application, while permissions governed actions like creating, classifying, publishing, consulting, and downloading. Those boundaries are part of the domain design, not just interface controls.

How should classification plans be modeled and imported?

A classification plan isn't always a clean, uniform tree. Institutional sources may use codes with different lengths, reserve codes for future use, or mix definitions and notes into class names. A database model that assumes one numbering scheme or a fixed hierarchy might look fine in a demo and break the first time a real plan arrives.

The practical response was to separate a class's stable internal identity from its archival code and its position in the hierarchy. The internal identifier stays stable when a class moves or when its code changes. That lets existing process relationships and historical references survive structural changes.

This distinction matters because codes often carry meaning for people, but they aren't necessarily durable identifiers for software. If the code is used as the database key, changing the plan forces updates across processes and historical records. Stable identity gives the system space to represent change without pretending the old classification never existed.

Treat import as interpretation, not file loading

An XLSX template captured hierarchy, typologies, retention periods, initial events, disposition, and notes. But we didn't design the import to turn every cell into a published rule directly. Instead, it kept a reference to the original source row, flagged ambiguous data for review, and created a draft that needed confirmation before publication.

That workflow is a safeguard against false precision. A note in a spreadsheet might be unclear, inconsistent, or dependent on how the institution interprets it. If you automatically convert that into structured data, you can end up with an uncertain assumption looking authoritative. By keeping the source reference and marking ambiguities, we make it possible to trace a decision back to what was actually provided.

A workable import flow looks like this:

  1. Parse the source without assuming every institution uses the same structure.
  2. Preserve source references, including the original row.
  3. Convert unambiguous values into draft records.
  4. Flag incomplete or conflicting values for human review.
  5. Publish only after the draft has been checked.

That means imports aren't a one-click operation. It's an acceptable trade-off if the alternative is silently publishing an incorrect retention rule.

Preview structural changes before applying them

Moving, splitting, or merging classes can affect descendant codes and processes already classified under those classes. These operations shouldn't behave like ordinary edits. We started by previewing the expected effects and requiring a reason for the change. A second user approved movement requests, which separates the person proposing a structural change from the person authorizing it.

We also recorded revisions, authors, timestamps, time zones, reasons, and before-and-after values. Those details support later review - not just what the plan looks like now, but who changed it, when, and why. Deactivation and soft deletion followed their own rules, because a class that's no longer used for new records may still be needed to explain an earlier classification.

How should retention rules respond to events?

A retention schedule doesn't necessarily start when a record first exists in the software. The capture date is a system event. The date a process was opened can be an archival event that happened years earlier. Treating those like interchangeable starting points can produce incorrect retention projections - especially when historical records are digitized or migrated.

So the schedule needs to identify the event that starts each period. The application records that event along with an effective date and a source, then calculates a projection for the current (or intermediate) age of the process. This keeps the calculation explainable: the system can show which event and date it used, instead of displaying a deadline with no visible basis.

Record events as facts, then calculate projections

Keeping events separate from calculated dates has a practical payoff. If the schedule changes, the system can recalculate projections from recorded facts instead of treating an old calculated date as the source of truth. The event is what happened; the projection is what the current rules infer from it.

Not every change to a process should reset a retention period. In this implementation, events like reopening a process or adding restricted content affected a period only when the published rule explicitly said they should. That prevents the application from inventing a retention consequence just because a technical event occurred.

A clear calculation path answers:

  • Which published schedule version applies?
  • Which event starts the relevant period?
  • What effective date and source were recorded?
  • Which rule produced the current projection?

That traceability matters when users question a date or when rules are revised.

Reconcile rule changes without guessing

When a classification or retention schedule changes, the application recalculates the projections that are affected. But old rules don't always map cleanly to new ones. If the correspondence isn't unambiguous, we mark the process as pending review instead of generating a guess.

This becomes especially important before disposition. A wrong projection can drive an incorrect decision about what should be retained or disposed of. Pending review slows things down, but it makes uncertainty visible - and gives an authorized person a chance to resolve it.

The same principle applies to concurrency. When someone edits a plan, the application checks the expected revision. If another user changed it after the first user opened the screen, the update is rejected instead of overwriting the newer version. It's a small bit of friction to avoid silent loss of a colleague's work.

How can you add archival workflows without breaking existing uploads?

The existing system had two upload APIs: a general endpoint and another used by the file screen. If we added a new archival interface without controlling those routes, we'd leave a loophole - users could still upload PDFs as standalone files even when the application was meant to require a process.

So for applications with SIGAD enabled, both existing routes check the setting on the backend and block new standalone uploads. The interface nudges users toward opening a process too, but the server-side check is the real enforcement. A UI can guide you; it can't protect you.

Use a distinct route for process representations

The archival workflow used a separate route to add a PDF as a process representation. The physical file stays registered in the system, but the operation also creates the archival relationships and records a SHA-256 hash for the component.

This gives the application one clear place to enforce the rules for adding content to an existing process. It can create the file record, attach it to the correct representation, record its integrity hash, and update the process revision as one coherent operation. If we reused the generic upload endpoints, it would be harder to distinguish a standalone file from a component of an archival record.

Make multi-file capture recoverable

Later, the interface added multi-file selection during process creation. Rather than invent a second upload mechanism, we created the process as a draft and then sent PDFs sequentially through the same representation route. Each successful upload created a representation and incremented the process revision. Classification and capture details came later steps.

Sequential uploads aren't as fast as a single parallel batch, but they give a straightforward recovery model. If one file fails, the files that already uploaded remain attached to the draft. Failed files stay pending so the user can retry them without restarting the entire capture workflow or duplicating successful uploads.

This is one of those design choices that's about failure modes, not just the happy path. A long upload can be interrupted by a network issue, a browser closing, or a file-level error. Preserving completed work reduces rework - and makes it less likely a user will respond by creating a second duplicate process.

The broader rule is simple: when you add a new workflow to a mature application, inventory every existing route that can perform the same underlying action. Enforce the new domain boundary on the server, then make the interface lead users through the intended path.

How do you verify the system and its archival rules?

Testing has to cover more than whether a form saves data. This implementation combined service tests, API tests, and end-to-end workflows using PostgreSQL. We included scenarios for permissions, versions, class movements, imports, events, retention periods, and processes with multiple volumes. On the frontend, the Vue build checked that the interface still compiled cleanly against the application changes.

Testing against PostgreSQL matters because behavior depends on database relationships, constraints, and transactional updates. A suite that only exercises isolated functions can miss failures that show up in the real persistence flow - for example, a process revision changing as representations are added, or a relationship becoming invalid after a class move.

Separate software correctness from institutional acceptance

Automated tests can verify that the system applies the implemented rules consistently. They can't prove that an institution's classification plan was interpreted correctly. That takes review of the source plan, the retention schedule, access profiles, and the relevant institutional decisions.

So the acceptance process needs two separate questions:

  1. Does the software behave as designed? Tests verify permissions, revisions, imports, events, calculations, and upload workflows.
  2. Is the design's interpretation correct for this institution? Qualified reviewers confirm that the source documents and policies were represented accurately.

Bundling these into one sign-off hides risk. A technically correct calculation can still implement the wrong interpretation of the source schedule. Keeping test and acceptance separate makes ownership clearer and gives reviewers concrete evidence to examine.

Test the consequences of change

For systems with evolving rules, tests should cover more than initial creation. What happens after the rules change? Can a class move without losing historical relationships? Does an ambiguous mapping produce a review state? Does a stale edit fail safely? Can a failed upload be retried without losing the successful files?

Those scenarios show whether the architecture preserves history and handles uncertainty. The goal isn't to test every possible input. It's to test the decisions with the highest consequence: loss of a record relationship, an incorrect retention projection, unauthorized publication, or a change that silently overwrites another user's work.

Key takeaways

  • Model the archival process as the classified object, and treat PDFs as components organized into representations.
  • Use stable internal identifiers so codes and hierarchy can change without wiping out historical relationships.
  • Import real-world plans into drafts, preserve source references, and send ambiguities to review instead of guessing.
  • Store archival events as facts, then calculate retention projections from the published rules that apply.
  • Enforce workflow boundaries in backend routes, not just in the interface.
  • Test technical behavior separately from institutional acceptance of real classification plans and schedules.

Conclusion

Moving from document storage to archival records management is a domain change, not just a new interface. The system needs to know what's being classified, preserve the history of rules and decisions, and surface uncertainty when changes can't be reconciled safely.

Stable identities, event-based retention, reviewable imports, backend-enforced workflows, and tests focused on consequential changes all contribute to a practical foundation. Before adding more features, map the objects and lifecycle decisions your existing system has to preserve. If the model can explain how a record got its classification and how its current retention projection was calculated, you're building the architecture that actually matters.

Frequently Asked Questions

A document management system typically stores and presents files. An archival records system also manages the records those files belong to, including classification, events, retention rules, and disposition. The distinction affects the data model: files may be components of a larger process rather than independent records.
Codes and hierarchy positions can change when a plan is revised, while historical process relationships still need to remain valid. A stable internal identifier lets the system preserve those relationships and track the class across revisions. The code remains meaningful metadata, but it is not relied on as a permanent software identity.
Usually not when the source can be ambiguous or structurally inconsistent. A safer workflow preserves the original source reference, imports clear values into a draft, flags uncertain ones for review, and requires confirmation before publication. This adds work but prevents unresolved interpretation from becoming an authoritative rule.
Only if the applicable rule says that capture is the triggering event. A process may have been opened long before it was entered into the system. Record the event that the published schedule identifies, including its effective date and source, then calculate the retention projection from that information.
Create a draft process and upload each file through the same route used to add a representation. Keep successful uploads attached to the draft and leave failed files available for retry. This makes recovery explicit and avoids forcing users to restart the entire capture workflow after a partial failure.

Related articles