TER1 (Statement): 97.22%
TER2 (Branch): 100.00%
TER3 (LCSAJ): 100.0% (3/3)
Approximate LCSAJ segments: 9
● Covered — this LCSAJ path was executed during testing.
● Not covered — this LCSAJ path was never executed. These are the paths to focus on.
Multiple dots on a line indicate that multiple control-flow paths begin at that line. Hovering over any dot shows:
start → end → jump
Uncovered paths show [NOT COVERED] in the tooltip.
1: package Database::BI::Tutorial; 2: 3: use strict; 4: use warnings; 5: 6: our $VERSION = '0.025.0'; 7: 8: # --------------------------------------------------------------------------- 9: # The tutorial that the application shows at GET /tutorial. 10: # 11: # This is deliberately data, not a long HTML file. A chapter is one feature, 12: # and adding a feature means adding one hash to @CHAPTERS. The template 13: # (templates/web/en/tutorial.html.tt) knows how to show every field, so a new 14: # chapter needs no template change. 15: # 16: # To add a chapter: 17: # 1. Copy the shape of a chapter below. 18: # 2. Give it a unique id, a part, a title, a one-sentence lead and short 19: # numbered steps. 20: # 3. List the GET page routes that it covers in routes => [ ... ]. 21: # t/tutorial.t fails when a GET page in lib/Database/BI.pm has no 22: # chapter, so this list is a reminder that cannot be forgotten. 23: # 4. Use short sentences and common words. The test also fails a lead, 24: # step or tip that is longer than 25 words. 25: # 26: # A route that is not a page for readers (JSON for a panel, for example) goes 27: # in %EXEMPT_ROUTES with a reason, instead of getting a chapter. 28: # --------------------------------------------------------------------------- 29: 30: my @INTRO = ( 31: 'Database::BI shows data files as tables and charts in your web browser.', 32: 'It reads your files. It does not change them. Export writes a new file; it does not change the source.', 33: 'You do not need to know Perl or any other programming language to use this tutorial.', 34: 'This page uses the same words that you see on the screen.', 35: 'The data folder contains example files. You can use them to try the steps.', 36: 'A few chapters have a Walk through box: follow it on screen to learn a hard idea.', 37: 'New here? Read Open your first data file and A five-minute tour first. They take about ten minutes.', 38: 'The examples use three files in the data folder: sales, virginia_counties and store.', 39: 'A word in bold type or a button name, such as Apply, is shown on the screen exactly as written.', 40: 'You cannot break your data. Nothing here changes your files, so try things and click Home to start again.', 41: 'The chapters under For maintainers are for the person who installs the program. You can skip them.', 42: 'If a word is new to you, look it up in the Glossary at the end of this page.', 43: ); 44: 45: my @CHAPTERS = ( 46: 47: # --------------------------------------------------------------- 48: # First steps 49: # --------------------------------------------------------------- 50: { 51: id => 'open-file', 52: part => 'First steps', 53: title => 'Open your first data file', 54: lead => 'The home page shows the data files that the program can read.', 55: steps => [ 56: 'The program must be running first. If someone else set it up, ask them for its address. It is usually http://localhost:3000.', 57: 'If you run it yourself, type script/database-bi in a terminal, in the program folder. Leave that window open.', 58: 'Open the address in your web browser, for example Firefox or Chrome. Type it in the address bar at the top.', 59: 'Find a file card. The card shows the name of a data file.', 60: 'Click the card. The file opens as a table: a grid of rows and columns, like a spreadsheet.', 61: 'You can also drop a file from your computer onto the page. The program opens it at once.', 62: ], 63: tip => 'The program reads CSV, TSV, PSV, XLSX, XML, JSON, SQLite and Berkeley DB files. Start with a CSV file if you can. If no cards appear, the data folder is empty: drop a file on the page. An Excel file with several sheets shows one card for each sheet.', 64: try => { href => '/', label => 'Open the home page' }, 65: routes => [ '/' ], 66: }, 67: { 68: id => 'five-minute-tour', 69: part => 'First steps', 70: title => 'A five-minute tour', 71: lead => 'This tour touches the main ideas once: a table, a filter, a chart and a saved page.', 72: steps => [], 73: walkthrough => { 74: title => 'Walk through: from a table to a chart', 75: intro => 'This example uses the sales table in the data folder. Start on the home page.', 76: steps => [ 77: { do => 'Click the sales card.', see => 'A table opens with the columns id, product, region, sales_rep, amount and sale_date.' }, 78: { do => 'Click the heading amount.', see => 'The rows are sorted by amount. Click it again to reverse the order.' }, 79: { do => 'In the filter row, choose region, then equals, then type North. Click Apply filter.', see => 'Only the North rows stay. A small label names the filter above the table.' }, 80: { do => 'Click the x on that label.', see => 'The filter is gone and every row is back. A filter never changes the file.' }, 81: { do => 'Click Bar chart..., choose region for Category and amount for Value, then click Plot.', see => 'A bar chart shows the total amount for each region.' }, 82: { do => 'Click the sales step in the breadcrumb above the chart.', see => 'You are back at the table. The breadcrumb is always the way back.' }, 83: ], 84: result => 'You sorted, filtered and charted a file without changing it. Other chapters show each step in more detail.', 85: }, 86: tip => 'If you get lost, click Home at the top of any page. Your files are never changed, so you cannot lose anything.', 87: routes => [], 88: 89: part => 'First steps', 90: title => 'Find your way around', 91: lead => 'Every page shows where you are and how you got there.', 92: steps => [ 93: 'The links at the top of every page are Home, Canvases, Catalog, Open file..., Preferences and Tutorial.', 94: 'The Help link beside Tutorial opens the chapter for the page that you are on. F1 does the same.', 95: 'Below the title, the breadcrumb lists each page between Home and this one. Click a step to go back to it.', 96: 'Each step is named after what it shows, for example Bar chart: amount by region.', 97: 'A chart, pivot, statistics or insights page shows a Drawn from: strip under the breadcrumb.', 98: 'The strip lists the filters, the time range and the other changes that the page uses.', 99: 'Click Change... in the strip to go back to the page that they came from and change them.', 100: 'If an address is wrong, you see Page not found. Click Go to Home or Open a file.', 101: ], 102: tip => 'A chart opened from a chart keeps the whole trail, so you can always find the table that you started from.', 103: routes => [], 104: }, 105: { 106: id => 'other-files', 107: part => 'First steps', 108: title => 'Open a file from another place', 109: lead => 'You are not limited to the files in the data folder.', 110: steps => [ 111: 'Open the home page and click Browse your files. Click folders to move down. Click Up to move back.', 112: 'Click a data file in the list to open it.', 113: 'To use a full path, type it in the box that shows /path/to/file.csv and click Open.', 114: 'To open a file from your computer, drop it on the page. The program keeps a copy in a temporary folder.', 115: 'A database file can hold more than one table. The program shows the table list first. Click one table.', 116: 'To see a file as soon as the program starts, name it when you start the program: script/database-bi data/store.db.', 117: 'The home address then shows that file. Click Home in the breadcrumb to see the usual list.', 118: 'You can name only one file this way. To bring files together, open one and use Merge or Combine.', 119: 'A JSON Lines file, ending .jsonl or .ndjson, has one JSON object on each line. Each line is one row.', 120: 'Set json_flatten in the settings to show a nested object as columns such as address.city.', 121: 'To open several files as one table, tick them in the list. Use Select all for a whole folder, or hold Shift to tick a range.', 122: 'Click Combine selected. The rows of each file are stacked in one table.', 123: 'The last column, source_file, names the file each row came from.', 124: ], 125: tip => 'A folder of reports in the same format, such as a DMARC archive, needs only Select all and Combine selected.', 126: routes => [ '/browse', '/open', '/tables' ], 127: }, 128: { 129: id => 'remote-file', 130: part => 'First steps', 131: title => 'Open a file on another computer', 132: lead => 'You can open a data file on a remote server without copying it first.', 133: steps => [ 134: 'In the path box, type /../hostname/folder/file.csv where hostname is the server name.', 135: 'To connect as a specific user, type /../user@hostname/folder/file.csv instead.', 136: 'Click Open. The program downloads the file over SSH and shows it as a table.', 137: 'The remote path also works in the Merge data panel and the column selector.', 138: 'Files with unusual extensions such as .log are read and detected automatically.', 139: ], 140: tip => 'The remote host must run an SSH server. The program connects with SFTP and does not ask for a password here.', 141: routes => [ '/open' ], 142: }, 143: { 144: id => 'web-table', 145: part => 'First steps', 146: title => 'Import a table from a web page', 147: lead => 'Some web pages contain data tables. You can open one without saving it.', 148: steps => [ 149: 'On the home page, find Import from a web page.', 150: 'Paste the address of the page into the box.', 151: 'If the page has more than one table, type its number. The first table is 0.', 152: 'Click Import. The table opens in the program.', 153: ], 154: tip => 'The import reads the page each time. If the page changes, open it again.', 155: routes => [ '/import' ], 156: }, 157: 158: # --------------------------------------------------------------- 159: # Work with a table 160: # --------------------------------------------------------------- 161: { 162: id => 'read-table', 163: part => 'Work with a table', 164: title => 'Read and move around a table', 165: lead => 'A table has rows and columns. A row is one record. A column is one kind of value.', 166: steps => [ 167: 'Click a column heading to sort by that column. Click it again to reverse the order.', 168: 'When the table has more than one page, sorting goes back to page 1. The whole table is sorted, not only the page you see.', 169: 'Drag a column heading to move that column to a new place.', 170: 'A long table shows 200 rows at a time. Use Prev and Next below the table to see more rows.', 171: 'Beside them, the page says where you are, for example Page 2 of 7.', 172: 'Choose 25, 50, 100, 200 or All in Rows per page to change how many rows each page shows.', 173: 'The first row you were looking at stays on screen. All puts every row on one page, which can be slow for a big file.', 174: 'The number you choose stays when you merge or combine more data.', 175: 'To change the number for every table, use the Preferences page.', 176: 'Click Totals to add a row of sums at the bottom.', 177: 'Click the box at the start of a row to select it. Click Delete selected to remove it from the view.', 178: ], 179: tip => 'The program remembers your sort order and column order in this browser. Delete selected only changes the view, not the file.', 180: routes => [ '/view/:table' ], 181: }, 182: { 183: id => 'filter', 184: part => 'Work with a table', 185: title => 'Keep only the rows you need', 186: lead => 'A filter hides rows that do not match a rule.', 187: steps => [ 188: 'Find the filter row below the toolbar.', 189: 'Choose a column. The comparison options change to match the column type.', 190: 'For a date column a date picker appears. For a number column a number box appears. For text, type a value.', 191: 'To keep rows between two dates, choose Date range and pick a start and an end date.', 192: 'For a number column, such as a year, choose between and type the lowest and highest value.', 193: 'The two values can be in either order.', 194: 'To keep just a recent window instead, pick a Time range such as the last 30 days.', 195: 'Time range is shown only when the table has a date or time column.', 196: 'Choose the column that window applies to, then click Apply range.', 197: 'Today and the other windows follow the time zone the maintainer set, if there is one.', 198: 'Old data? Under Anchored to the data, choose First decade or Last year in the data. They count from the first or last day in the column.', 199: 'These add two ordinary date filters. Remove them with the labels above the table.', 200: 'Press Enter or click Apply filter.', 201: 'Each active filter is shown as a small label in the toolbar. Click the x on a label to remove it.', 202: 'For more rules, click Merge / Filter... and use the Filter results section.', 203: 'To compare two columns, use Delta... instead. It is explained in its own chapter.', 204: 'A link whose filter names a column the table does not have shows an error that lists the columns.', 205: ], 206: tip => 'A filter does not change your file. It only changes what you see and what you export. A time range is worked out from today every time.', 207: routes => [ '/view/:table' ], 208: }, 209: { 210: id => 'dedup', 211: part => 'Work with a table', 212: title => 'Hide duplicate rows', 213: lead => 'A duplicate row is exactly the same as another row in every column.', 214: steps => [ 215: 'Click Hide duplicates in the toolbar.', 216: 'The table now shows one copy of each row.', 217: 'Click Show duplicates to see every row again.', 218: ], 219: tip => 'Export uses the same rows that you see. Check this button before you export. Charts, the pivot table and the statistics also use one copy of each row.', 220: routes => [], 221: }, 222: { 223: id => 'join', 224: part => 'Work with a table', 225: title => 'Merge: add columns from another table', 226: lead => 'A merge joins two tables by a value that both tables share. A customer number is one example.', 227: steps => [ 228: 'Open the main table.', 229: 'Click Merge / Filter...', 230: 'Choose the second table. You can also type its path.', 231: 'Choose the column in the main table and the matching column in the second table. These two columns are the key: they hold the same values, such as a customer number.', 232: 'Choose which rows to keep. The option Keep all rows from the left table is a safe first choice.', 233: 'Click Apply.', 234: ], 235: tip => 'A merge can make the table much wider. Start with a second table that has only a few columns.', 236: walkthrough => { 237: title => 'Walk through: add customer names to sales', 238: intro => 'This example merges the sales and customer tables inside the store database.', 239: steps => [ 240: { do => 'On the home page, click store.', see => 'The schema page lists customer, product and sales.' }, 241: { do => 'Click sales. The table opens with four rows.', see => 'The rows show four sales, each with a customer_id from 1 to 3.' }, 242: { do => 'Click Merge / Filter...', see => 'The panel asks for a table, two columns and a row rule.' }, 243: { do => 'Under Table from the data directory, choose store / customer.', see => 'The matching column list fills with id, name and email.' }, 244: { do => 'Choose customer_id for the left key and id for the right key.', see => 'The panel describes a match from customer_id to id.' }, 245: { do => 'Choose Keep all rows from the left table and click Apply.', see => 'The result has four rows and new name and email columns.' }, 246: ], 247: result => 'Alice Smith appears twice; Bob Jones and Carol White appear once, so every sale now names its customer.', 248: }, 249: routes => [ '/join' ], 250: }, 251: { 252: id => 'combine', 253: part => 'Work with a table', 254: title => 'Put one file under another', 255: lead => 'Combine stacks the rows of a second file under the rows of the first file.', 256: steps => [ 257: 'Open the first table.', 258: 'Click Combine data...', 259: 'Choose the second table or type its path.', 260: 'Click Combine.', 261: 'To combine many files at once, tick them in Browse your files and click Combine selected.', 262: 'A source_file column then names the file each row came from.', 263: 'You can merge a table and then combine another, in either order. The table keeps both, and so do its charts.', 264: ], 265: tip => 'The files do not need the same columns. A missing value is left blank.', 266: routes => [ '/combine' ], 267: }, 268: { 269: id => 'delta', 270: part => 'Work with a table', 271: title => 'Keep only the rows where two columns differ', 272: lead => 'Delta removes every row where two columns are identical.', 273: steps => [ 274: 'Open the table.', 275: 'Click Delta..., to the right of Combine data.', 276: 'Choose the first column and the second column.', 277: 'Click Apply. Only the rows where the two columns hold different values are left.', 278: 'To see all the rows again, remove the filter chip above the table.', 279: ], 280: tip => 'Identical means the same text. Ann and ann differ, and so do 10 and 10.0. Two empty cells are identical, so that row is removed.', 281: routes => [ '/open' ], 282: }, 283: { 284: id => 'calc', 285: part => 'Work with a table', 286: title => 'Make a new column with a calculation', 287: lead => 'A calculated column is a new column made from a formula.', 288: steps => [ 289: 'Open the table and click Calc fields...', 290: 'Type a name for the new column, for example margin.', 291: 'Type the formula, for example revenue - cost. Use the column names that you see in the table, spelled the same way.', 292: 'You can use + - * / and brackets. If the formula has a mistake, the panel says so and nothing is added.', 293: 'Click Save & apply. The new column appears in the table.', 294: ], 295: tip => 'The program remembers the field for this data file. It is applied the next time you open the file.', 296: walkthrough => { 297: title => 'Walk through: add a tax column', 298: intro => 'This example adds a column to the sales table.', 299: steps => [ 300: { do => 'Open the sales table and click Calc fields...', see => 'The panel asks for a column name and an expression.' }, 301: { do => 'Type tax_amount in the Column name box.', see => 'The name is ready for the new column.' }, 302: { do => 'Type amount * 1.2 in the Expression box.', see => 'The formula uses the amount column that is already in the table.' }, 303: { do => 'Click Save & apply.', see => 'A tax_amount column appears at the right of the table.' }, 304: { do => 'Use tax_amount in a chart or pivot table.', see => 'The chart sums the calculated values like any other number column.' }, 305: ], 306: result => 'The calculation is saved for this data file, so tax_amount is there the next time you open sales.', 307: }, 308: routes => [], 309: }, 310: { 311: id => 'cross-row', 312: part => 'Work with a table', 313: title => 'Add a running total or a moving average', 314: lead => 'A cross-row column is worked out from the rows around each row, not from the row alone.', 315: steps => [ 316: 'Open the table and click Cross-row...', 317: 'Choose the number column to read, for example amount.', 318: 'Choose what to work out, for example Running total.', 319: 'Choose the column that says which order to read the rows in, for example the date.', 320: 'Type a name for the new column and click Add column.', 321: ], 322: tip => 'The new column is in the table and in every chart list. The Cross-row chip removes it. Restart for each makes each group start again from zero.', 323: walkthrough => { 324: title => 'Walk through: a running total per region', 325: intro => 'This example adds a running total to the sales table.', 326: steps => [ 327: { do => 'Open the sales table and click Cross-row...', see => 'The panel asks for a number column, a function and a name.' }, 328: { do => 'Choose amount as the number column.', see => 'The new column will add up the amounts.' }, 329: { do => 'Choose Running total, and id as the column to read rows in order of.', see => 'A running total needs an order, so the order box is required.' }, 330: { do => 'Type running_amount as the name and click Add column.', see => 'The table gains a running_amount column and a Cross-row chip.' }, 331: { do => 'Choose region under Restart for each and add a second column.', see => 'Each region now starts again from its own first row.' }, 332: { do => 'Click Bar chart... and pick running_amount as the value.', see => 'A chart reads the new column like any other number column.' }, 333: ], 334: result => 'A running total is a column of the view, so the table, the charts and the export all show the same numbers.', 335: }, 336: routes => [], 337: }, 338: { 339: id => 'groups', 340: part => 'Work with a table', 341: title => 'Group values into your own labels', 342: lead => 'A group gives several values one shared name.', 343: steps => [ 344: 'Click Group values...', 345: 'Choose the source column.', 346: 'Click Add group. Type a label, for example Northern.', 347: 'Type the values for this group, one on each line. Click Save group.', 348: 'The table gains a column named after the source column, for example region_group. Use it in a chart or pivot table.', 349: ], 350: tip => 'A value that is not in a group becomes (other).', 351: routes => [], 352: }, 353: { 354: id => 'dates', 355: part => 'Work with a table', 356: title => 'Tell the program how your dates look', 357: lead => 'Dates can be written in many ways. The program needs to know which way your file uses.', 358: steps => [ 359: 'Click Date format...', 360: 'Choose the date column.', 361: 'Choose the format that matches your data, for example D/M/YYYY.', 362: 'If the column also holds a time, set Clock time. Then hour() and time buckets work.', 363: 'Click Save & apply.', 364: ], 365: tip => 'After you set the format, This year, This quarter and This month work in the date panel.', 366: routes => [], 367: }, 368: { 369: id => 'lookups', 370: part => 'Work with a table', 371: title => 'Lookups: add columns from a saved file', 372: lead => 'A lookup adds columns from a second file, matched on one value, such as a region to its manager.', 373: steps => [ 374: 'Put the second file in the data folder.', 375: 'Open the table and click Lookups...', 376: 'Type a name, then choose the Lookup file.', 377: 'Choose its Key in that file, and the Match column here that holds the same values.', 378: 'Pick the Columns to add, or pick none to add them all. Type a Default for values the file does not have.', 379: 'Click Save & apply.', 380: ], 381: tip => 'Click Skip in this view to see one view without a lookup. It stays saved for the others.', 382: routes => [], 383: }, 384: { 385: id => 'extract', 386: part => 'Work with a table', 387: title => 'Split a column into new columns', 388: lead => 'An extraction pulls parts out of a text column with a pattern, such as the domain of an email address.', 389: steps => [ 390: 'Open the table and click Extract fields...', 391: 'Type a name and choose the column.', 392: 'Type a pattern. Each named part, written (?<name>...), becomes a column.', 393: 'For example, @(?<domain>[\\w.-]+) makes a domain column from an email address.', 394: 'Click Save & apply.', 395: ], 396: tip => 'A row that the pattern does not match shows (unparseable), so you can count those rows.', 397: routes => [], 398: }, 399: { 400: id => 'folder', 401: part => 'Work with a table', 402: title => 'Browse records in folders', 403: lead => 'Folder view groups rows by the first letters of a code column.', 404: steps => [ 405: 'Click Folder view...', 406: 'Choose the code column. Order numbers such as A10 and B3 are a good example.', 407: 'Click Open.', 408: 'Click a folder to see the rows in it.', 409: ], 410: tip => 'Folder view is a fast way to find a record when you know the start of its code.', 411: routes => [ '/folder' ], 412: }, 413: 414: # --------------------------------------------------------------- 415: # Charts and summaries 416: # --------------------------------------------------------------- 417: { 418: id => 'first-chart', 419: part => 'Charts and summaries', 420: title => 'Make your first chart', 421: lead => 'A chart shows a pattern that is hard to see in a long table.', 422: steps => [ 423: 'Open a table.', 424: 'Click a chart button in the toolbar. Bar chart... is a good first choice.', 425: 'Choose a category column and a number column.', 426: 'Click Plot.', 427: 'Use Export SVG, Export PNG or Export PDF to save the chart. Use Copy link to share the page.', 428: 'Chrome and Edge ask where to save. Choose the folder and type the file name you want, then click Save.', 429: ], 430: tip => 'If the chart is empty, check that you chose a number column for the value.', 431: routes => [], 432: }, 433: { 434: id => 'chart-types', 435: part => 'Charts and summaries', 436: title => 'Choose the right chart', 437: lead => 'Each chart answers a different question. This table can help you choose.', 438: steps => [], 439: table => { 440: caption => 'Chart types and what they are good for', 441: head => [ 'Chart', 'Good for', 'What to choose' ], 442: rows => [ 443: [ 'Line chart', 'A value over time', 'A date or number for X, and a number for Y' ], 444: [ 'Pie chart', 'Parts of one whole', 'A category and a number, with few categories' ], 445: [ 'Heatmap', 'Two groups compared by colour', 'Two category columns, and a count or sum' ], 446: [ 'Bar chart', 'Sizes of different groups', 'A category and a number' ], 447: [ 'Stacked bar chart', 'Groups and their parts', 'A category, a segment, and a number' ], 448: [ 'Scatter plot', 'A link between two numbers', 'Two number columns' ], 449: [ 'Combo chart', 'A bar value and a line value together', 'X, a bar number, and a line number' ], 450: [ 'Treemap', 'Big and small groups in boxes', 'A category and an optional number' ], 451: [ 'Histogram', 'How numbers are spread out', 'A number column and a bin count' ], 452: [ 'Map', 'Where the rows are in the world', 'Latitude and longitude, or a place column' ], 453: [ 'Word cloud', 'Which words a text column repeats', 'A text column' ], 454: ], 455: }, 456: tip => 'A bar chart is a good first choice for most data.', 457: routes => [], 458: }, 459: { 460: id => 'time-bucket', 461: part => 'Charts and summaries', 462: title => 'Group by hour, day, month or decade', 463: lead => 'A time bucket turns a column of dates into one group per hour, day, month, year, decade or century.', 464: steps => [ 465: 'Open a table and click a chart button, for example Bar chart...', 466: 'Choose the date or timestamp column for the category or X axis.', 467: 'Set Time bucket to the period you want, such as 1 hour, 1 month, 1 decade or 1 century.', 468: 'Click Plot.', 469: 'A column that holds only a year, such as 1887, works too. Choose 1 year, 1 decade or 1 century. The bucket 1880-01-01 is the decade from 1880 to 1889.', 470: 'A time that ends in Z or an offset, such as +01:00, lands in the day and hour of the time zone that was set.', 471: ], 472: tip => 'The bucket is a new column, so the chart still has the original timestamp beside it. Use the pivot table to bucket a row group the same way.', 473: routes => [], 474: }, 475: { 476: id => 'line-chart', 477: part => 'Charts and summaries', 478: title => 'Line chart', 479: chart => 1, 480: lead => 'A line chart shows how a number changes along a series, often over time.', 481: steps => [ 482: 'Open the table and click Line graph...', 483: 'Choose the X axis. A date column or a number column works well.', 484: 'Choose the Y axis. This must be a number column.', 485: 'Optional: choose Lines by to draw one line for each value of a column, such as one per region.', 486: 'For a total per period, set Time bucket and then set Aggregate to Sum.', 487: 'Click Plot.', 488: 'Tick Min, Avg or Max above the chart to draw a line at that value.', 489: 'Tick Trend to draw the straight line closest to the points. It shows whether the numbers go up or down overall.', 490: 'Next to Trend, per point is how much the line rises from one point to the next. R squared near 1 means the points lie close to the line.', 491: 'Drag across part of the chart to zoom in. The lines are worked out again for the points you can see.', 492: ], 493: tip => 'Use Copy link to share the chart. Use Export SVG, Export PNG or Export PDF to save the picture.', 494: routes => [ '/graph', '/line' ], 495: }, 496: { 497: id => 'pie-chart', 498: part => 'Charts and summaries', 499: title => 'Pie chart', 500: chart => 1, 501: lead => 'A pie chart shows the parts of one whole.', 502: steps => [ 503: 'Open the table and click Pie chart...', 504: 'Choose the column for Slice by. This gives the slices.', 505: 'Choose Value. Count (rows) counts each row; a number column sums its values.', 506: 'Set Top N slices if you want only the largest slices. The rest become Other.', 507: 'Click Plot.', 508: ], 509: tip => 'Click a slice to open the matching rows in the table.', 510: walkthrough => { 511: title => 'Walk through: population share by region', 512: intro => 'This example uses the virginia_counties table in the data folder.', 513: steps => [ 514: { do => 'Open the virginia_counties table and click Pie chart...', see => 'The pie panel opens.' }, 515: { do => 'Choose region for Slice by.', see => 'Seven regions will become slices.' }, 516: { do => 'Choose population for Value.', see => 'Each slice will show the total population for that region.' }, 517: { do => 'Click Plot.', see => 'A pie chart appears. Northern Virginia is the largest slice.' }, 518: ], 519: result => 'Northern Virginia holds the most people. Its slice is larger than all Southside and Southwest counties combined.', 520: }, 521: try => { href => '/pie?l=table:virginia_counties&cat=region&val=population', label => 'Try population by region' }, 522: routes => [ '/pie' ], 523: }, 524: { 525: id => 'heatmap-chart', 526: part => 'Charts and summaries', 527: title => 'Heatmap', 528: chart => 1, 529: lead => 'A heatmap compares two groups with colour.', 530: steps => [ 531: 'Open the table and click Heatmap...', 532: 'Choose X axis (columns).', 533: 'Choose Y axis (rows).', 534: 'Leave Value on Count (rows), or choose a number column to sum.', 535: 'Click Plot.', 536: ], 537: tip => 'A darker colour means a larger count or sum.', 538: routes => [ '/heatmap' ], 539: }, 540: { 541: id => 'bar-chart', 542: part => 'Charts and summaries', 543: title => 'Bar chart', 544: chart => 1, 545: lead => 'A bar chart compares the sizes of different groups.', 546: steps => [ 547: 'Open the table and click Bar chart...', 548: 'Choose Category (bars).', 549: 'Leave Value on Count (rows), or choose a number column to sum.', 550: 'Use Sort bars and Orientation if you want a different order or direction.', 551: 'Click Plot.', 552: ], 553: tip => 'A bar chart is a good first choice for most data.', 554: walkthrough => { 555: title => 'Walk through: top Virginia counties by population', 556: intro => 'This example uses the virginia_counties table in the data folder.', 557: steps => [ 558: { do => 'Open the virginia_counties table and click Bar chart...', see => 'The bar panel opens.' }, 559: { do => 'Choose county for Category.', see => 'There are 95 counties. Set a limit in the next step.' }, 560: { do => 'Choose population for Value. Set Top N to 10 and Sort to By value.', see => 'The form is ready.' }, 561: { do => 'Click Plot.', see => 'Ten bars appear. Fairfax County stands far above the rest.' }, 562: ], 563: result => 'The ten most populous counties appear, sorted largest first. Fairfax County has more people than the bottom 30 counties together.', 564: }, 565: try => { href => '/bar?l=table:virginia_counties&cat=county&val=population&sort=value&topn=10', label => 'Try top 10 counties by population' }, 566: routes => [ '/bar' ], 567: }, 568: { 569: id => 'stacked-chart', 570: part => 'Charts and summaries', 571: title => 'Stacked bar chart', 572: chart => 1, 573: lead => 'A stacked bar chart shows groups and their parts.', 574: steps => [ 575: 'Open the table and click Stacked bar...', 576: 'Choose Category (X axis).', 577: 'Choose Segment (series). This gives the parts of each bar.', 578: 'Leave Value on Count (rows), or choose a number column to sum.', 579: 'Click Plot.', 580: ], 581: tip => 'Click a part of the legend to hide or show that segment.', 582: routes => [ '/stacked' ], 583: }, 584: { 585: id => 'scatter-chart', 586: part => 'Charts and summaries', 587: title => 'Scatter plot', 588: chart => 1, 589: lead => 'A scatter plot shows a link between two numbers.', 590: steps => [ 591: 'Open the table and click Scatter...', 592: 'Choose X axis (horizontal, numeric).', 593: 'Choose Y axis (vertical, numeric).', 594: 'Optional: choose Colour by to colour the points by a group. Use Bubble size to size them by a number.', 595: 'Click Plot.', 596: ], 597: tip => 'If a column is not numeric, it does not appear in the axis lists. A scatter card on a canvas keeps its colours and bubbles. In Add current view, choose Scatter chart to set Colour by and Bubble size there too.', 598: walkthrough => { 599: title => 'Walk through: county location and size', 600: intro => 'This example uses the virginia_counties table in the data folder.', 601: steps => [ 602: { do => 'Open the virginia_counties table and click Scatter...', see => 'The scatter panel opens.' }, 603: { do => 'Choose lon for X axis and lat for Y axis.', see => 'Each dot will sit at its map position.' }, 604: { do => 'Choose region for Colour by.', see => 'Each region gets its own colour.' }, 605: { do => 'Choose population for Bubble size. Click Plot.', see => 'Northern Virginia circles are much bigger than the rest.' }, 606: ], 607: result => 'The chart mirrors Virginia shape. Large bubbles in the northeast show the high-population Northern Virginia counties.', 608: }, 609: try => { href => '/scatter?l=table:virginia_counties&x=lon&y=lat&series=region&size=population', label => 'Try Virginia counties scatter plot' }, 610: routes => [ '/scatter' ], 611: }, 612: { 613: id => 'combo-chart', 614: part => 'Charts and summaries', 615: title => 'Combo chart', 616: chart => 1, 617: lead => 'A combo chart puts a bar value and a line value on the same X axis.', 618: steps => [ 619: 'Open the table and click Combo chart...', 620: 'Choose X axis.', 621: 'Choose Bar column (numeric).', 622: 'Choose Line column (numeric).', 623: 'Optional: choose a scheme in Colours. The bars take its first colour and the line its second.', 624: 'Click Plot.', 625: ], 626: tip => 'Use a combo chart when two numbers are measured in different units. A combo card on a canvas keeps its colours.', 627: routes => [ '/combo' ], 628: }, 629: { 630: id => 'treemap-chart', 631: part => 'Charts and summaries', 632: title => 'Treemap', 633: chart => 1, 634: lead => 'A treemap shows big and small groups as boxes.', 635: steps => [ 636: 'Open the table and click Treemap...', 637: 'Choose Category column.', 638: 'Leave Value (tile size) on Count (rows), or choose a number column to sum.', 639: 'Set Top N tiles if you want only the largest groups.', 640: 'Optional: choose Colour by to shade each tile by another number, such as a margin.', 641: 'Colour from says how that number is worked out for each tile. Average is the default.', 642: 'Colour scale picks the colours, from light for low values to dark for high ones.', 643: 'Click Plot.', 644: ], 645: tip => 'A treemap is useful when one level has many groups. Size and colour can show two numbers at once: size for sales, colour for margin. A treemap card on a canvas keeps its colours.', 646: routes => [ '/treemap' ], 647: }, 648: { 649: id => 'histogram-chart', 650: part => 'Charts and summaries', 651: title => 'Histogram', 652: chart => 1, 653: lead => 'A histogram shows how numbers are spread out.', 654: steps => [ 655: 'Open the table and click Histogram...', 656: 'Choose Numeric column.', 657: 'Set Number of bins. More bins show more detail.', 658: 'Optional: choose Bar colour to fill the bars with the first colour of a scheme.', 659: 'Click Plot.', 660: ], 661: tip => 'A histogram works best with a number column that has many different values.', 662: routes => [ '/histogram' ], 663: }, 664: { 665: id => 'map-chart', 666: part => 'Charts and summaries', 667: title => 'Map', 668: chart => 1, 669: lead => 'A map shows where the rows are in the world.', 670: steps => [ 671: 'Open the table and click Map...', 672: 'Keep Coordinate columns, then choose the latitude and longitude columns.', 673: 'If your table has places instead, choose Place-name column and pick that column.', 674: 'If the place is split over two columns, such as an address and its country, choose the second one under Followed by. The map then looks up "Brezje 8, Cerknica, Slovenia".', 675: 'If the places need more to be found, type it in Add to each place. With Virginia, USA, the county Accomack is looked up as "Accomack, Virginia, USA".', 676: 'Tick Remember columns. Next time, the panel chooses the same columns for this table, and fills in Add to each place. Click Forget remembered columns to stop this.', 677: 'Click Open map.', 678: 'Click a marker to see the rows at that place.', 679: 'If some rows could not be plotted, the map says how many, and why.', 680: 'Click Show the rows that were not plotted in the table to see them all.', 681: 'Or click List the places that were not plotted to see each place.', 682: 'Click the number of rows beside a place to see those rows in the table.', 683: 'For colours, outlines and heat, see the next chapter, Map: colours, outlines and shading.', 684: ], 685: tip => 'Rows at one place become one marker. A place the program does not know is looked up on OpenStreetMap, which can take a while. Every place found is kept, so the next map of it opens at once.', 686: walkthrough => { 687: title => 'Walk through: Virginia counties on a map', 688: intro => 'This example uses the virginia_counties table in the data folder.', 689: steps => [ 690: { do => 'Open the virginia_counties table and click Map...', see => 'The map panel opens.' }, 691: { do => 'Keep Coordinate columns. Choose lat for Latitude and lon for Longitude.', see => 'The form shows lat and lon selected.' }, 692: { do => 'Click Open map.', see => 'A map appears with 95 markers, one for each Virginia county.' }, 693: { do => 'Click any marker.', see => 'A popup shows the county name, population and region.' }, 694: ], 695: result => 'All 95 Virginia counties appear as markers. Markers near one another cluster at low zoom.', 696: }, 697: try => { href => '/map?l=table:virginia_counties&lat=lat&lon=lon', label => 'Try the Virginia counties map' }, 698: routes => [ '/map' ], 699: }, 700: { 701: id => 'map-advanced', 702: part => 'Charts and summaries', 703: title => 'Map: colours, outlines and shading', 704: lead => 'A map can colour its markers, outline counties and states, and shade each outline by a total.', 705: steps => [ 706: 'Open the table and click Map..., then choose the place or coordinate columns as in the Map chapter.', 707: 'Tick Heatmap layer to colour the busy areas. Choose a Heat weight column to make some rows count for more.', 708: 'Type an Initial zoom from 0 to 19 to start closer in. Leave it empty to fit every marker.', 709: 'Choose Counties for Show boundaries to outline the county each marker is in. A checkbox on the map hides the outlines again.', 710: 'The list also has countries, states or provinces, cities, towns and neighbourhoods. Choose States, provinces or regions for a map of Canada or India.', 711: 'OpenStreetMap has many small places only as a point. A marker there has no outline, and the list under the map names it.', 712: 'With the boundaries on, choose a column for Colour shade. Each outline is filled in a shade of one colour, darker for a larger total.', 713: 'With coloured markers too, each outline is shaded in its own markers\' colour. Type a Shade colour to use one colour for them all.', 714: 'Under the map, a list names each outline that holds more than one marker. Click its number of rows to see them in the table.', 715: 'Two places in one outline can mean a name was looked up wrongly. Add to each place, or coordinate columns, make a lookup surer.', 716: 'To colour the markers, choose Colour by column, then click Add rule. The first rule that matches gives the colour.', 717: 'Type a Default colour for the markers that match no rule.', 718: 'Click Open map.', 719: ], 720: tip => 'What the rows share is shown once, and the rest is a short table. A place with many rows shows the first ten, with a link to them all. The scale bar and the key change as you zoom. The key lists only the colours you can see. To size each marker by a number, add &size= and a column name to the map address. To give each category its own colour and a legend, add &series= and a column name instead. A place the local data does not know is looked up on OpenStreetMap. The map opens at once with the places already known. A bar shows each new place as it is looked up. Click Cancel to stop and see the map with the places found so far. Every place found is kept, so the next map of it opens at once. County outlines come from OpenStreetMap too. It is sent each marker\'s position, rounded to about 100 metres. In India the outlines are districts, and in Spain provinces. Add &heat=1&weight= and a column name to colour each outline by its total, from green for the least to red for the most. A key in the corner of the map shows the totals each colour covers.', 721: routes => [], 722: }, 723: { 724: id => 'wordcloud-chart', 725: part => 'Charts and summaries', 726: title => 'Word cloud', 727: chart => 1, 728: lead => 'A word cloud shows which words a text column repeats most.', 729: steps => [ 730: 'Open the table and click Word cloud...', 731: 'Choose Text column. This column holds words, such as a product name or a note.', 732: 'Set Words to show to the number of different words you want.', 733: 'Set Shortest word to hide very short words such as "at".', 734: 'Click Draw cloud.', 735: 'To keep the cloud on a saved canvas, open the canvas and click Add current view, then choose Word cloud.', 736: 'On a canvas, click a word to filter every other card to the rows that contain it.', 737: ], 738: tip => 'The biggest word appears in the most rows. Click a word to open the rows that contain it, or to cross-filter the canvas around it.', 739: try => { href => '/wordcloud?l=table:sales&col=product', label => 'Try a word cloud of the sales table' }, 740: routes => [ '/wordcloud' ], 741: }, 742: { 743: id => 'pivot', 744: part => 'Charts and summaries', 745: title => 'Summarise with a pivot table', 746: lead => 'A pivot table puts one group down the side and another group across the top. Each cell is a summary.', 747: steps => [ 748: 'Click Pivot table...', 749: 'Add a row group. For example, choose region.', 750: 'Add a measure. For example, choose Sum of amount.', 751: 'The measure can also be Median, Std dev, First, Last, Range or a percentile.', 752: 'Set Time bucket to group a row group by hour, day, month or year.', 753: 'Click Build pivot.', 754: 'Click Show subtotals and grand total if you want totals.', 755: 'A pivot with many rows is shown a page at a time. Rows per page below it changes how many, as on a table.', 756: ], 757: tip => 'Start with one row group and one measure. Add more only when you need them.', 758: walkthrough => { 759: title => 'Walk through: sales by region and product', 760: intro => 'This example uses the sales table in the data folder.', 761: steps => [ 762: { do => 'Open the sales table and click Pivot table...', see => 'The panel opens with one empty row group and one measure.' }, 763: { do => 'In the first row group, choose region.', see => 'region becomes the group down the side.' }, 764: { do => 'Click Add column and choose product.', see => 'Each product will become a column across the top.' }, 765: { do => 'In the measure row, choose amount and keep Sum.', see => 'The measure is called amount_sum unless you type another alias.' }, 766: { do => 'Tick Show subtotals and grand total, then click Build pivot.', see => 'The pivot shows a total for each region and one grand total.' }, 767: ], 768: result => 'Regions run down the side, products run across the top, and each cell holds the sum of amount.', 769: }, 770: routes => [ '/pivot' ], 771: }, 772: { 773: id => 'stats', 774: part => 'Charts and summaries', 775: title => 'See statistics for each column', 776: lead => 'Statistics give you a quick summary of every column.', 777: steps => [ 778: 'Open a table and click Column stats.', 779: 'Read one row for each column.', 780: 'Rows is the number of rows. Non-null is the number of cells with a value. Null is the number of blank cells.', 781: 'Distinct is the number of different values.', 782: 'For a number column you also see Min, Max, Range, Mean, Median, Std dev and a percentile.', 783: 'Mean is the average. Median is the middle value. Range is the largest value minus the smallest.', 784: 'Std dev shows how widely the values spread.', 785: 'First and Last are the values the column holds in the first and the last row that has one.', 786: 'Change Percentile column to choose which percentile the extra column shows.', 787: ], 788: tip => 'Statistics use the rows that are visible after joins and filters.', 789: walkthrough => { 790: title => 'Walk through: column statistics for Virginia counties', 791: intro => 'This example uses the virginia_counties table in the data folder.', 792: steps => [ 793: { do => 'Open the virginia_counties table and click Column stats.', see => 'The stats page shows one row per column.' }, 794: { do => 'Find the population row.', see => 'Min is 2214 and Max is 1150309.' }, 795: { do => 'Look at the Distinct count for region.', see => 'There are 7 distinct regions.' }, 796: { do => 'Look at Mean and Median for population.', see => 'Mean is much higher than Median. A few large counties pull the average up.' }, 797: { do => 'Look at Range for population.', see => 'Min is 2214, so Range is 1148095.' }, 798: ], 799: result => 'Population is highly uneven. The maximum county is over 500 times larger than the minimum.', 800: }, 801: try => { href => '/stats?l=table:virginia_counties', label => 'Try statistics on Virginia counties' }, 802: routes => [ '/stats' ], 803: }, 804: { 805: id => 'insights', 806: part => 'Charts and summaries', 807: title => 'Find outliers and trends automatically', 808: lead => 'Insights scans your data and flags unusual values, changes over time, and repeating patterns.', 809: steps => [ 810: 'Open a table and click Insights.', 811: 'Each card shows one finding: an outlier, a period change, a top mover, or a seasonal pattern.', 812: 'An outlier is a value far outside the normal range for its group.', 813: 'A period change compares the most recent month to the one before it.', 814: 'A top mover is the category that changed the most between two periods.', 815: 'Seasonality means the same pattern repeats from one period to the next.', 816: 'Click View in chart on any card to open the chart that shows it.', 817: 'Click Summarize to read the findings as a few plain sentences.', 818: 'If the program has an AI key, tick Use AI for better prose first. Only the findings are sent, never your rows.', 819: ], 820: tip => 'Insights need a date column and a number column to detect period changes and top movers.', 821: routes => [ '/insights' ], 822: }, 823: { 824: id => 'ask', 825: part => 'Charts and summaries', 826: title => 'Ask for a chart in plain English', 827: lead => 'Ask turns a question such as "sales by region as a pie chart" into a chart.', 828: steps => [ 829: 'Open a table and click Ask...', 830: 'Type what you want to see, for example: show me sales by region as a pie chart.', 831: 'Click Ask. The panel names the chart that it suggests.', 832: 'Click Run it to open that chart.', 833: 'Click Save to canvas to keep it as a card on a new canvas.', 834: ], 835: tip => 'Ask appears only when the person who runs the program has set an AI key. Only the column names and their types are sent, never your rows. A question can be up to 500 characters.', 836: }, 837: 838: # --------------------------------------------------------------- 839: # Save and share 840: # --------------------------------------------------------------- 841: { 842: id => 'export', 843: part => 'Save and share', 844: title => 'Save the data as a new file', 845: lead => 'Export writes the rows that you see to a new file.', 846: steps => [ 847: 'Click Export...', 848: 'Choose the folder and type a file name.', 849: 'The ending of the name chooses the format: .csv, .sql or .json.', 850: 'Click Save. The program writes a new file. Your source file is not changed.', 851: ], 852: tip => 'Export includes your joins, filters and duplicate setting. It saves only the columns you can see, in the order you see them. A column that you deleted is not saved.', 853: routes => [ '/export' ], 854: }, 855: { 856: id => 'print', 857: part => 'Save and share', 858: title => 'Print the table', 859: lead => 'Print puts the header row and every row of the table on paper, not only the page on the screen.', 860: steps => [ 861: 'Arrange the table the way you want it. Move or delete columns, and click a header to sort.', 862: 'Click Print, to the right of Refresh.', 863: 'Your browser opens its print window. Choose a printer, or save the page as a PDF.', 864: 'Every page starts with a heading that names the filters and time range, so a printout says what it shows.', 865: 'To print only what is on the screen, click Print shown instead.', 866: 'A table of more than 10,000 rows asks first, because it can be hundreds of pages. Say OK, and the server makes a PDF for you.', 867: 'You can also click PDF at any time to get that file.', 868: 'The server makes a PDF of up to 50,000 rows. Whoever runs the server can change that with print_pdf_max_rows.', 869: ], 870: tip => 'Print uses the same rows as Export, so your joins and filters are included. A row that you deleted from the screen is still printed.', 871: routes => [ '/export' ], 872: }, 873: { 874: id => 'catalog', 875: part => 'Save and share', 876: title => 'See all your data files at a glance', 877: lead => 'The dataset catalog lists every file in the data folder and shows which canvases use it.', 878: steps => [ 879: 'Open the home page and click Dataset catalog.', 880: 'Each row shows the file name, type, size, and when it was last changed.', 881: 'The Used by column lists the canvases that include this file.', 882: 'Click a file name to open it as a table.', 883: 'Use the catalog to check which canvases will be affected if a file changes.', 884: ], 885: tip => 'A file that appears in Used by is linked to a canvas. Moving or renaming it will break that canvas.', 886: try => { href => '/catalog', label => 'Open the dataset catalog' }, 887: routes => [ '/catalog' ], 888: }, 889: { 890: id => 'canvas', 891: part => 'Save and share', 892: title => 'Save a canvas with several charts', 893: lead => 'A canvas is a saved page that can hold tables and charts side by side.', 894: steps => [ 895: 'Open a table and set up the view that you want.', 896: 'Click New canvas...', 897: 'Type a name and click Save.', 898: 'Click Open canvas. The current table or chart is the first card.', 899: 'Click Add visual... to add another view from a data file.', 900: 'In that panel, choose the Aggregate a chart works out: Sum, Average, Median, Std dev, or a percentile.', 901: 'Drag a card by its header to move it. Use the Size menu to change its width and height.', 902: 'Click Add text to put a title or an explanation on the canvas. The next chapter shows how.', 903: 'To show only a recent window on every card, choose a Time range and its column above the cards. Then click Apply range.', 904: 'Click Edit cross-row in a card header to see that card\'s cross-row columns, and to change or remove one.', 905: ], 906: tip => 'Click Canvases at the top of any page to see all your saved canvases. The home page lists them too. A banner appears if a data file has changed since the canvas was saved.', 907: walkthrough => { 908: title => 'Walk through: arrange and filter a canvas', 909: intro => 'This example starts from a canvas with at least two visuals. Open one from the home page.', 910: steps => [ 911: { do => 'Click a bar or a slice in one chart.', see => 'The other cards show only rows for that value, and a chip names the filter.' }, 912: { do => 'Click Clear on the filter chip.', see => 'Every card returns to the full data set.' }, 913: { do => 'Open the Size menu in a card header and choose Half width.', see => 'The card takes half a row, and the cards beside it move to fit.' }, 914: { do => 'Click Edit cross-row in a card header and click one of its columns.', see => 'The chip puts its column, function and name back in the fields, ready to change.' }, 915: { do => 'Click Bookmarks, type a name and click Save.', see => 'A link to this exact view appears under the button.' }, 916: { do => 'Click Print.', see => 'The browser print window opens with the canvas ready for paper or PDF.' }, 917: { do => 'To save just one chart, use the SVG, PNG or PDF button in its card header.', see => 'Chrome and Edge ask where to save it, with a file name based on the card. Other browsers save it in the downloads folder.' }, 918: ], 919: result => 'You filtered and arranged one dashboard, and saved a named view without changing any data file.', 920: }, 921: routes => [ '/a/:id', '/canvases' ], 922: }, 923: { 924: id => 'canvas-text', 925: part => 'Save and share', 926: title => 'Add a title or an explanation to a canvas', 927: lead => 'A text card puts your own words on a canvas, in the font, size and colours that you choose.', 928: steps => [ 929: 'Open a saved canvas.', 930: 'Click Add text in the toolbar.', 931: 'Type your words in the Text box. Press Enter to start a new line.', 932: 'Choose how the text looks. The preview under the box changes as you choose.', 933: 'Click Add to canvas. The card appears at the end of the canvas, across its full width.', 934: 'Drag the card by its header to where you want it. The cards in the way move down.', 935: 'Use the Size menu in the header to make the card narrower, or to make it taller.', 936: 'To change the words or the look, double-click the text. You can also click Edit text in the header.', 937: 'Change what you want and click Save text. The card shows each change as you make it, and Cancel puts it back.', 938: 'To remove the card, double-click the text, click Remove card and confirm.', 939: ], 940: tip => 'Text is shown exactly as you type it, so HTML tags and Markdown appear as ordinary characters. A filter never changes a text card, because a text card reads no data.', 941: table => { 942: caption => 'What you can choose for a text card', 943: head => [ 'Setting', 'What it does' ], 944: rows => [ 945: [ 'Font', 'Same as the page, Arial, Georgia, Times New Roman, Verdana, Trebuchet MS or Courier New.' ], 946: [ 'Size (points)', 'Any whole number from 8 to 96. A new card starts at 14.' ], 947: [ 'Alignment', 'Left, Centre or Right.' ], 948: [ 'Text colour', 'Pick a colour, or tick Follow the theme to match the light or dark page.' ], 949: [ 'Background', 'Pick a colour to fill the card, or tick None to leave it clear.' ], 950: [ 'Bold and Italic', 'Tick either one, or both.' ], 951: [ 'Hide the frame until pointed at', 'The card shows only its words until you point at it. This is ticked for a new card.' ], 952: ], 953: }, 954: walkthrough => { 955: title => 'Walk through: put a heading on a canvas', 956: intro => 'This example starts from a canvas with at least one chart. Open one from the home page.', 957: steps => [ 958: { do => 'Click Add text and type Quarterly sales in the Text box.', see => 'The words appear in the preview under the box.' }, 959: { do => 'Choose Georgia, type 24 for the size, choose Centre and tick Bold.', see => 'The preview shows large, bold, centred text.' }, 960: { do => 'Click Add to canvas.', see => 'The heading appears below the other cards, with no frame around it.' }, 961: { do => 'Point at the heading.', see => 'A frame appears, with a header above the words.' }, 962: { do => 'Drag the header to the top of the canvas.', see => 'The heading moves to the top row, and the charts move down below it.' }, 963: { do => 'Reload the page.', see => 'The heading is still at the top, in a row only as tall as its text.' }, 964: ], 965: result => 'You gave the canvas a heading that is saved with it and does not depend on any data file.', 966: }, 967: routes => [], 968: }, 969: { 970: id => 'share', 971: part => 'Save and share', 972: title => 'Share a link to a view', 973: lead => 'A link can open the same table, filters and chart for another person.', 974: steps => [ 975: 'Open a chart, or a table that has at least one filter.', 976: 'Click Copy link. The program puts the address on your clipboard.', 977: 'Paste the address into an email or a chat message.', 978: ], 979: tip => 'On a table, Copy link appears when a filter is active. On a chart, it is always there. The other person needs access to the file.', 980: routes => [], 981: }, 982: { 983: id => 'share-canvas', 984: part => 'Save and share', 985: title => 'Share a canvas with a signed link', 986: lead => 'A canvas share link lets anyone with the link view the canvas for 30 days.', 987: steps => [ 988: 'Open a saved canvas.', 989: 'Click Share... in the canvas toolbar.', 990: 'Click Make a link, then Copy link. The link is now on your clipboard.', 991: 'Send the link by email or in a message.', 992: 'To show the canvas inside another page of this site, click Copy embed code instead. The panel names any other sites where it works.', 993: 'The link stops working after 30 days. Click Make a new link to create another.', 994: 'If the panel says a restart ends the link, the server forgets its links when it stops.', 995: ], 996: tip => 'The link gives read-only access. To keep a copy of the canvas, click Download as JSON. Import canvas on the Canvases page reads it back.', 997: routes => [], 998: }, 999: 1000: # --------------------------------------------------------------- 1001: # Help 1002: # --------------------------------------------------------------- 1003: { 1004: id => 'keyboard', 1005: part => 'Help', 1006: title => 'Use the program with the keyboard', 1007: lead => 'Every control can be used without a mouse.', 1008: steps => [ 1009: 'Press Tab to move to the next control. Press Shift+Tab to move back.', 1010: 'Press Enter or Space to press a button or open a link.', 1011: 'On a column heading, press Enter to sort. Press Shift+Left or Shift+Right to move the column.', 1012: 'On a chart, press Tab until the resize grip has focus. Use the arrow keys to resize. Hold Shift for bigger steps.', 1013: 'On a canvas, focus a card header and use the arrow keys to move the card. Hold Shift to move it to the edge.', 1014: ], 1015: tip => 'The page says each change out loud for screen readers.', 1016: routes => [], 1017: }, 1018: { 1019: id => 'preferences', 1020: part => 'Help', 1021: title => 'Set your preferences', 1022: lead => 'The Preferences page chooses how the program looks to you: the theme, and how many rows a table shows on a page.', 1023: steps => [ 1024: 'Click Preferences at the top of any page.', 1025: 'Under Theme, choose Same as this device, Light or Dark.', 1026: 'Same as this device is the choice until you change it. The program follows the light or dark setting on your computer or phone, even while a page is open.', 1027: 'The page changes as soon as you choose. There is no Save button.', 1028: 'Every other page follows, including pages that are open in other tabs.', 1029: 'Tables and charts change with the page. A map keeps its usual colours.', 1030: 'Under Tables, choose how many rows a table or pivot shows on each page: 25, 50, 100, 200 or All.', 1031: 'The number takes effect from the next table you open. All can be slow for a big file.', 1032: 'The Rows per page list under a long table changes that table only.', 1033: ], 1034: tip => 'The choice is saved in this browser, so another browser or computer keeps its own. Saved charts and printed pages always use the light colours.', 1035: try => { href => '/preferences', label => 'Open your preferences' }, 1036: routes => [ '/preferences' ], 1037: }, 1038: { 1039: id => 'log-in', 1040: part => 'Help', 1041: title => 'Log in', 1042: lead => 'A program shared by several people can ask for a password before it shows anything.', 1043: steps => [ 1044: 'If a Log in page appears, type the password and click Log in.', 1045: 'Whoever runs the program chose the password. Ask them for it.', 1046: 'After you log in, the page you asked for opens.', 1047: 'Click Log out at the top of any page when you have finished.', 1048: 'If you do nothing for a working day, you are logged out by yourself.', 1049: 'After ten wrong passwords, the page asks you to wait a few minutes.', 1050: ], 1051: tip => 'Share and embed links still work without the password, until they expire. Anyone holding one sees that canvas.', 1052: try => { href => '/login', label => 'Open the Log in page' }, 1053: routes => [ '/login' ], 1054: }, 1055: 1056: # --------------------------------------------------------------- 1057: # For maintainers 1058: # --------------------------------------------------------------- 1059: { 1060: id => 'alerts-panel', 1061: part => 'Save and share', 1062: title => 'Get alerts from a canvas without cron', 1063: lead => 'The Alerts panel of a saved canvas keeps limits on its numbers and tells you when one is crossed.', 1064: steps => [ 1065: 'Open a saved canvas and click Alerts... in the toolbar.', 1066: 'Choose a number: Rows, or a total, average, smallest, largest or count of different values of a column.', 1067: 'Choose a comparison and type a limit, then click Add limit. Add as many limits as you need.', 1068: 'To hear about a crossing that stays crossed only now and then, type a time such as 6h under Repeat an alert at most every.', 1069: 'Tick Also say when it clears to hear when the number is back inside its limit.', 1070: 'Click Save, then Check now. The panel shows the numbers and lists what was announced under Recent alerts.', 1071: 'Click Try it to see what would be announced, without recording or sending anything.', 1072: ], 1073: tip => 'The server checks on its own only when whoever runs it sets alert_every, and it sends mail or messages only when they set alert_notify_cmd. Without those, alerts are listed in the panel.', 1074: routes => [], 1075: }, 1076: { 1077: id => 'alerts', 1078: part => 'For maintainers', 1079: title => 'Alert when a number crosses a limit', 1080: lead => 'The bi-alert script checks a canvas measure and signals when it crosses a threshold.', 1081: steps => [ 1082: 'The script is installed as bi-alert. In a copy of the source it is script/bi-alert.', 1083: 'Run bi-alert --help to see all options.', 1084: 'Pass --analysis with the canvas id and --threshold with the measure, comparison and value.', 1085: 'For example: bi-alert --analysis abc123 --threshold count:gt:0 exits with code 1 when count is above 0.', 1086: 'Pass --analysis or --threshold more than once to check several in the same run.', 1087: 'Prefix a threshold with an analysis id, such as abc123:count:gt:10, to check a second canvas.', 1088: 'Pass --dry-run to run the check and print the result without sending anything. A dry run does not count towards --suppress.', 1089: 'A threshold that stays crossed is only worth hearing about once, so pass --suppress 1h to be told at most hourly.', 1090: 'The script remembers the last alert in a small state file, and forgets it when the crossing ends.', 1091: 'Pass --recovery to be told when the crossing ends as well as when it starts.', 1092: 'The script can only see a crossing end when it remembers one starting, so --recovery keeps its state file.', 1093: 'Pass --notify-cmd with a command such as mail to have the script deliver the alert and the recovery itself.', 1094: 'Wire the script into a cron job or a monitoring system to get automatic alerts. Or set alert_every and use the Alerts panel on the canvas.', 1095: ], 1096: tip => 'Exit code 0 means no alert: the threshold was not crossed, or it was crossed and already reported in this period. Exit code 1 means it was crossed and reported now. Exit code 3 means a crossing that was reported has ended, which is what --recovery asks for. Exit code 2 means an error. When one run reports a crossing and a recovery together, exit code 1 wins.', 1097: routes => [], 1098: }, 1099: { 1100: id => 'geocode', 1101: part => 'For maintainers', 1102: title => 'Look up place names before anyone opens the map', 1103: lead => 'The bi-geocode script finds the coordinates of every place in a column and keeps them for the map.', 1104: steps => [ 1105: 'The script is installed as bi-geocode. In a copy of the source it is script/bi-geocode.', 1106: 'Pass --spec with the table, and --col with the column that holds the place names.', 1107: 'Give --col twice for a place split over two columns, such as --col Address --col Country.', 1108: 'For example: bi-geocode --spec table:virginia_counties --col county --region US.', 1109: 'Pass --text to add the same words to the end of each place, as Add to each place does on the map.', 1110: 'For example, --text \'Virginia, USA\' looks up Accomack as Accomack, Virginia, USA.', 1111: 'Pass --region with a country code, such as GB or US, when the names could be in several countries.', 1112: 'Pass --dry-run to look the places up without keeping the result.', 1113: 'Places the local data does not know are looked up on OpenStreetMap, one each second. Pass --offline to stop that.', 1114: 'Run it again at any time. Places that it already knows are not looked up twice.', 1115: ], 1116: tip => 'The map with a Place-name column then opens at once, because no place has to be looked up. The script needs Geo::Coder::List 0.39 and Geo::Coder::Free 0.48 or later. OpenStreetMap also needs Geo::Coder::OSM 0.03 or later. Exit code 0 means success.', 1117: routes => [], 1118: }, 1119: { 1120: id => 'settings', 1121: part => 'For maintainers', 1122: title => 'Change the program settings', 1123: lead => 'A file called database_bi.conf in the application folder changes how the program runs.', 1124: steps => [ 1125: 'Create database_bi.conf next to the script folder. It holds one Perl hash, such as { data_dir => \'/srv/data\' }.', 1126: 'data_dir is the folder that the home page lists. It can be a full path or a path inside the application folder.', 1127: 'uploads_dir is where dropped files are kept. Set it when the application folder cannot be written.', 1128: 'model_dir holds the saved canvases and settings. It must not be inside data_dir.', 1129: 'Set page_cache_dir to keep a copy of the Catalog and Tutorial pages on disc. page_cache_duration says for how long.', 1130: 'cache_dir is where the places found for maps, the extracts and the page cache are kept. CACHEDIR or CACHE_DIR in the environment wins over it.', 1131: 'Set time_zone to UTC, local or an offset such as +05:30. A time that ends in Z or +01:00 is then read on that clock. Names such as Europe/London are not read.', 1132: 'Set json_flatten to 1 to split nested JSON objects into columns, named by their path, such as address.city. Both settings apply to the whole server, not to one file.', 1133: 'Set alert_every, such as 15m, to have the server check every canvas that has alert limits. Set alert_notify_cmd to a shell command, such as mail, that delivers what it announces.', 1134: 'Set ai_api_key to show the Ask button and the AI choice on the insights page.', 1135: 'Restart the program after you change the file.', 1136: ], 1137: tip => 'Every setting is optional. Without the file, the program lists the data folder and keeps its own files in .bi and .uploads.', 1138: routes => [], 1139: }, 1140: { 1141: id => 'developers', 1142: part => 'For maintainers', 1143: title => 'Where this page lives', 1144: lead => 'This tutorial is part of the application. It is not in the Perl documentation.', 1145: steps => [ 1146: 'The text of this page is a list of chapters in lib/Database/BI/Tutorial.pm.', 1147: 'The page itself is templates/web/en/tutorial.html.tt. The route is GET /tutorial.', 1148: 'To add a chapter, add one entry to the list. Give it a title, a short lead, the steps, and the routes that it covers.', 1149: 'Each page finds its Help link through the action map in the same module. Add a new page action there.', 1150: 'Run prove -l t/tutorial.t. The test fails if a GET page has no chapter and no reason to be exempt.', 1151: 'Read README.md for how to start the program and run the full test suite.', 1152: ], 1153: tip => 'Keep the words simple. The test also checks that no step is a very long sentence.', 1154: routes => [], 1155: }, 1156: ); 1157: 1158: my @FAQ = ( 1159: { 1160: question => 'Where do I start?', 1161: answer => 'Click a file on the home page, then read A five-minute tour. Try the sales table: it is small.', 1162: }, 1163: { 1164: question => 'Will this change my data file?', 1165: answer => 'No. Sorting, filters, merges, charts and deleted rows change only what you see. Export writes a new file, and your source file stays as it was.', 1166: }, 1167: { 1168: question => 'I cannot see the button that the tutorial names.', 1169: answer => 'Some buttons appear only when they can work. Time range needs a date column. Ask needs an AI key. Copy link on a table needs a filter. Merge and the charts need an open table.', 1170: }, 1171: { 1172: question => 'How do I get back to where I was?', 1173: answer => 'Click a step in the breadcrumb under the title, or click Home at the top. Your browser Back button works too.', 1174: }, 1175: { 1176: question => 'How do I keep my work?', 1177: answer => 'Calculated columns, groups, lookups and date formats are saved for the file at once. For a view with filters and charts, save a canvas, or copy the link.', 1178: }, 1179: { 1180: question => 'My numbers sort or add up wrongly.', 1181: answer => 'The cells may hold text, such as a number with a unit. Charts and totals use only cells that read as numbers. Check the column in Column stats.', 1182: }, 1183: { 1184: question => 'The file is not in the list. What can I do?', 1185: answer => 'Put the file in the data folder, or open it from Browse your files. The program only lists files that it can read.', 1186: }, 1187: { 1188: question => 'A JSON file shows address as text, not columns.', 1189: answer => 'A nested object is shown as JSON text unless the maintainer sets json_flatten to 1. Then each value is its own column, such as address.city. A list is always shown as text.', 1190: }, 1191: { 1192: question => 'Can I open a file with one JSON object on each line?', 1193: answer => 'Yes. A file ending .jsonl or .ndjson is a JSON Lines file, and each line is a row. A large one is read a line at a time, so it does not fill the memory.', 1194: }, 1195: { 1196: question => 'A time near midnight falls on the wrong day.', 1197: answer => 'A time that ends in Z or an offset, such as +01:00, names one moment. If the maintainer set time_zone, it is moved to that clock before filters, ranges and buckets read it. Without it, the time is read as written. A time with no zone is always read as written, and the table shows every cell as it was written.', 1198: }, 1199: { 1200: question => 'The home address shows one file, not the list.', 1201: answer => 'The program was started with the name of that file. Click Home in the breadcrumb to see the list. To stop this, start the program without a file name.', 1202: }, 1203: { 1204: question => 'The program says that only one database can be opened.', 1205: answer => 'You named more than one file when you started the program. Name one, then use Merge or Combine on its page to add the others. To open a whole folder as one table, tick its files in Browse your files and click Combine selected.', 1206: }, 1207: { 1208: question => 'Can I open all the files in a folder as one table?', 1209: answer => 'Yes, if they are in the same format. Open the folder in Browse your files, click Select all, then click Combine selected. A source_file column names the file each row came from.', 1210: }, 1211: { 1212: question => 'The table says its extract is stale.', 1213: answer => 'The file has changed since its fast copy was made, so the file itself was read. Run bi-extract --all to make the copy again.', 1214: }, 1215: { 1216: question => 'An extracted column says (unparseable).', 1217: answer => 'The pattern did not match the value in that row. Those rows are kept and grouped together, so you can see how many there are.', 1218: }, 1219: { 1220: question => 'Delta shows no rows.', 1221: answer => 'The two columns hold the same value in every row, so Delta removed them all. Remove the filter label above the table to see the rows again.', 1222: }, 1223: { 1224: question => 'Export left out a column, or put the columns in a new order.', 1225: answer => 'Export saves the columns that the table shows now, in the order that it shows them. A column that you deleted is not saved. Reload the page to get it back.', 1226: }, 1227: { 1228: question => 'New columns appeared that are not in my file.', 1229: answer => 'A lookup or an extraction adds them. Open the Lookups or Extract fields panel to see them. Delete one there, or skip a lookup in this view.', 1230: }, 1231: { 1232: question => 'The table says its saved columns could not be added.', 1233: answer => 'The file has changed, and a saved column can no longer be worked out. The note names it. Click the panel the note names, then correct or delete it.', 1234: }, 1235: { 1236: question => 'A chart or map is blank after D3 or Leaflet was moved to another server.', 1237: answer => 'The pages only load scripts from the servers in the configuration. Set d3_url or the leaflet keys to the new address, and the page allows it.', 1238: }, 1239: { 1240: question => 'Can I show a canvas on another web site?', 1241: answer => 'Only on the sites that whoever runs the program has listed. The Share panel names them. On any other site the canvas is refused, so send the share link instead.', 1242: }, 1243: { 1244: question => 'Can someone on another computer open it?', 1245: answer => 'Only with a password. At first the program answers only the computer it runs on. Whoever runs it can set a password, then open it to others.', 1246: }, 1247: { 1248: question => 'The page says the server does not answer to that name.', 1249: answer => 'Open it as localhost or by its number address instead. To use a name, whoever runs the program adds it to allowed_hosts in the configuration file.', 1250: }, 1251: { 1252: question => 'A folder or file says it is not available here.', 1253: answer => 'Whoever runs the program has chosen which folders it may use, and that one is outside them. Choose a file or folder inside, or ask them to add it.', 1254: }, 1255: { 1256: question => 'Import from a web page refuses the address.', 1257: answer => 'The page is on this computer or a private network, and the program only reads pages on the public internet. Whoever runs it can name intranet sites it may read.', 1258: }, 1259: { 1260: question => 'Export says exports are saved only in the export folders.', 1261: answer => 'Whoever runs the program has chosen the folders exports go to. The Export panel opens on one of them, so save there.', 1262: }, 1263: { 1264: question => 'Export will not save into a folder whose name starts with a dot.', 1265: answer => 'Those folders hold settings for other programs, so saving there is refused. Choose another folder.', 1266: }, 1267: { 1268: question => 'Export says the name is already there and is not a plain file.', 1269: answer => 'A folder or a link has that name, and Export only replaces an ordinary file. Type another file name.', 1270: }, 1271: { 1272: question => 'Ask says the AI has been asked too often this hour.', 1273: answer => 'Whoever runs the program limits how often it asks the AI each hour. Try again later. Insights still work, without the AI wording.', 1274: }, 1275: { 1276: question => 'A chart says it cannot be drawn.', 1277: answer => 'The page says why, for example a column that the view does not have. Click Back, then choose other columns.', 1278: }, 1279: { 1280: question => 'The program will not open my file.', 1281: answer => 'Check the end of the file name. The program reads CSV, TSV, PSV, XLSX, XML, JSON, SQLite and Berkeley DB files.', 1282: }, 1283: { 1284: question => 'Accents and symbols look wrong in my file.', 1285: answer => 'Drop the file on the page again. The program reads Windows-1252 and UTF-16 files as well as UTF-8, and the table page says which one it used.', 1286: }, 1287: { 1288: question => 'My JSON file shows a list of tables, not rows.', 1289: answer => 'The file holds more than one list of rows, such as findings and hosts. Each list is a table. Click the one you want.', 1290: }, 1291: { 1292: question => 'The program says my JSON file holds no table.', 1293: answer => 'It needs a list of objects, or an object that holds one. A value inside a row that holds more data is shown as JSON text.', 1294: }, 1295: { 1296: question => 'The page is dark, but my saved chart is white.', 1297: answer => 'This is on purpose. Saved charts and printed pages always use the light colours, so that they look the same to whoever receives them.', 1298: }, 1299: { 1300: question => 'My text on a canvas is hard to read in the dark theme.', 1301: answer => 'A colour that you pick stays the same in both themes. Tick Follow the theme, or give the card a background colour too.', 1302: }, 1303: { 1304: question => 'I cannot find the controls on my text card.', 1305: answer => 'The card hides its frame and header until you point at it. Point at the text, or double-click it to open its settings.', 1306: }, 1307: { 1308: question => 'My text card is too tall or too short.', 1309: answer => 'A card one row high is as tall as its text when its row holds only text. Next to a chart, it is as tall as the chart. Choose 2 rows high in the Size menu for a taller card.', 1310: }, 1311: { 1312: question => 'Undo did not bring back my text card.', 1313: answer => 'Undo and Redo step through filters and other page state. They do not undo a change to a card, so a removed text card has to be added again.', 1314: }, 1315: { 1316: question => 'Can I open a MariaDB or MySQL database?', 1317: answer => 'Yes, once the server has been added to mariadb_servers in the configuration file. The home page then has a card for it, which lists its tables. Choose a table to open it. You can also type mariadb:shop/orders in the path box, or in Merge and Combine. Only a page of the table is read at a time, until you filter it.', 1318: link => { text => 'the configuration file', href => 'https://github.com/nigelhorne/Database-BI#configuration' }, 1319: }, 1320: { 1321: question => 'A number filter leaves out my blank cells.', 1322: answer => 'This is on purpose. Less than and greater than compare numbers, so a blank or a word in the cell does not match. Use the empty filter to find blank cells.', 1323: }, 1324: { 1325: question => 'The program does not remember my theme.', 1326: answer => 'The choice is saved in this browser. A private window forgets it when you close the window. If the browser will not save it, the Preferences page says so.', 1327: }, 1328: { 1329: question => 'My chart is empty.', 1330: answer => 'Check that you chose a number column for the value. Check also that your filters still show some rows.', 1331: }, 1332: { 1333: question => 'A merge added blank cells.', 1334: answer => 'The two tables had no matching value in the key columns. Check the spelling and the type of the values.', 1335: }, 1336: { 1337: question => 'My changes disappeared.', 1338: answer => 'A filter or a join lives in the page address. Save the view as a canvas, or copy the link before you close the page.', 1339: }, 1340: { 1341: question => 'A table in my SQLite file says Cannot be opened.', 1342: answer => 'The name of that table has characters other than letters, digits and underscores, such as a colon or a space. The other tables in the file still open. To open this one, rename it in a copy of the file. The message shows the command to use.', 1343: }, 1344: { 1345: question => 'The page says Page not found.', 1346: answer => 'The address names a table, a canvas or a page that is not there. Use the breadcrumb or Go to Home to find it again.', 1347: }, 1348: { 1349: question => 'Some words are not spelled the way I expected.', 1350: answer => 'The pages follow the language your browser asks for. English (United States) gets American spelling, such as color. Any other English gets British spelling, such as colour.', 1351: }, 1352: ); 1353: 1354: my @GLOSSARY = ( 1355: { term => 'Aggregate', meaning => 'Work one number out of many, such as a sum, an average or a count.' }, 1356: { term => 'Berkeley DB', meaning => 'A database file that ends in .db.' }, 1357: { term => 'Breadcrumb', meaning => 'The row of links that shows each page between Home and this one.' }, 1358: { term => 'Browser', meaning => 'The program that shows web pages, for example Firefox or Chrome.' }, 1359: { term => 'Bin', meaning => 'One bar of a histogram: a range of values, such as 10 to 20.' }, 1360: { term => 'Canvas', meaning => 'A saved page with several tables and charts.' }, 1361: { term => 'Card', meaning => 'One box on the home page or on a canvas. It holds a file, a chart or a table.' }, 1362: { term => 'Cell', meaning => 'One value in a table, at one row and one column.' }, 1363: { term => 'Category', meaning => 'A column whose values are names or labels, such as region. A chart groups rows by it.' }, 1364: { term => 'Chart', meaning => 'A picture of numbers, for example a bar chart.' }, 1365: { term => 'Chip', meaning => 'A small label above a table that names an active filter. Click its x to remove it.' }, 1366: { term => 'Column', meaning => 'One kind of value in a table, for example the price column.' }, 1367: { term => 'Combine', meaning => 'Put the rows of one file under the rows of another file.' }, 1368: { term => 'Cross-row column', meaning => 'A column worked out from several rows, for example a running total.' }, 1369: { term => 'CSV', meaning => 'A text file with values separated by commas.' }, 1370: { term => 'Data file', meaning => 'A file with rows and columns that the program can read.' }, 1371: { term => 'Delta', meaning => 'Keep only the rows where two columns hold different values.' }, 1372: { term => 'Cross-filter', meaning => 'Click a bar or slice on a canvas, and the other cards show only the matching rows.' }, 1373: { term => 'Duplicate', meaning => 'A row that is exactly the same as another row.' }, 1374: { term => 'Export', meaning => 'Write the rows that you see to a new file.' }, 1375: { term => 'Expression', meaning => 'A small formula, for example revenue - cost.' }, 1376: { term => 'Filter', meaning => 'A rule that hides rows which do not match.' }, 1377: { term => 'Geocode', meaning => 'Change a place name into a latitude and a longitude.' }, 1378: { term => 'Join', meaning => 'Add columns from a second table by matching a shared value. The screen calls it Merge.' }, 1379: { term => 'Key', meaning => 'A column whose values match a column in another table, such as a customer number.' }, 1380: { term => 'Lookup', meaning => 'Columns added from a second file and saved, so they appear each time you open the table.' }, 1381: { term => 'Maintainer', meaning => 'The person who installs and runs the program and sets its settings.' }, 1382: { term => 'Merge', meaning => 'Add columns from a second table by matching a shared value.' }, 1383: { term => 'Outlier', meaning => 'A value far from the others, such as one very large sale.' }, 1384: { term => 'Panel', meaning => 'A box that opens under the toolbar when you click a button that ends in three dots.' }, 1385: { term => 'Pattern', meaning => 'A short rule that describes text, used to pull a part out of a cell.' }, 1386: { term => 'Percentile', meaning => 'The value below which a share of the rows fall. The 90th percentile is above 90 of 100 rows.' }, 1387: { term => 'JSON Lines', meaning => 'A text file with one JSON object on each line.' }, 1388: { term => 'Pivot table', meaning => 'A grid that summarises rows and columns.' }, 1389: { term => 'PSV', meaning => 'A text file with values separated by pipe characters.' }, 1390: { term => 'Row', meaning => 'One record in a table.' }, 1391: { term => 'Schema', meaning => 'The list of tables in a database file, with the columns of each.' }, 1392: { term => 'Server', meaning => 'The program on a computer that sends pages to your browser.' }, 1393: { term => 'SQLite', meaning => 'A database file that can hold more than one table.' }, 1394: { term => 'Table', meaning => 'Rows and columns on the screen. A database file can hold several tables.' }, 1395: { term => 'Toolbar', meaning => 'The row of buttons above a table, such as Merge, Combine and the charts.' }, 1396: { term => 'Time bucket', meaning => 'One group for each hour, day, month or other period.' }, 1397: { term => 'Time zone', meaning => 'The clock that times are read on, set by the maintainer.' }, 1398: { term => 'Time range', meaning => 'A recent window, such as the last 30 days, worked out from today.' }, 1399: { term => 'TSV', meaning => 'A text file with values separated by tab characters.' }, 1400: { term => 'URL', meaning => 'The address of a web page, shown in the address bar.' }, 1401: { term => 'XLSX', meaning => 'An Excel spreadsheet file.' }, 1402: { term => 'XML', meaning => 'A text file with data inside tags.' }, 1403: ); 1404: 1405: # Routes that are GET pages but are not chapters. Every entry needs a reason: 1406: # it is a decision to leave a page out of the tutorial, not an accident. 1407: # Actions that render a page, mapped to the chapter that helps with that page. 1408: # The layout turns this into a "Help: ..." link beside the main Tutorial link, 1409: # so a reader on the pie chart screen lands on the pie chart chapter. A new 1410: # page action belongs here; t/tutorial.t checks that every covered GET route 1411: # has an entry. 1412: my %ACTION_CHAPTERS = ( 1413: index => 'open-file', 1414: browse => 'other-files', 1415: open_file => 'read-table', 1416: import_url => 'web-table', 1417: view => 'read-table', 1418: join_tables => 'join', 1419: combine_tables => 'combine', 1420: export_data => 'export', 1421: tables_view => 'other-files', 1422: graph_view => 'line-chart', 1423: pie_view => 'pie-chart', 1424: heatmap_view => 'heatmap-chart', 1425: bar_view => 'bar-chart', 1426: folder_view => 'folder', 1427: pivot_view => 'pivot', 1428: stats_view => 'stats', 1429: insights_view => 'insights', 1430: scatter_view => 'scatter-chart', 1431: stacked_view => 'stacked-chart', 1432: combo_view => 'combo-chart', 1433: treemap_view => 'treemap-chart', 1434: histogram_view => 'histogram-chart', 1435: wordcloud_view => 'wordcloud-chart', 1436: map_view => 'map-chart', 1437: canvas_render => 'canvas', 1438: catalog_view => 'catalog', 1439: canvases_view => 'canvas', 1440: preferences => 'preferences', 1441: login_form => 'log-in', 1442: ); 1443: 1444: my %EXEMPT_ROUTES = ( 1445: '/a/:id/visual/:n/:fmt' => 'per-visual CSV/PNG download; not a navigable page', 1446: '/api/analyses' => 'JSON for the saved-canvas list', 1447: '/api/analyses/:id' => 'JSON for one saved canvas', 1448: '/api/analyses/:id/export' => 'JSON export of one saved canvas', 1449: '/api/analyses/:id/alerts' => 'JSON for the limits and recent alerts in a canvas\'s Alerts panel', 1450: '/api/columns' => 'JSON list of columns for the join and filter panels', 1451: '/api/dirs' => 'JSON folder list for the browse and export panels', 1452: '/api/range' => 'JSON min/max ISO dates for the filter date-picker constraints', 1453: '/api/stat' => 'JSON file details for the home-page tooltips', 1454: '/calc/list' => 'JSON list of calculated fields for the Calc panel', 1455: '/dates/list' => 'JSON list of date formats for the Date panel', 1456: '/geo/list' => 'JSON list of saved coordinate column preferences for the Map panel', 1457: '/embed/:id' => 'chrome-less embed view; requires a share token and is not a standalone page', 1458: '/groups/list' => 'JSON list of value groups for the Group panel', 1459: '/extract/list' => 'JSON list of the stored field extractions of a dataset', 1460: '/lookups/list' => 'JSON list of the stored lookups of a dataset', 1461: '/share/:id' => 'shared read-only canvas view; requires a signed token and cannot be navigated to directly', 1462: '/tutorial' => 'this page', 1463: ); 1464:Mutants (Total: 2, Killed: 2, Survived: 0)
1465: sub intro { return \@INTRO }
Mutants (Total: 2, Killed: 2, Survived: 0)
1466: sub chapters { return \@CHAPTERS }
Mutants (Total: 2, Killed: 2, Survived: 0)
1467: sub faq { return \@FAQ }
Mutants (Total: 2, Killed: 2, Survived: 0)
1468: sub glossary { return \@GLOSSARY } 1469: 1470: sub parts { ●1471 → 1473 → 1487 1471: my @parts; 1472: 1473: for my $chapter (@CHAPTERS) { 1474: my $name = $chapter->{part}; 1475:
Mutants (Total: 1, Killed: 1, Survived: 0)
1476: if (!@parts || $parts[-1]{name} ne $name) { 1477: push @parts, { 1478: name => $name, 1479: id => _slug($name), 1480: chapters => [], 1481: }; 1482: } 1483: 1484: push @{ $parts[-1]{chapters} }, $chapter; 1485: } 1486:
Mutants (Total: 2, Killed: 2, Survived: 0)
1487: return \@parts; 1488: } 1489: 1490: sub covered_routes { ●1491 → 1493 → 1499 1491: my %routes; 1492: 1493: for my $chapter (@CHAPTERS) { 1494: for my $route (@{ $chapter->{routes} // [] }) { 1495: $routes{$route} = $chapter->{id}; 1496: } 1497: } 1498:
Mutants (Total: 2, Killed: 2, Survived: 0)
1499: return \%routes; 1500: } 1501: 1502: sub exempt_routes { 1503: return { %EXEMPT_ROUTES }; 1504: } 1505: 1506: sub chapter_for_action { ●1507 → 1512 → 1516 1507: my $action = $_[1]; 1508: return unless defined $action; 1509: 1510: my $id = $ACTION_CHAPTERS{$action} or return; 1511: 1512: for my $chapter (@CHAPTERS) {
Mutants (Total: 2, Killed: 2, Survived: 0)
1513: return $chapter if $chapter->{id} eq $id; 1514: } 1515: 1516: return; 1517: } 1518: 1519: sub _slug { 1520: my ($text) = @_; 1521: 1522: my $slug = lc $text; 1523: $slug =~ s/[^a-z0-9]+/-/g; 1524: $slug =~ s/\A-+|-+\z//g; 1525:
Mutants (Total: 2, Killed: 2, Survived: 0)
1526: return $slug; 1527: } 1528: 1529: 1; 1530: 1531: =head1 NAME 1532: 1533: Database::BI::Tutorial - the chapters of the in-application tutorial 1534: 1535: =head1 SYNOPSIS 1536: 1537: use Database::BI::Tutorial; 1538: 1539: for my $part (@{ Database::BI::Tutorial->parts }) { 1540: print $part->{name}, ": ", scalar @{ $part->{chapters} }, " chapters\n"; 1541: } 1542: 1543: my $chapter = Database::BI::Tutorial->chapter_for_action('bar_view'); 1544: print $chapter->{title}, "\n" if $chapter; 1545: 1546: =head1 DESCRIPTION 1547: 1548: The tutorial that the application shows at C<GET /tutorial> is built from the 1549: data in this module. A chapter is one feature: a title, a short lead, numbered 1550: steps, and the C<routes> that it covers. The template renders the chapters in 1551: order, so adding a feature means adding a hash here, not editing HTML. 1552: 1553: A chapter may also have a C<walkthrough>: a worked example with a C<title>, an 1554: C<intro>, a list of C<steps> that each say what to C<do> and what to C<see>, 1555: and a C<result>. The template shows it as one box, and the contents marks the 1556: chapter so a reader can find it. 1557: 1558: C<t/tutorial.t> checks that every GET page in L<Database::BI> is either covered 1559: by a chapter or listed in C<exempt_routes()> with a reason. Keep the sentences 1560: short: the same test fails a lead, step, tip or walk-through sentence longer 1561: than 25 words. 1562: 1563: C<chapter_for_action()> maps a controller action to the chapter that helps with 1564: that page. The application calls it from a C<before_render> hook and the shared 1565: layout shows the result as a C<Help: ...> link beside the main Tutorial link. 1566: A new page action belongs in C<%ACTION_CHAPTERS>; the test fails until it is 1567: there. 1568: 1569: =head1 FUNCTIONS 1570: 1571: Each is called as a class method or a plain function; none takes arguments 1572: except C<chapter_for_action>. The returned structures are the module's own 1573: data: read them, do not change them. 1574: 1575: =head2 intro 1576: 1577: =head3 API SPECIFICATION 1578: 1579: =head4 OUTPUT 1580: 1581: [ 'string', ... ] # the introduction's sentences 1582: 1583: =head2 chapters 1584: 1585: =head3 API SPECIFICATION 1586: 1587: =head4 OUTPUT 1588: 1589: [ { 1590: id => 'string', # anchor, unique 1591: part => 'string', # the part the chapter belongs to 1592: title => 'string', 1593: lead => 'string', 1594: steps => 'arrayref', # sentences 1595: tip => 'string', # optional 1596: try => 'hashref', # optional; { href, label } 1597: routes => 'arrayref', # the GET routes the chapter covers 1598: walkthrough => 'hashref', # optional; { title, intro, steps => [ { do, see } ], result } 1599: }, ... ] 1600: 1601: In the order the page shows them. 1602: 1603: =head2 faq 1604: 1605: =head3 API SPECIFICATION 1606: 1607: =head4 OUTPUT 1608: 1609: [ { question => 'string', answer => 'string', link => { text, href }? }, ... ] 1610: 1611: C<link> makes the words C<text>, which occur once in C<answer>, a link to C<href>. 1612: 1613: =head2 glossary 1614: 1615: =head3 API SPECIFICATION 1616: 1617: =head4 OUTPUT 1618: 1619: [ { term => 'string', meaning => 'string' }, ... ] 1620: 1621: =head2 parts 1622: 1623: =head3 API SPECIFICATION 1624: 1625: =head4 OUTPUT 1626: 1627: [ { name => 'string', id => 'string', chapters => 'arrayref' }, ... ] 1628: 1629: The chapters grouped by C<part>, in order. C<id> is the part name in lower 1630: case with each run of other characters replaced by C<->. A new list is built 1631: on each call. 1632: 1633: =head2 covered_routes 1634: 1635: =head3 API SPECIFICATION 1636: 1637: =head4 OUTPUT 1638: 1639: { '/route' => 'chapter-id', ... } 1640: 1641: A route named by two chapters maps to the later one. 1642: 1643: =head2 exempt_routes 1644: 1645: =head3 API SPECIFICATION 1646: 1647: =head4 OUTPUT 1648: 1649: { '/route' => 'reason', ... } # a copy: GET pages with no chapter, and why 1650: 1651: =head2 chapter_for_action 1652: 1653: =head3 API SPECIFICATION 1654: 1655: =head4 INPUT 1656: 1657: $action # a controller action name, e.g. 'bar_view' 1658: 1659: =head4 OUTPUT 1660: 1661: A chapter hashref (as C<chapters> returns), or an empty list 1662: 1663: An undefined or unknown action returns an empty list. It must be called as a 1664: class method: the action is the second argument. 1665: 1666: =head1 AUTHOR 1667: 1668: Nigel Horne C<< <njh@nigelhorne.com> >> 1669: 1670: =head1 LICENCE AND COPYRIGHT 1671: 1672: Copyright 2026 Nigel Horne. 1673: 1674: Usage is subject to the GPL2 licence terms. 1675: 1676: =cut