vialfile

Vial inventory & cost

Running out mid-cycle is a safety failure — a sudden taper of a GH secretagogue or a scramble to split doses across vials of different concentrations. This page tracks every vial you own, pulls in your injection log to estimate remaining mg, and compares the total to your active stack's burn rate. If you've got less than a week of supply, it tells you.

Supply per peptide

Your vials

How burn-rate is computed

  1. Open vials sort oldest-first. The injection log's entries (timestamped after your oldest open vial's open date) are allocated FIFO — the first vial drains until empty, then overflow goes to the next.
  2. Sealed vials count toward total mg in hand. They don't get allocated log use until you mark them open.
  3. Daily burn comes from your active stack. The stack item's doseMcg × the peptide library's typical frequency (daily, 2x-weekly, etc.). Without an active stack, the math is skipped and you see "set an active stack to compute."
  4. Running-out threshold = 7 days. Low = 7–14 days. Above 14 = ok. The warning at the top lists every peptide in the running-out bucket.

Inventory FAQ

What's the "Used ~7.5mg over last 30 days" line under a peptide card?

It's your observed consumption for the trailing 30 days, summed straight from your injection log — no projections, no stack assumptions. Every log entry for that peptide within the window (timestamp ≤ now, timestamp > 30 days ago) with a positive dose and a recorded route is counted. The number is in mg (mcg ÷ 1000). The "~" prefix is honest about minor imprecision: entries recorded with slightly wrong timestamps still get counted if they're in the window. The line hides when there's no qualifying log activity so a peptide with zero injections in the past month doesn't show a confusing "Used ~0mg" line. Compare this number to the projected burn rate from your active stack to spot dose-schedule drift — if you're logging 5 mg/month but your stack projects 10 mg/month, you're under-dosing relative to protocol.

What's the "BPC-157 cost/mg: $8.40 → $9.60 → $10.40 (8 vials, +24% trend)" line under a peptide card?

It's a supplier-price-drift cue: under each per-peptide summary card, when you've logged at least 3 vials of that peptide with a non-zero costUsd, this line shows the per-mg price for the oldest, middle, and newest purchase, plus the overall trend percentage. Below 3 vials the line hides — one or two data points is noise, not a pattern. The numbers normalize to cost per mg (vial cost ÷ mgInVial) so a 5 mg vial @ $40 and a 10 mg vial @ $80 read as the same $8/mg supplier price; raw vial cost across SKUs would create a noisy false trend. The middle value comes from the chronological median position (floor((N − 1) / 2)) so for 8 vials it's the 4th-oldest. Trend percentage is the rounded ((newest − oldest) ÷ oldest) × 100 — positive numbers prefix "+", zero prints as "0%", negative numbers carry their own minus. Vials without a recorded cost (costUsd = 0) are excluded entirely so a partial-data peptide doesn't get an artificially-low first value.

What's the "Will need to open next vial in ~3d" line under a vial?

It's a refill-cycle nudge: under the open vial you're currently drawing from, when there's a sealed sibling waiting AND your active stack gives a positive daily burn, this projects how many days the open vial has left. Computed as round((mgInVial − mgUsed) ÷ dailyMgBurn), minimum 1 day (the "~" prefix makes that approximation honest). Only attaches to the newest-opened vial in each peptide group — older opens (rare) will empty mid-stream while you keep drawing from the newest, so opening a sealed isn't required at that moment. Hides entirely when there's no sealed sibling, no active stack, or the vial is full enough not to matter. Mirrors the FIFO oldest-opened-first allocation rule the rest of the page is built on.

What's the "Log says these vials have used more than you recorded" panel?

Your injection log is the authoritative record of what was actually drawn. Each vial's mgUsed is an eyeball estimate that drifts — you forget to update it after a dose, a week later it's off. The preview panel runs the FIFO oldest-opened-first allocation (same rule your days-of-supply uses) over the log against each open vial and shows where the log says you've drawn more than you recorded. One click applies the log-derived number, routing through the same setVialUsed the manual "Record use" button uses. Never reduces mgUsed; never over-allocates past vial capacity; only appears for vials where something would actually change.

Does inventory write to my injection log?

No. Inventory is a read-only consumer of vialfile-log-v1, the same pattern the stack and bloodwork pages use. Your log entries stay user-authored; inventory looks at them without touching.

What if my injection log doesn't match the log-derived mg used?

Manual mgUsed on each vial is treated as a floor — if you record 2 mg used manually, the FIFO allocation starts at 2 mg. If the log contains more doses than the manual number, the log takes over. If it contains fewer (e.g. you didn't log every dose), the manual floor is preserved.

Why FIFO oldest-opened?

Real pharmacy behavior: you finish the vial you opened first before opening the next. FIFO makes the running-out estimate refer to the vial you're actively drawing from, not the average across all open vials. When the oldest fills to capacity, overflow bumps into the next.

What counts as "running out"?

Fewer than 7 days of supply at the active-stack burn rate. The warning surface at the top of the page lists every peptide in this state. 7–14 days = "low" (grey-warn badge but no top banner). More than 14 days = ok.

Why isn't inventory in the backup file?

The backup file covers injections, side-effects, and bloodwork — the three user-authored logs. Inventory is recoverable from receipts and the injection log; losing it is a rebuild afternoon, not years of history. A future backup version may include it; for now, v1 stays stable.

What if I don't have an active stack?

The per-peptide summary shows mg in hand and total cost, but days-of-supply is blank ("set an active stack to compute"). Go to the stack page and mark one active to light up the supply math.