<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Script to delete problematic datapoint-values like NaN or infinte from the database]]></title><description><![CDATA[<p dir="auto">Hi together,</p>
<p dir="auto">for some unknown reasons the database has "NaN"-entries. This entries make problems with the "sum" and also with the "integral" calculations, they are simply wrong. The pattern why it happens is not clear for me, but I will check further.What I realized is, that a bunch of datapoints has the NaN-entry at the same timestamp.</p>
<p dir="auto"><strong>Now my question. How can I clean this up?</strong></p>
<p dir="auto">The available backend-scripts are not showing such examples, but it looks like this will be the best way. API did offer some methods, but it is not documented that good that I can find a way.</p>
<p dir="auto"><strong>Ideas for the script:</strong></p>
<ol>
<li>loop through all datapoints</li>
<li>query values of the first datapoint and search for NaN-values</li>
</ol>
<p dir="auto">This example query the values via sql-console, but "delete" command is not allowed here.</p>
<pre><code>SELECT * FROM POINTVALUES WHERE DATAPOINTID = 28 AND nullif(POINTVALUE, 'NaN') is null
</code></pre>
<p dir="auto">--output</p>
<pre><code>ID	DATAPOINTID	DATATYPE	POINTVALUE	TS
14134	28	3	NaN	1700760554775
19447	28	3	NaN	1700762775326
20933	28	3	NaN	1700763381424
201309	28	3	NaN	1711605424899
</code></pre>
<ol start="3">
<li>use the informations "datapointid" and "ts" to delete the values</li>
<li>go on with next datapoint.</li>
</ol>
<p dir="auto">I want to use it also for cleaning values that are infinite or out of set value ranges (extreme), but this is an second requirement.</p>
<p dir="auto">Are there some best practices and examples available?</p>
<p dir="auto">Regards<br />
Sasa</p>
]]></description><link>https://forum.mango-os.com/topic/5896/script-to-delete-problematic-datapoint-values-like-nan-or-infinte-from-the-database</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 05:49:06 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/5896.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Oct 2024 12:10:19 GMT</pubDate><ttl>60</ttl></channel></rss>