# Choose a diagram

Six coastal survey examples. Render in a compatible Mermaid viewer.

## Flowchart: follow a decision

What should happen when a survey reading arrives?

```mermaid
flowchart LR
  A[Receive reading] --> B{Valid?}
  B -->|Yes| C[Archive]
  B -->|No| D[Calibrate]
  D --> A
```

Valid readings enter the archive; failed checks return to calibration.

Try: Change “Calibrate” to “Review sensor” and check that both branches still lead somewhere.

## Sequence: explain a handoff

Who sends each message, and in what order?

```mermaid
sequenceDiagram
  participant F as Field team
  participant S as Station
  participant A as Archive
  F->>S: Submit sample
  S->>A: Store reading
  A-->>S: Saved
  S-->>F: Receipt
```

The field team sends a sample to the station; the station archives it before acknowledging receipt.

Try: Add a timeout response after “Submit sample” and explain what the field team should do next.

## State: show allowed changes

Which conditions can a survey occupy?

```mermaid
stateDiagram-v2
  [*] --> Planned
  Planned --> Active: launch
  Active --> Paused: weather
  Paused --> Active: resume
  Active --> Review: finish
  Review --> [*]
```

A planned survey becomes active, can be paused and resumed, then ends in review.

Try: Add a Cancelled state from Planned. Decide whether cancellation should also be possible while active.

## Mind map: explore a subject

What belongs under the coastal survey?

```mermaid
mindmap
  root((Coastal survey))
    Instruments
      Camera
      Thermometer
    Evidence
      Readings
      Field notes
    Decisions
      Sampling interval
      Launch window
```

The survey branches into instruments, evidence and decisions before a linear report is written.

Try: Replace the branches with the questions for your own project. Keep labels short enough to scan.

## Gantt: expose duration and dependency

Which work must finish before the next task starts?

```mermaid
gantt
  title Survey preparation
  dateFormat YYYY-MM-DD
  axisFormat %b %d
  tickInterval 1day
  section Work
  Calibration :a, 2026-11-02, 2d
  Collection :b, after a, 3d
  Review :after b, 1d
```

Calibration takes two days; collection follows it, then review follows collection.

Try: Extend calibration by a day. Check which tasks move because their start is expressed as a dependency.

## Relationship: model records

How do stations, readings and instruments relate?

```mermaid
erDiagram
  STATION ||--o{ READING : records
  INSTRUMENT ||--o{ READING : produces
  STATION {
    string name
  }
  READING {
    datetime captured
    float value
  }
  INSTRUMENT {
    string model
  }
```

A station has many readings; each instrument produces many readings.

Try: Add a UNIT entity or a unit field. Decide which choice makes the meaning of each value clearer.
