Skip to content

Commit 988d550

Browse files
author
Doug Schmidt
committed
PF-1205 - Added some documentation for PointZilla notes
1 parent ba88192 commit 988d550

File tree

1 file changed

+75
-7
lines changed
  • TimeSeries/PublicApis/SdkExamples/PointZilla

1 file changed

+75
-7
lines changed

TimeSeries/PublicApis/SdkExamples/PointZilla/Readme.md

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ A few interesting operations include:
3737
- [Appending points from Excel](#appending-values-from-an-excel-spreadsheet)
3838
- [Appending points from a database](#appending-values-from-a-database-query)
3939
- [Appending points with grades or qualifiers](#appending-grades-and-qualifiers)
40+
- [Appending points with notes](#appending-points-with-notes)
4041
- [Copy points from another time-series](#copying-points-from-another-time-series)
4142
- [Copy points from a separate AQTS system](#copying-points-from-another-time-series-on-another-aqts-system)
4243
- [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
215216

216217
PointZilla can also execute a database query and import the results from the query as a time-series.
217218

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.
219220

220221
| DbOption | Description |
221222
|---|---|
222223
| `-DbType=type` | The database connection type.<br/>Must be one of `SqlServer`, `Postgres`, `MySql`, or `Odbc`. |
223224
| `-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. |
225227

226228
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.
227229

@@ -322,14 +324,31 @@ Ex. If your source file defines grades from 1 (best) to 5 (worst), and 6 through
322324
# Map all the weird grades to the stock AQTS Unusable grade of -2
323325
/MappedGrades=6,10:-2
324326
```
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.
325338

326339
## Copying points from another time-series
327340

328341
When the `/SourceTimeSeries` option is set, the corrected point values from the source time-series will be copied to the target `/TimeSeries`.
329342

330343
Unlike the target time-series, which are restricted to basic or reflected time-series types, a source time-series can be of any type.
331344

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.
333352

334353
```sh
335354
$ ./PointZilla.exe -server=myserver Stage.Label@MyLocation -sourceTimeSeries=Stage.Working@OtherLocation
@@ -401,6 +420,54 @@ ISO 8601 UTC, Value, Grade, Qualifiers
401420
1954-06-10T21:00:00Z, 27.3137423987, 0,
402421
```
403422

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.
430+
431+
```
432+
# [email protected] generated by PointZilla v1.0.331.0
433+
#
434+
# Time series identifier: Stage.Label@MyLocation
435+
# Location: MyLocation
436+
# UTC offset: (UTC-07:00)
437+
# Value units: m
438+
# Value parameter: Stage
439+
# Interpolation type: InstantaneousValues
440+
# Time series type: ProcessorDerived
441+
#
442+
# 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.
454+
455+
```
456+
# [email protected] generated by PointZilla v1.0.331.0
457+
#
458+
# Time series identifier: Stage.Label@MyLocation
459+
# Location: MyLocation
460+
# UTC offset: (UTC-07:00)
461+
#
462+
# 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+
404471
## Comparing the points in two different time-series
405472

406473
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.
@@ -415,7 +482,7 @@ $ diff system1/[email protected] system2/Stage.Primary@Lo
415482

416483
## Deleting all points in a time-series
417484

418-
The `DeleteAllPoints` command can be used to delete the entire record of point values from a time-series.
485+
The `DeleteAllPoints` command can be used to delete the entire record of point values and notes from a time-series.
419486

420487
```sh
421488
$ ./PointZilla.exe -server=myserver Stage.Label@MyLocation deleteallpoints
@@ -429,7 +496,7 @@ With great power ... yada yada yada. Please don't wipe out your production data
429496

430497
## Deleting a range of points in a time-series
431498

432-
You can delete a range of points in a basic or reflected time-series by:
499+
You can delete a range of points and notes in a basic or reflected time-series by:
433500
- specifying the `DeleteTimeRange` command
434501
- specifying the `/TimeRange=startTime/endTime` option to define the exact time range to be replaced with no points at all
435502

@@ -476,8 +543,8 @@ Supported -option=value settings (/option=value works too):
476543
-MappedQualifiers Qualifier mapping in sourceValue:mappedValue syntax. Can be set multiple times.
477544
-ManualNotes Set a time-series note, in StartTime/EndTime/NoteText format. Can be set multiple times.
478545
-CsvNotesFile Load time-series notes from a file with StartTime, EndTime, and NoteText columns.
479-
-NoteStartField CSV column index or name for note start times [default: Start]
480-
-NoteEndField CSV column index or name for note end times [default: End]
546+
-NoteStartField CSV column index or name for note start times [default: StartTime]
547+
-NoteEndField CSV column index or name for note end times [default: EndTime]
481548
-NoteTextField CSV column index or name for note text [default: NoteText]
482549
483550
========================= Time-series creation options:
@@ -547,6 +614,7 @@ Supported -option=value settings (/option=value works too):
547614
548615
========================= CSV saving options:
549616
-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]
550618
-StopAfterSavingCsv When true, stop after saving a CSV file, before appending any points. [default: False]
551619
552620
Use the @optionsFile syntax to read more options from a file.

0 commit comments

Comments
 (0)