Lawfare Academy · Complete Management Information Systems edition 4
Design the decision service behind the dashboard
Link an analytical question to an architecture and an authorized action
Preserve Harbor's original 1000 account/100 overdue matrix:TP 80, FP 90, FN 20, TN 810; precision 80/170, recall 80%, accuracy 89%. The 2% prevalence transfer case remainsTP 16, FP 98, FN 4, TN 882 andprecision 16/114. The included original Q-order storage examples, 100-invoice classifier, Cedar job report and paid-order dataset are separate teaching cases, not additional Harbor observations. This studio places the full required storage, learning-data and informatics preparation on site and applies it to solution architecture.
Start with the decision the organization must make and the information legitimately available at that time. A dashboard may summarize yesterday's outstanding accounts, predict which might become late next month or recommend which 50 records to review today. These are different services. Their target population, source cutoff, admissible features, response time and consequence determine the architecture. A model may return a risk estimate; the authorized human or policy still determines permitted action. A report label does not grant collection or eligibility authority.
A solution design can separate ingestion, validated persistence, analytical transformations, model/scoring, authorization and presentation. Assign each component a clear interface and failure behavior. A batch pipeline suits a fixed daily review; a stream can update a live projection but must handle late events and replay. A synchronous request waits for a result, while asynchronous processing records work for later completion. These are choices about user promises and failure boundaries. A queue accepted message is not proof that its business effect is complete.
Worked service-design tradeoff
For an independent fictional review service, an overnight batch has source cutoff 02:00 and refresh completion 03:00. A reviewer at 09:00 sees information up to seven hours old at most relative to the source cutoff, not six hours merely because the report finished at 03:00. A payment at 08:30 is outside that original snapshot. If the action needs current balances, retrieve and reconcile current authoritative facts before acting or clearly restrict the action. A frozen report can remain valid for its historical question even after a current balance changes.
Suppose the system must answer 100 reviewer requests per minute. A cache keeps one derived summary with a version and expiry. It improves a latency path but introduces a freshness contract. A 60-secondtime-to-live caps only the intended cache lifetime under the assumed refresh behavior; it does not cap upstream source delay, job failure or clock error. Trace the complete path rather than adding a reassuring green badge to the cache alone. When a source is unavailable, choose an explicit degraded behavior: labeled older data, a withheld recommendation or a controlled manual route according to the business consequence.
Define quality scenarios with stimulus, environment, response and measurable bound. For example, under a stipulated source outage a read-only history page may remain available with an explicit cutoff, while new balance-sensitive actions are withheld. Availability can conflict with current correctness under a failed dependency. Recording the chosen boundary helps future engineers maintain the promise. More microservices, databases or dashboards do not establish better governance; operational complexity is part of the cost.
Evidence for a recommendation
The included full storage-model studio explains relational, hierarchical, nested, object/XML, key-value, document, wide-column and graph choices, consistency, cache and cloud responsibilities. The full validation/informatics studio then teaches training/holdout boundaries, leakage, shallow/deep learning, distribution/parallelism, metrics, domain workflow and software verification. These are complete original Academy lessons supplied in full, with independent-case labels. No external chapter substitutes for them.
For Harbor, preserve the conditional error rates and inspect prevalence, review capacity, label reliability and outcome costs before choosing a threshold. A ranking of account risks is not calibrated probability merely because it produces an ordered list. A historical evaluation must use information available at the decision time. A demonstration that executes quickly does not establish absence of leakage, fairness, causal benefit or authority over real people. Record a simple admissible baseline and an evaluation protocol before interpreting a complex model.
Complete optional decision-service model and rubric
Model: freshness, changed cutoff and a safe decision boundary
At 09:00 the 02:00 source cutoff is seven hours old even though computation ended at 03:00. The 08:30 payment cannot appear in that snapshot without a later source update. Changed fact: the system refreshes at 08:45 but a required payment source remains at 02:00. The combined report still needs a per-source cutoff and cannot honestly call every balance current at 08:45. Restrict a balance-sensitive action or perform a verified current read; preserve the earlier historical report instead of rewriting its scope. A 60-second cache alone does not cure hours of upstream staleness.
Award 0–4 points each for decision/population/cutoff; data representation and lineage; architecture interfaces/failure/freshness; honest model evaluation and authority; and consequential changed-fact reasoning, total 20. Full included original models supply the numerical storage and classifier investigations. A strong answer distinguishes a descriptive snapshot, a predictive target and an intervention claim and assigns the final action's business authority explicitly. Agent checks remain separate from human subject review and learner testing.
Included original on-site methods: storage choices, validation and informatics
The following two Academy studios are included in full. Their Q/Cedar/paid-order/enrollment and 100-invoice fixtures remain independent of Harbor's 1000-account case. Historical source and runtime limitations are retained. The scripts and SQL refer only to disposable synthetic study fixtures and give no permission to touch this site's learner tables.
Derive fan-out instead of treating it as a mysterious SQL defect
An inner join returns every matching pair. If one parent has m eligible lines and n eligible payments, their independent child joins can produce m*n combinations. Each line amount appears n times, each payment amount m times. Keys and foreign keys may all be valid while the sums are wrong. Preserve the existing job 101 case: billed 250,paid 100,open 150 become false 500,200,300 after a two-line/two-payment raw join. The repair is not to divide by two, because different parents have different multiplicities. Aggregate each fact to the agreed parent grain before combining it.
For a new independent fixture, order Q has two line records worth 1000 and 2000 cents, three distinct payments of 500 each, and no refund. The raw line-payment join has six rows. Billed sum 9000 repeats each line three times, while paid sum 3000 repeats each payment twice. Correct billed 3000,paid 1500,open 1500 come from separate aggregates. SUM(DISTINCT payment amount) would instead return 500, deleting two legitimate equal payments. Event identity, not value equality, defines whether an event is repeated.
WITH line_totals AS (
SELECT order_id,SUM(amount_cents) billed
FROM order_lines GROUP BY order_id
), paid_totals AS (
SELECT order_id,SUM(amount_cents) paid
FROM payments WHERE status='settled' GROUP BY order_id
)
SELECT o.order_id,COALESCE(l.billed,0) billed,
COALESCE(p.paid,0) paid,
COALESCE(l.billed,0)-COALESCE(p.paid,0) open
FROM orders o
LEFT JOIN line_totals l ON l.order_id=o.order_id
LEFT JOIN paid_totals p ON p.order_id=o.order_id
ORDER BY o.order_id;The zero-fill convention assumes an absent child aggregate means no recorded events in a complete feed. It does not turn an unknown amount into zero. Keep original population and missingness checks. A customer-status predicate in WHERE after an outer join can remove unmatched accounts; put the eligibility predicate in ON or prefilter the child when the intended target retains every parent. To ask only whether a tag exists, use EXISTS rather than joining every tag and multiplying an order's money. For a tag-level report, intentional repetition requires a declared allocation/counting policy.
Relationships change across time and organizational scope
Joining invoice_no alone is unsafe when it is unique only within company. Match the complete key(company_id,invoice_no), or an equivalent globally unique internal identifier. Joining current territory to historical orders answers current-attribution, not order-date-attribution. The preserved temporal case gives North 100/South 500 under half-open historical intervals and exposes double total 1200 under overlaps. An ordinary primary key on interval start cannot enforce nonoverlap. Check cardinality per event, not just the final total; a valid-looking 600 can still be assigned to the wrong territory.
Relational storage is one representation, not a universal physical layout
The earlier course assigned nonrelational concepts externally. Those concepts belong on site too. A hierarchical model arranges records in a parent-child tree. It naturally represents a catalog with nested parts when a child has one structural parent, but shared children need references or duplication. Older network models allow records to participate through multiple links; navigating pointer paths differs from declaring a relational result. Neither label establishes current suitability or speed. Ask what relationships must be traversed, changed atomically and audited.
A non-first-normal-form or nested representation permits collection-valued attributes, such as an order containing an array of lines. A document database commonly stores self-contained structured documents, often with nested objects and arrays. An order document can preserve the exact issued line-price snapshot, but embedding a mutable customer contact in a thousand orders creates a propagation policy: should old documents retain the issuance contact or follow the current contact? That is a semantic choice, not automatically a defect or advantage. Schema flexibility does not remove a schema; it moves part of its validation into conventions and application controls.
An object database persists objects, identity and relationships directly, sometimes supporting inheritance and methods under its model. Object-relational extensions add richer types and collections to relational systems. Object persistence avoids rebuilding an object graph manually, but does not establish that a serialized object remains compatible with future code or has correct transaction boundaries. Distinguish identity from equality: two equal-address objects may represent different entities; one enduring entity may change attributes. Mapping a relational system to application objects through an ORM also does not eliminate joins, fan-out, transactions or query-cost inspection.
XML represents ordered trees with elements, attributes and potentially mixed content. A document-oriented XML store may query tree paths and preserve document structure. Relational storage can also retain XML or JSON values with engine-specific operators. If a legal or historical document's order and markup are meaningful, flattening every element into an unordered relation can lose context unless the mapping preserves it. Conversely, storing all operational events as opaque documents can make cross-document constraints and reconciled reporting harder. Choose by the facts and operations, not by whether a format looks modern.
NoSQL families and distributed guarantees
A key-value store maps a key to a value and suits direct retrieval when the application knows the key; secondary search and multi-key constraints depend on its features. A document store indexes fields inside documents and supports nested business aggregates. A wide-column family model organizes flexible rows/column groups for defined access patterns; it is different from analytical columnar physical storage, which groups values by column for scans and compression. A graph model treats vertices and edges as first-class structures, useful for path and relationship queries. A fraud-network question can fit a graph while the authoritative payment ledger remains relational.
Replication copies data across nodes for availability or read scale; partitioning divides data across nodes. Neither automatically ensures a single up-to-date global result. Strong consistency and eventual convergence are different contracts. During a network partition, a distributed design may restrict availability to preserve particular consistency guarantees or accept operations whose conflicts need later resolution. The familiar CAP discussion concerns specific consistency and availability definitions under partitions, not an all-purpose instruction to choose any two desirable properties. Inspect the actual product, transaction scope, read/write settings, failure behavior and reconciliation policy.
Cloud-managed storage changes who operates infrastructure, not who owns the data definition or access policy. A managed database, object store, warehouse and serverless query service offer different execution and transaction models. Storage cost, requests, scans, egress, backups and monitoring all affect total cost. Encryption, identity, region, retention and recovery settings need explicit responsibility assignments. Moving to a service does not make a broken event identifier unique or prove a recovery copy is restorable.
Worked choice: one order in three representations
Represent order Q with line IDs L 1=1000 and L 2=2000, payment IDs P 1=P 2=P 3=500, and a customer reference. In normalized tables, query separate child aggregates. In a document, sum distinct keyed line entries and payment entries within the document; reject duplicate event IDs under its update contract. In a key-value cache, store a derived summary(billed 3000,paid 1500) with source version and expiration/rebuild policy. The cache is not a new authoritative payment history. If P 4=500 arrives, correct paid 2000/open 1000 and invalidate or update every affected representation under a declared consistency strategy.
For a cache lagging one update, the displayed paid 1500/open 1500 may be internally consistent with an older version while stale for current operations. Label the version/cutoff; do not merge the new payment count with the old amount and call it one state. If the business requires current credit-limit enforcement, a stale analytical cache is the wrong authority. A system can intentionally use multiple storage models, provided lineage, authority and failure recovery are clear.
Optional progressive practice
Guided model: reconstruct the multiplication
Two lines and three payments produce six joined pairs. Billed 9000 and paid 3000 are inflated; independent aggregates give 3000 and 1500. Changed fact: order R has one line and one payment. Its raw join is not inflated, so dividing every order's totals by a common factor corrupts R. Correct grain rather than a guessed multiplier.
Independent model: historical document or current master
An issued order document retains the agreed line prices and issuance contact; a current customer record supplies today's contact. Both can coexist with explicit meaning. Changed fact: the report promises the address known at issuance but joins only today's master. Add a preserved snapshot/history relationship and test it; changing from relational to document storage alone does not recover lost history.
Transfer model: cache authority
After P 4=500, the authoritative paid amount is 2000 and open 1000. An old cache still shows 1500 and 1500. Mark it stale and rebuild/update under the declared contract; do not use it to authorize another payment or credit decision that needs current state. Changed fact: it is an intentionally frozen prior-day dashboard. Its old value can be valid for that snapshot if clearly labeled and fully consistent with the preserved prior-day inputs.
Unit rubric: 20 points
Four points each for exact join/grain repair; scoped and temporal keys; comparison of relational/nested/object/XML/NoSQL representations; consistency/cloud/cache responsibilities; and changed-fact model selection. Complete model gives Q 3000/1500/1500, preserves equal-valued payment identities and explains document snapshots versus current masters without promising universal database superiority.
Optional source summary: OpenStax nonrelational systems was read for the range of hierarchical, nested, object, XML and nonrelational representations. The on-site explanations and Q-order comparison are original. SQLite SELECT was read for the stated relational join/filtering semantics; its dialect is distinguished from distributed product guarantees.
A report is an executable chain of claims
Write the eligible population, output grain, measures, source cutoff, status policy, missingness policy and currency before optimizing a query. The preserved Cedar job report has three rows with billed 730,paid 390,open 340 dollars; its counterexamples expose fan-out and equal-priced legitimate lines. The separate preserved paid-order cumulative dossier has billed 6500,settled 6500,posted refunds 800 and net billed 5700 cents, excluding draft 700 and pending 500 under explicit policies. Do not combine those independent fixtures or call either a universal revenue-recognition rule.
Validation needs both totals and keyed facts. Check unique output keys, intended parent coverage, unmatched relationships, duplicate input identities, unknown amounts and boundary timestamps. Compare source-to-target facts in both directions and inspect multiplicity. A correct grand total can hide offsetting account errors. An optimization is acceptable only if the complete promised result remains unchanged; a changed execution plan is not a correctness proof. The preserved 10,000-event and WAL examples separate semantics, access strategy and snapshot visibility without promising universal speed.
Prepare data for learning without leaking the answer
Big-data problems concern volume, arrival speed, varied representations, reliability and practical usefulness, not a magic row-count threshold. A small sensitive dataset can be harder to govern than a large public one. Integration aligns identities, units and timing across sources; it must preserve uncertainty about unresolved matches. Batch pipelines process bounded groups, while streams process arriving events with policies for ordering, late data, replay and failure recovery. A streaming output is not automatically complete for an event-time period just because no new row arrived in the last minute.
Supervised learning uses labeled examples to predict a target; classification predicts categories or probabilities, regression predicts a quantitative outcome. Unsupervised methods, such as clustering, seek structure without the same provided outcome labels. A clustering label is not ground truth or a causal explanation. A shallow model may use explicit features and a relatively simple decision structure, such as linear/logistic models or trees. A deep neural model learns multiple layers of representation through fitted parameters; image, text and sequence applications may benefit when appropriate data and compute exist. Complexity does not remove the need for quality, an admissible target or honest validation.
Tools operate at different layers. SQL constructs eligible cohorts and features; Python/R libraries implement transformations and model estimation; distributed query engines or massively parallel processing(MPP) divide work across workers; deep-learning frameworks support tensor operations, automatic differentiation and accelerated training. Naming a tool does not make a result verified. MPP can distribute table partitions and partial aggregates, then combine results. Data skew, network shuffles, coordination and failure retries limit speedup. If 80%of a workload is parallelizable and four workers are otherwise ideal, Amdahl's simplified speedup is 1/(.2+.8/4)=2.5, not 4. That model omits real overhead and is an upper-bound reasoning exercise under its assumptions.
Feature construction needs a decision-time contract. To predict next-month late payment at month-end, a feature called eventual_collection_date contains future information and must not enter a historical forecast. Split by time and, where the target is new accounts, by account; repeated rows from the same entity can otherwise leak identity-specific patterns. Fit imputation, category encodings and scaling only within training. Preserve labels, feature definitions, source versions and the model version. Evaluate against a simple admissible baseline on the same targets, not against a deliberately weak comparator with less information.
Worked classification and changed threshold
Use a separate synthetic frozen holdout of 100 invoices:20 ultimatelylate and 80 on time. A fixed threshold flags 25:15 true late and 10 false alarms. The remaining 75 contain 5 missed late and 70 true negatives. Accuracy 85%,precision 15/25=60%,recall 15/20=75%,specificity 70/80=87.5%. A never-late baseline has 80%accuracy but zero recall. These are observed holdout proportions, not guaranteed population rates. Report the selection and threshold process, sample size and costs.
Suppose a missed late invoice costs 100 units and a false alarm costs 10. This threshold has loss 5*100+10*10=600. Another frozen threshold catches 18 of 20 late but falsely flags 25 of 80 on-time invoices, giving loss 2*100+25*10=450 and accuracy 73%. Lower accuracy can accompany lower declared loss. If costs become 20 for a miss and 20 for a false alarm, losses are 300 and 540, reversing the preference. Declare costs before choosing a winner, and retain an independent evaluation after threshold selection. If all thresholds were selected using this holdout, call it development evidence rather than untouched final testing.
Informatics connects users, workflow and information
Informatics examines how people and technical systems collect, interpret and use information in a domain. A correct query that staff cannot understand can produce unsafe workflow decisions; a helpful interface built on incomplete records can mislead just as seriously. For a collections screen, show the measure's unit, cutoff, unresolved amounts, evidence and authorized next action. Distinguish a model flag from a verified late payment, and give a way to inspect and correct source errors. The user's role, decision deadline and ability to contest a record are design inputs, not cosmetic additions after coding.
An information-system lifecycle includes understanding the problem and stakeholders, feasibility and requirements, design, implementation, validation, deployment, operation/change and eventual retirement or migration. A health, sports or financial application uses different domain vocabularies and consequences even if all store tables. Text instruction and synthetic tests do not establish clinical competency, regulatory approval or authority over real people. This course's examples support business-data reasoning; they do not make automated eligibility or care decisions.
Engineer a small reporting service as a maintained system
Software engineering applies organized design, construction, evaluation and maintenance to a useful system. Requirements include functional behavior(one row per eligible order, an authorized refund operation) and quality constraints(correctness, availability, security, accessibility, latency and recoverability). Make each testable. 'Fast and secure' is not an acceptance criterion. 'A reporting identity cannot update source orders' and 'the report retains accounts without payments and exposes unknown amounts' have observable consequences. Include data contracts, interfaces and external dependencies in the design.
A layered design can separate ingestion validation, persistence/transaction operations, report queries, service authorization and presentation. A repository abstraction can isolate data-access details, while an outbox pattern coordinates committed events with later message delivery. Patterns are reusable structures for recurring problems, not proof that every project needs a framework. Keep responsibilities clear enough to test failure boundaries. Refactoring changes internal structure while intending to preserve externally promised behavior; a change from current-price to historical-price reporting is a semantic correction and must be described as such, even if it accompanies refactoring.
Process choice depends on risk and feedback. A staged plan can make stable interfaces and formal approvals explicit; an iterative or agile process delivers small tested increments and revises requirements through feedback. Neither means skipping documentation, security or preservation. A risk-driven spiral emphasizes resolving major uncertainties through successive cycles. Prototypes can test workflow or feasibility but require a clear boundary before becoming relied-upon production systems. Source control, code review, automated builds, dependency tracking and issue histories provide traceability across methods. Continuous delivery prepares verified changes for release; it is not permission to deploy every experiment without the relevant authority.
Testing has complementary scopes. Unit tests check an isolated transformation; integration tests exercise actual interfaces/transactions; system tests verify the connected workflow; user acceptance assesses whether real users can accomplish the intended task. Static analysis and review inspect code without running it. Black-box tests focus on specified behavior; white-box tests consider implementation paths. Boundary, property-based and adversarial fixtures can expose errors that ordinary examples miss. Regression tests protect earlier promises. Code coverage records which code was exercised, not whether expectations were correct. Agent-run tests are not observed human learner or subject review.
Worked requirements-to-release ledger
For the preserved paid-order case, requirement R 1 is one row per paid order with billed 6500,settled 6500,refund 800 and net 5700; R 2 excludes draft 700 and pending 500 but keeps them in exception checks; R 3 applies refund command R 3=400 exactly once and rejects a changed payload; R 4 preserves orders, line prices and settled payments; R 5 exposes a consistent read cutoff. Test R 1 with independent event arithmetic and exact rows, R 2 with status boundaries, R 3 with replay/conflict/over-limit/failure injection, R 4 with before/after keyed comparisons and R 5 with the documented snapshot fixture.
A release ledger connects each requirement to design, test evidence, method/schema version, review status, rollback strategy and monitoring. A rollback to an old application may not undo a destructive schema migration; plan backward/forward compatibility and preserve recoverable data. A canary or limited rollout can reduce exposure while monitoring known invariants, but a passing small slice does not prove all workloads. Keep an incident and correction record. The actual Academy learner database is outside every laboratory in this course.
Reuse includes libraries, modules, services and tested domain components. Review license, provenance, version, maintenance, interfaces and security exposure before adoption. Free/open-source availability does not mean no obligations or no risk. A permissive library and a reciprocal license can impose different conditions; the concrete license text and intended distribution matter. This lesson makes no specific legal conclusion. Professional ethics includes accurate evidence claims, respect for privacy and accessibility, reporting known limits and avoiding deceptive metrics. AI-assisted generation can speed drafting or code suggestions, but output still requires source checking, tests and accountable review; a confident generated query can duplicate money.
Optional progressive practice
Guided model: test a learning-data claim
The first holdout hasTP 15,FP 10,FN 5,TN 70:accuracy 85%,precision 60%,recall 75%,specificity 87.5%. Declared miss 100/false-alarm 10 loss 600. Changed fact: the alternative frozen threshold givesTP 18,FP 25,FN 2,TN 55. Accuracy 73%butloss 450. Name the cost target and threshold-selection history rather than declaring the larger accuracy universally better.
Independent model: scale and leakage are distinct
The simplified 80%-parallel/four-worker speedup is 2.5. It says nothing about whether an eventual collection-date feature was available at issue time. Changed fact: a thousand workers make the leaked model run faster. The evidence remains invalid for the historical forecast; remove future information and reconstruct the admissible evaluation before interpreting speed or accuracy.
Transfer model: passing tests is not human acceptance
Exact SQL and transaction fixtures can establish their own stated results, while staff usability and independent academic review remain separate. Changed fact: a user observes that a zero and an unknown amount look identical. Treat that as a real presentation requirement defect, preserve the old evidence and revise display and tests. Do not call a new test a retroactive human review of all courses.
Unit rubric: 20 points
Four points each for exact report/lineage/snapshot validation; learning-data eligibility and threshold metrics; informatics and testable requirements; connected design/process/testing/release preservation; and ethical changed-fact reasoning. Complete model retains the original 6500/6500/800/5700 report, post-refund 1200/5300, all replay and historical-price boundaries, and separately calculates 85%/600 versus 73%/450 for the independent classifier. It declines both false software and false human-review claims.
Optional source summaries: OpenStax's learning-data section and informatics section were read for their data/pipeline and human-system scope. Its software fundamentals, process and testing/reuse/ethics topics informed the topic boundaries. The methods, classifier, requirements ledger and complete models above are original on-site teaching, not assigned external chapters or copied textbook prose.