Run artifact

workspace/targets/Quakes/ANALYSIS.md

Blueprint Analysis: drydock Quakes Uat Case

Commander Expectations

Crew

CrewCharge
CommanderDefines intent and decides what done means.
Team LeadConfirms epic completeness and stakeholder expectations.
Planning CrewAuthors atomic specifications and the ordered Manifest.
Shipyard CrewBuilds the tickets without synchronous Commander access.

Story List

Feature: Feed Fetch

IDStoryHigh-level AC
FETCH-001Fetch a USGS date range to a GeoJSON fileRequest the USGS FDSN query in GeoJSON with the given dates and --min-mag (default 2.5, ordered by time ascending); write the response body unchanged to --out; print fetched,<count>
FETCH-002Fail fetch without writing on network, HTTP, or non-FeatureCollection failureOn a network error, a non-200 status, or a body that is not a GeoJSON FeatureCollection, exit 1 and write no file

Feature: Feed Reading and Validation

IDStoryHigh-level AC
READ-001Read and validate a saved GeoJSON feed fileAccept a FeatureCollection with a features array; exit 1 when the file is unreadable, not JSON, or not an object with "type": "FeatureCollection" and features
READ-002Read event fields and exclude null-magnitude eventsRead id, properties.mag, properties.place, properties.time, properties.tsunami, and geometry.coordinates; exclude features whose mag is null from every report
READ-003Apply the --min-mag filter across all reportsKeep only events with mag >= m in every report command

Feature: Summary Report

IDStoryHigh-level AC
SUM-001Summarize events with count, time span, magnitude range, mean, and tsunami countOutput header events,first,last,min_mag,max_mag,mean_mag,tsunami; mean rounded half-up to two decimals; with no events output 0,,,,,,0

Feature: Top Events Report

IDStoryHigh-level AC
TOP-001List the largest events with --n countOutput time,mag,depth_km,place,id sorted by magnitude descending then time ascending; --n defaults to 10 and must be a positive integer

Feature: Daily Report

IDStoryHigh-level AC
DAY-001Report event count and maximum magnitude per UTC dateOutput date,events,max_mag per date with events, ascending, followed by TOTAL,<events>,<max_mag>; with no events output TOTAL,0,

Feature: Regions Report

IDStoryHigh-level AC
REG-001Report event count and maximum magnitude per regionRegion is the text after the last , in place (or whole place; null place is Unknown); output region,events,max_mag ordered by events descending then region ascending

Feature: Distance Search

IDStoryHigh-level AC
NEAR-001List events within a haversine radius of a pointValidate --lat, --lon, --radius (all required); compute haversine distance on a 6371.0 km sphere; output distance_km,time,mag,place,id for events at most --radius km, distance ascending then time ascending

Feature: Command Interface and Exit Codes

IDStoryHigh-level AC
CLI-001Dispatch commands and validate optionsCommand first, options in any order, file last; unknown commands or options, malformed values, and missing or extra file exit 2
CLI-002Map failures to documented exit codes and silent stdoutExit 0 on success including empty reports; exit 1 for operational failures; exit 2 for usage errors; a failing command writes nothing to stdout and one diagnostic line to stderr

Feature: Output Formatting

IDStoryHigh-level AC
FMT-001Format CSV output with UTC times, decimal precision, and UTF-8Times as YYYY-MM-DDTHH:MM:SSZ truncated to seconds; magnitudes one decimal; mean_mag two decimals; distances one decimal; CSV via Python csv module with \n line endings and UTF-8

Feature: Test Suite

IDStoryHigh-level AC
TEST-001Provide a POSIX bin/test.sh running the pytest suitebin/test.sh runs the application's pytest suite from the application root and exits zero only when every test passes

Story Guidance

Named stories planning must produce. Authoritative record: STORY_GUIDANCE.json.

None.

Surfaced Acceptance Criteria

IDStory IDCriterion
AC-001FETCH-001fetch writes the response body byte-for-byte to --out and prints exactly fetched,<count> where count is the number of features
AC-002FETCH-001--min-mag defaults to 2.5 when omitted from fetch
AC-003FETCH-002fetch on failure leaves any pre-existing output file path untouched by writing no file
AC-004READ-002A feature with mag null is absent from every report, including counts
AC-005SUM-001summary first and last are the earliest and latest event times in the filtered set
AC-006SUM-001summary tsunami counts events whose tsunami value equals 1
AC-007TOP-001top --n default is 10 when omitted
AC-008DAY-001daily date is the first 10 characters of the UTC time string
AC-009REG-001A null place is reported under region Unknown
AC-010NEAR-001near rows whose distance is exactly --radius are included
AC-011CLI-001An option the command does not list is a usage error (exit 2)
AC-012CLI-002Standard error is never compared by the grader; the diagnostic line is written only on failure
AC-013FMT-001Place names containing commas are quoted by the csv module; non-ASCII place names are written as UTF-8

Source Inventory

PathContent kindDispositionReason
sources/INSTRUCTIONS.mdmarkdownanalyzedreadable UTF-8
sources/quakes_2025-01-01_07.geojsontextanalyzedreadable UTF-8
sources/run.shcodeanalyzedreadable UTF-8

Relationship Model

Source or groupRelationship typeRelated source or groupEvidenceDelivery implication
sources/INSTRUCTIONS.mdinstruction-to-testsources/run.shINSTRUCTIONS.md "Run Harness" states run.sh is the scoring entry point with 26 checksrun.sh must be staged; the application must produce ./quakes at its root
sources/run.shtest-kit-to-implementationquakes executable at application rootrun.sh BIN="$APP/quakes" and check invocationsthe executable named quakes must exist and be executable at the application root
sources/quakes_2025-01-01_07.geojsonfixture-to-implementationrun.sh report checksrun.sh QUAKES variable and known answersthe snapshot must be staged alongside run.sh; reports are computed from it
sources/INSTRUCTIONS.mdinstruction-to-testbin/test.sh (application)INSTRUCTIONS.md "Tests" sectionapplication-authored pytest suite is required; it is not a supplied file
READ-002parser-to-normalizerSUM-001, TOP-001, DAY-001, REG-001, NEAR-001INSTRUCTIONS.md "Reading a file" steps 2 to 6every report depends on the shared feature reader
FETCH-001dependencyFETCH-002INSTRUCTIONS.md "fetch" sectionFETCH-002 failure behavior extends the same request path

Source Roles

PathRolePlan dispositionBuild disposition
sources/INSTRUCTIONS.mdauthor intentcompassprompt-only
sources/run.shconformance harnesscontextstage
sources/quakes_2025-01-01_07.geojsonassetcontextstage

Planning Instructions

Delivery Shape

The system is a single-process Python 3.11+ command-line tool named quakes, installed at the application root. Inputs are USGS FDSN HTTP responses (via fetch) and saved GeoJSON files (via report commands). Outputs are a saved GeoJSON file (fetch) and CSV reports on standard output. Execution flow: fetch writes a file; each report reads that file, validates it, filters by --min-mag, computes its rows, and prints CSV.

Story Realization Map

Story IDDurable scopeEvidenceRelated filesRequires
FETCH-001fetch request and file writeINSTRUCTIONS.md fetchquakes executablecapability, stubbed HTTP in tests
FETCH-002fetch failure pathsINSTRUCTIONS.md fetch, Operational failurequakes executablecapability, stubbed HTTP in tests
READ-001file validationINSTRUCTIONS.md "Reading a file" step 1quakes executablecapability
READ-002event field extraction and null-mag exclusionINSTRUCTIONS.md "Reading a file" steps 2 to 3quakes executable; snapshotcapability
READ-003filter applicationINSTRUCTIONS.md "Reading a file" step 4quakes executablecapability
SUM-001summary reportINSTRUCTIONS.md "Reports" tablequakes executable; snapshotcapability, test harness
TOP-001top reportINSTRUCTIONS.md "Reports" tablequakes executable; snapshotcapability, test harness
DAY-001daily reportINSTRUCTIONS.md "Reports" tablequakes executable; snapshotcapability, test harness
REG-001regions reportINSTRUCTIONS.md "Reading a file" step 6, "Reports" tablequakes executable; snapshotcapability, test harness
NEAR-001near report and haversineINSTRUCTIONS.md "Distance" sectionquakes executable; snapshotcapability, test harness
CLI-001argument parsingINSTRUCTIONS.md "Commands" sectionquakes executablecapability
CLI-002exit codes and stdout/stderr disciplineINSTRUCTIONS.md "Exit codes" tablequakes executablecapability
FMT-001CSV and number formattingINSTRUCTIONS.md "Formatting" sectionquakes executablecapability
TEST-001pytest suite and bin/test.shINSTRUCTIONS.md "Tests" sectionbin/test.sh; pytest suitetest harness

Test and Acceptance Strategy

Focused story tests are pytest cases under the application that run each report against small files written by the tests, and exercise fetch through a stubbed HTTP call. Final Sea Trial verification runs sh sources/run.sh against the completed application, which checks 26 report and error cases against the frozen snapshot. The terminal verification story gates on the complete supplied suite via sh sources/run.sh; bin/test.sh is required to run the full application test suite unfiltered.

Sequencing and Dependencies

Source Conflicts and Gaps

Analysis Notes

generated: 2026-10-24 blueprint: /mnt/c/Users/barlo/projects/drydock/uat/Quakes/runs/20261025.010423/workspace/targets/Quakes/blueprint

Quality: Ready blockers: 0 questions: 0 features: 9 stories: 16 stack: Python 3.11+ standard library; pytest for tests; urllib.request for HTTP display_name: not proposed short_description: not proposed

Observations: Resolved by narrowest reading: --n applies only to top; near ranking uses the same ordering rule as other reports; fetch leaves an existing output file untouched on failure.