<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Local Database on SAFER Documentation</title><link>https://safer-capstone.pages.dev/developer-docs/overview/schemas/</link><description>Recent content in Local Database on SAFER Documentation</description><generator>Hugo</generator><language>en</language><atom:link href="https://safer-capstone.pages.dev/developer-docs/overview/schemas/index.xml" rel="self" type="application/rss+xml"/><item><title>CPM History</title><link>https://safer-capstone.pages.dev/developer-docs/overview/schemas/cpm-history/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://safer-capstone.pages.dev/developer-docs/overview/schemas/cpm-history/</guid><description>&lt;h1 id="cpm-history-schema"&gt;CPM History Schema&lt;/h1&gt;
&lt;h2 id="database"&gt;Database&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;File: &lt;code&gt;weather_cache.db&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Engine: &lt;code&gt;expo-sqlite&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="table-cpm_history"&gt;Table: &lt;code&gt;cpm_history&lt;/code&gt;&lt;/h2&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Column&lt;/th&gt;
 &lt;th&gt;Type&lt;/th&gt;
 &lt;th&gt;Null&lt;/th&gt;
 &lt;th&gt;Notes&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;cpm&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;REAL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;NOT NULL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;One computed CPM value per successful minute tick.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;timestamp&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;INTEGER&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;NOT NULL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Epoch milliseconds when the value was recorded.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="data-invariants"&gt;Data Invariants&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Each row stores only &lt;code&gt;cpm&lt;/code&gt; and &lt;code&gt;timestamp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Values must be finite numbers (&lt;code&gt;insertCpmRow&lt;/code&gt; validates inputs).&lt;/li&gt;
&lt;li&gt;Retention is capped at 40 rows; oldest rows are removed first on insert overflow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="access-patterns"&gt;Access Patterns&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Insert and bounded retention: &lt;code&gt;insertCpmRow(cpm, timestamp?)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Recent read window: &lt;code&gt;getRecentCpmRows(sinceTimestamp, limit)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Read ordering: newest first (&lt;code&gt;ORDER BY timestamp DESC, rowid DESC&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Weather Caching</title><link>https://safer-capstone.pages.dev/developer-docs/overview/schemas/weather-cache/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://safer-capstone.pages.dev/developer-docs/overview/schemas/weather-cache/</guid><description>&lt;h1 id="weather-cache-schema"&gt;Weather Cache Schema&lt;/h1&gt;
&lt;h2 id="database"&gt;Database&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;File: &lt;code&gt;weather_cache.db&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Engine: &lt;code&gt;expo-sqlite&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Journal mode: &lt;code&gt;WAL&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="table-forecast_points"&gt;Table: &lt;code&gt;forecast_points&lt;/code&gt;&lt;/h2&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Column&lt;/th&gt;
 &lt;th&gt;Type&lt;/th&gt;
 &lt;th&gt;Null&lt;/th&gt;
 &lt;th&gt;Notes&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;cell_id&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;TEXT&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;NOT NULL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Spatial cache bucket key from lat/lon.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;forecast_time&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;TEXT&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;NOT NULL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Canonical UTC hour key (&lt;code&gt;toHourKey(...)&lt;/code&gt;).&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;valid_to&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;INTEGER&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;NOT NULL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Expiration timestamp in epoch milliseconds.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;payload&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;TEXT&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;NOT NULL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;JSON-serialized &lt;code&gt;WeatherPoint&lt;/code&gt;.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;last_accessed&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;INTEGER&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;NOT NULL&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Epoch milliseconds for LRU eviction.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Primary key:&lt;/p&gt;</description></item></channel></rss>