You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TimeSeries/PublicApis/SdkExamples/PointZilla/Readme.md
+75-7Lines changed: 75 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ A few interesting operations include:
37
37
-[Appending points from Excel](#appending-values-from-an-excel-spreadsheet)
38
38
-[Appending points from a database](#appending-values-from-a-database-query)
39
39
-[Appending points with grades or qualifiers](#appending-grades-and-qualifiers)
40
+
-[Appending points with notes](#appending-points-with-notes)
40
41
-[Copy points from another time-series](#copying-points-from-another-time-series)
41
42
-[Copy points from a separate AQTS system](#copying-points-from-another-time-series-on-another-aqts-system)
42
43
-[Delete all the points from a time-series](#deleting-all-points-in-a-time-series)
@@ -215,13 +216,14 @@ You can use the `/ExcelSheetNumber=integer` or `/ExcelSheetName=name` options to
215
216
216
217
PointZilla can also execute a database query and import the results from the query as a time-series.
217
218
218
-
Three new options control the type of DB connection and the query to execute.
219
+
Four options control the type of DB connection and the query to execute.
219
220
220
221
| DbOption | Description |
221
222
|---|---|
222
223
|`-DbType=type`| The database connection type.<br/>Must be one of `SqlServer`, `Postgres`, `MySql`, or `Odbc`. |
223
224
|`-DbConnectionString=connectionString`| The connection string, the syntax of which varies by DB type.<br/><br/>See [https://www.connectionstrings.com/](https://www.connectionstrings.com/) for plenty of examples. |
224
-
|`-DbQuery=queryToExecute`| The SQL query to execute, in one of two forms:<br/><br/>**Inline SQL:** (the entire SQL query as a single line of text)<br/>`-DbQuery="select Time, Value from Sensor where Parameter='HG' and Location='Loc33' order by Time"`<br/><br/>**External SQL File:** (an @ sign, followed by a path to the SQL file)<br/>`-DbQuery=@somePath\myQuery.sql`|
225
+
|`-DbQuery=queryToExecute`| The SQL query to execute, in one of two forms:<br/><br/>**Inline SQL:** (the entire SQL query as a single line of text)<br/>`-DbQuery="SELECT Time, Value FROM Sensor WHERE Parameter='HG' AND Location='Loc33' ORDER BY Time"`<br/><br/>**External SQL File:** (an @ sign, followed by a path to the SQL file)<br/>`-DbQuery=@somePath\myQuery.sql`|
226
+
|`-DbNotesQuery=queryToExecute`| An optional query to fetch notes using time ranges.<br/><br/>The query should produce the columns named by the `/NoteStartField`, `/NoteEndField`, `/NoteTextField` options.<br/><br/>`/DbNotesQuery="SELECT StartTime, EndTime, NoteText FROM ExternalNotes"`<br/><br/>Both **inline SQL** and **external SQL files** are supported here as well. |
225
227
226
228
The remaining CSV parsing field options can be used to specify the result columns, by index or by name, to use for constructing the points.
227
229
@@ -322,14 +324,31 @@ Ex. If your source file defines grades from 1 (best) to 5 (worst), and 6 through
322
324
# Map all the weird grades to the stock AQTS Unusable grade of -2
323
325
/MappedGrades=6,10:-2
324
326
```
327
+
## Appending points with notes
328
+
329
+
PointZilla v1.0.332+ adds comprehensive support for dealing with time-series notes.
330
+
331
+
Time-series notes have a start time, and end time, and a text value. Notes can overlap in time, meaning more than one note can apply to any given point (just like qualifiers).
332
+
333
+
- Notes can be read from a source time-series in the same or separate AQTS system.
334
+
- Notes can be read from a CSV, Excel, or database column using the `/CsvNotesField=indexOrName` option.
335
+
- Notes can be read from a separate CSV file using the `/CsvNotesFile=path`, `/NoteStartField=`, `/NoteEndField=`, and `/NoteTextField=` options.
336
+
- Notes can be read from a separate database query using the `/DbNotesQuery=query`, `/NoteStartField=`, `/NoteEndField=`, and `/NoteTextField=` options.
337
+
- Note support can be disabled by setting the `/IgnoreNotes=true` option.
325
338
326
339
## Copying points from another time-series
327
340
328
341
When the `/SourceTimeSeries` option is set, the corrected point values from the source time-series will be copied to the target `/TimeSeries`.
329
342
330
343
Unlike the target time-series, which are restricted to basic or reflected time-series types, a source time-series can be of any type.
331
344
332
-
The `/SourceQueryFrom` and `/SourceQueryTo` options can be used to restrict the range of points copied. When omitted, the entire record will be copied.
345
+
- Corrected point values will be copied
346
+
- Corrected point grade codes will be copied, unless the `/IgnoreGrades=true` option is set.
347
+
- Corrected point qualifier codes will be copied, unless the `/IgnoreQualifiers=true` option is set.
348
+
- Corrected point notes will be copied, unless the `/IgnoreNotes=true` option is set.
349
+
- The correction history of the source series will be converted into time-series notes in the destination series, unless the `/IgnoreNotes=true` option is set.
350
+
351
+
The `/SourceQueryFrom` and `/SourceQueryTo` options can be used to restrict the range of points and metadata copied. When omitted, the entire record will be copied.
@@ -401,6 +420,54 @@ ISO 8601 UTC, Value, Grade, Qualifiers
401
420
1954-06-10T21:00:00Z, 27.3137423987, 0,
402
421
```
403
422
423
+
### Exporting the notes from a time-series
424
+
425
+
The `/SaveNotesMode=Disabled|WithPoints|SeparateCsv` option controls how any loaded notes are exported.
426
+
427
+
By default, the `/SaveNotesMode=Disabled` option is assumed, since dealing with multi-line notes in CSV files can be tricky for some external tools. PointZilla follows the de-facto CSV standard of enclosing any text in double quotes `"` and allowing the text to span multiple lines. But there is no true CSV standard for this feature and many popular tools (*cough* Excel! *cough*) can easily be confused when a line of text spans multiple lines.
428
+
429
+
The `/SaveNotesMode=WithPoints` option will add a fifth column, named "Notes" to the CSV file, and append all the notes in effect at any given time. `WithPoints` mode can quickly explode the size of the exported CSV file, since a year long note of the 20-character note "This data is suspect" applied to a 15-minute signal will create 35,000 copies of that note, taking roughly 770KB to do so.
# Export options: Corrected signal from StartOfRecord to EndOfRecord
443
+
#
444
+
# CSV data starts at line 15.
445
+
#
446
+
ISO 8601 UTC, Value, Grade, Qualifiers, Notes
447
+
1954-06-08T21:00:00Z, 33.3375062721, 0, This data is suspect
448
+
1954-06-09T21:00:00Z, 30.2475987522, 0, This data is suspect
449
+
1954-06-10T21:00:00Z, 27.3137423987, 0, This data is suspect
450
+
...
451
+
```
452
+
453
+
The `/SaveNotesMode=SeparateCsv` option will export the notes into a separate "**.Notes.csv" file, using just a single line to represent the year-long comment. This yields the smallest CSV export, but with the trade-off of required two files per series.
# Export options: Corrected signal notes from StartOfRecord to EndOfRecord
463
+
#
464
+
# CSV data starts at line 11.
465
+
#
466
+
StartTime, EndTime, NoteText
467
+
1950-01-01T00:00:00Z, 2005-04-01T00:00:00Z, This data is suspect
468
+
...
469
+
```
470
+
404
471
## Comparing the points in two different time-series
405
472
406
473
This builds on the previous export scenario, to export two series to two CSV files, and then use standard text differencing tools to see if anything is different.
@@ -547,6 +614,7 @@ Supported -option=value settings (/option=value works too):
547
614
548
615
========================= CSV saving options:
549
616
-SaveCsvPath When set, saves the extracted/generated points to a CSV file. If only a directory is specified, an appropriate filename will be generated.
617
+
-SaveNotesMode Controls how extracted notes are save. Should be one of: Disabled, WithPoints, SeparateCsv [default: Disabled]
550
618
-StopAfterSavingCsv When true, stop after saving a CSV file, before appending any points. [default: False]
551
619
552
620
Use the @optionsFile syntax to read more options from a file.
0 commit comments