AI for Everyone study guide · Lesson 8 of 14

Data, Spreadsheets, and Code

Describe the Data First · Build Formulas and Charts · Use a Coding Cycle · Test and Secure Generated Code

This is the lesson's study guide from the FlashFeed app, plus its key facts and a self-test.

What you'll be able to do

  • Use AI to inspect structured data and code through schemas, tests, security checks, and reversible changes.

Describe the Data First

A table is not self-explanatory. Column names can be ambiguous, units may differ, categories may encode missing values, and a row may represent a person, transaction, day, or device. Supply a data dictionary and state the question before asking for analysis.

Profile the data first: row count, types, ranges, missingness, duplicates, and impossible values. Preserve the original file and perform transformations on a copy. A plausible chart built on misread units is still wrong.

Three ideas to retain:

  • Rows Need a Unit of Observation: State what one row represents. Confusing a transaction with a customer or a reading with a day changes every calculation.
  • A Data Dictionary Prevents Guessing: Field definitions, units, allowed values, and missing markers give both the model and reviewer a shared interpretation.
  • Profile Before Analysis: Counts, types, ranges, missingness, duplicates, and invalid values reveal whether a dataset is ready for a question.

Key term: Data dictionary means “definitions and rules for dataset fields.”

Build Formulas and Charts

For spreadsheet help, provide column names, a few representative rows, the intended result, and the exact spreadsheet dialect if it matters. Ask the model to explain references and edge cases, then test the formula on hand-computed examples.

A chart answers a question through choices: measure, aggregation, comparison group, time interval, axis, and handling of missing values. Ask why the chart type fits the question. Inspect labels and scales; a polished visual can still aggregate the wrong field.

Three ideas to retain:

  • Formulas Depend on Context: Cell locations, table names, locale, date formats, blank handling, and software dialect can change the correct expression.
  • Tiny Test Cases Catch Big Errors: A few rows with known outputs can reveal off-by-one ranges, wrong absolute references, and incorrect treatment of blanks.
  • Charts Encode Analytical Choices: Aggregation, denominator, interval, axis scale, and grouping determine what a visual comparison actually means.

Key term: Absolute reference means “a spreadsheet reference fixed when copied.”

Use a Coding Cycle

Useful coding assistance begins with the actual environment: language and versions, repository conventions, relevant files, existing tests, and the desired behavior. Ask for a plan before a broad change and keep the patch narrow enough to review.

Run the software's own formatter, type checker, tests, and build. Read the diff rather than accepting a successful command as proof. Generated code may be functional on a happy path while mishandling errors, concurrency, security, or integration.

Three ideas to retain:

  • Repository Context Matters: Correct code depends on versions, APIs, conventions, neighboring modules, and tests that are not visible in an isolated snippet.
  • Small Diffs Are Easier to Trust: A narrowly scoped patch is simpler to review, test, revert, and compare with the requested behavior.
  • Execution Provides Evidence: Formatting, types, tests, builds, and targeted runtime checks reveal problems that plausible-looking code can hide.

Key term: Patch means “a focused set of code changes.”

Test and Secure Generated Code

Generated code can contain ordinary bugs and security vulnerabilities. Ask for tests covering normal, boundary, malformed, and unauthorized inputs, then run them independently. Review data flows, authentication, secrets, dependencies, and error handling.

Do not execute unfamiliar commands with broad permissions or paste credentials into a model. Use a sandbox for uncertain code, pin and audit dependencies, and follow the project's secure development process. A model's own security review is one signal, not an independent control.

Three ideas to retain:

  • Generated Code Is Untrusted Input: Fluent code should enter the same review, testing, dependency, and security process as code from any other untrusted source.
  • Happy Paths Are Not Enough: Boundary, malformed, failure, concurrent, and unauthorized cases reveal behavior that a normal example never exercises.
  • Security Needs Independent Controls: Sandboxing, least privilege, secret management, dependency review, and human inspection cannot be replaced by asking the same model to approve its output.

Key term: Sandbox means “an isolated environment that limits a program's effects.”

Sources

Key terms

Schema
A structured description of fields, types, relationships, and constraints.
Data validation
Rules that restrict or check values entered into a field or cell.
Code review
Systematic inspection of a change for correctness, clarity, security, and fit.
Threat model
A structured account of assets, attackers, entry points, and plausible harms.

Key facts

A Data Dictionary Prevents Guessing
A Data Dictionary Prevents GuessingWikimedia Commons · Christiane Wendehorst · CC BY-SA 4.0

A Data Dictionary Prevents Guessing

Field definitions, units, allowed values, and missing markers give both the model and reviewer a shared interpretation.

Profile Before Analysis
Profile Before AnalysisWikimedia Commons · Stanislav Rogozhin · Public domain

Profile Before Analysis

Counts, types, ranges, missingness, duplicates, and invalid values reveal whether a dataset is ready for a question.

Tiny Test Cases Catch Big Errors

A few rows with known outputs can reveal off-by-one ranges, wrong absolute references, and incorrect treatment of blanks.

Charts Encode Analytical Choices

Aggregation, denominator, interval, axis scale, and grouping determine what a visual comparison actually means.

Small Diffs Are Easier to Trust

A narrowly scoped patch is simpler to review, test, revert, and compare with the requested behavior.

Execution Provides Evidence

Formatting, types, tests, builds, and targeted runtime checks reveal problems that plausible-looking code can hide.

Happy Paths Are Not Enough

Boundary, malformed, failure, concurrent, and unauthorized cases reveal behavior that a normal example never exercises.

Security Needs Independent Controls
Security Needs Independent ControlsWikimedia Commons · Mmasontech · CC BY-SA 4.0

Security Needs Independent Controls

Sandboxing, least privilege, secret management, dependency review, and human inspection cannot be replaced by asking the same model to approve its output.

Matched pairs

Each item on the left goes with the one on the right.

Data dictionary
Definitions and rules for dataset fields
Unit of observation
The entity or event represented by one row
Missingness rate
The share of values absent in a field
Absolute reference
A spreadsheet reference fixed when copied
Aggregation
Combining values with a rule such as sum or average
Chart annotation
Text that explains a notable value or event
Patch
A focused set of code changes
Regression test
A test that prevents a fixed bug from returning
Static check
Analysis performed without running the program
Sandbox
An isolated environment that limits a program's effects
Secret
Sensitive credential such as a token or private key
Dependency audit
A check of third-party packages and known risks

Self-test

Answer each question from memory, then check your work against the answer key.

  1. 1. What should be stated about each row?

    1. AThe model's persona
    2. BA hidden conclusion
    3. CWhat it represents
    4. DA preferred chart color
  1. 2. What comes before a trend claim?

    1. AInvent missing values
    2. BChoose the conclusion
    3. CDelete the original
    4. DProfile and clean the data
  2. 3. How should an AI formula be checked?

    1. ATrust syntax alone
    2. BTest known small cases
    3. CHide the inputs
    4. DDelete the source data
  3. 4. What should a chart request identify?

    1. AQuestion and aggregation
    2. BOnly a color palette
    3. CA fictional expert
    4. DNo units
  4. 5. What should precede a broad code edit?

    1. ARewrite every file
    2. BInspect context and plan
    3. CAssume the API version
    4. DRemove the tests

Go deeper

Answer key

  1. 1. C What it representsThe unit of observation determines valid aggregation.
  2. 2. D Profile and clean the dataBasic quality checks protect the analysis from structural errors.
  3. 3. B Test known small casesHand-computed examples show whether the formula means what you intend.
  4. 4. A Question and aggregationThe analytical question determines the appropriate grouping and visual form.
  5. 5. B Inspect context and planThe change must fit the real repository and its constraints.

Sources

Image credits

Download all 14 lessons: PDF · EPUB