Skip to content

Dev: Write up database core tables and schema - #6

Open
naman0r wants to merge 13 commits into
mainfrom
3-db-schema
Open

naman0r wants to merge 13 commits into
mainfrom
3-db-schema

Conversation

@naman0r

@naman0r naman0r commented Sep 24, 2026 •

Copy link
Copy Markdown

Database schema

Closes #3

📝 Description

Work in progress. This PR will carry the reviewed database core tables and schema for BHO, based on the product spec and the example data (daily observation sheets, F-6, hourly precipitation, daily records, narratives).

The schema is being drafted in a shared doc for team review first; this PR will be updated once the tables are agreed on.

✔️ Verification

no verification

🏕️ (Optional) Future Work / Notes

Open questions for the team (location of the full 141-year daily archive, normals data, canonical units, trace/missing value handling) will be listed here once the doc is shared.

  • hourly_observations.mountainVis (column K, "Mnts VSBL", e.g. 1@1.5) stays text for now. Per the client, it is mountain number @ visibility on a 1-3 scale. Once the weather group sends which number is which mountain, split it into mountainId and mountainVisibility, with a mountains lookup table rather than an enum. Still unknown: whether one cell can list more than one mountain.

Comment thread docs/database-schema.md Outdated

## imports

Source: the app, one row per uploaded spreadsheet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add note that these are irrevocable/unmodifiable, logs

Comment thread docs/database-schema.md Outdated
naman0r and others added 11 commits October 5, 2026 18:36
Entities and generated migration for users, imports, daily/hourly/scheduled
observations, daily records and audit log, plus docs/database-schema.md
mapping each column to its source cell in the example sheets.
Client confirmed more stations are coming, so stationId joins the keys of
the three daily tables now rather than in a later migration. Every row
comes from an upload, so importId is not null on observations and records.
Keying records by station now avoids changing their primary key later if
records become per-station. The hourly notes now say what column H's
fractions and column I's weather codes mean.
@naman0r
naman0r marked this pull request as ready for review October 6, 2026 01:14
github-actions Bot added a commit that referenced this pull request Oct 6, 2026

@Rayna-Yu Rayna-Yu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Non-blocking: One thing to note though, is I think pg parses a Postgres date at the server's local midnight. So that would be UTC in Lambda and Eastern for our laptops. This shouldn't be an issue because we are planning on running everything in Lambdas anyways, but something that we may need to be careful about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev : Write up database core tables and schema

3 participants