NiVO / BY TECHNOGISGermany · Indonesia
Tabular record interpretation

Multiline CSV Records: Count Drone Inventory Entries Beyond Text Lines

Inspect quoted newlines, field boundaries and parser settings before treating a CSV line count as the size of a drone-derived inventory.

Multiline CSV Records: Count Drone Inventory Entries Beyond Text Lines

Define what is being counted before comparing totals

A drone-derived inventory may include a description that continues onto another line inside one quoted CSV field. A text editor then shows more lines than there are inventory entries. In a NiVO handoff discussion, a mismatch between a line count and a table count should therefore start a record-boundary investigation. This tutorial separates physical text lines, parsed records and accepted inventory entries. It uses a deliberately constructed note table, without coordinates or customer information. It does not claim that a particular NiVO product exports this format or that any actual delivery has missing assets.

Begin with the accepted file and the count that the producer intended to report. Identify whether that count includes the header, blank records, rejected records or entries outside the selected scope. Preserve the original bytes and record its revision before opening a working copy. A spreadsheet view can be useful for inspection, but its displayed row numbers are not sufficient evidence of the original text structure. Keep the original counting procedure alongside the reported total so another analyst can determine whether the two numbers describe the same population.

Read quoting rules as record structure

RFC 4180 is an informational description of a common CSV format, rather than a guarantee that every application implements one identical dialect. Its format discussion permits quoted fields containing line breaks, commas and double quotes, with an embedded quote represented by two quotes. Those rules explain why splitting text at every newline or comma can break a valid record. The important boundary is the one recognized by the agreed CSV dialect. A continuation line inside a description is part of that field, not automatically a second observed item.

Document the delimiter, quote character, character encoding and header convention for the actual exchange. Keep those syntax decisions separate from column types and project meaning. A parser can recover the right number of fields while a later import still applies an inappropriate datatype or associates a note with the wrong asset. Conversely, changing a column declaration does not repair a record that was split incorrectly before typing occurred. Inspect both stages and preserve evidence of where a discrepancy first appears rather than repeatedly adjusting settings until the final count happens to match.

NiVO VTOL V7 with a white fuselage, lift rotors, and yellow wing tips
NiVO VTOL V7 with a white fuselage, lift rotors, and yellow wing tips.Source: NiVO / TechnoGIS catalogue materials supplied by the site owner · Catalogue photo
Product context only; this photograph does not depict the constructed examples in this article.

Trace a small constructed multiline note table

The teaching text below has a header and two data records. The first note spans two physical text lines while remaining inside one quoted field. There are four nonempty physical lines in this displayed example, but only two data entries under the stated header convention. The letters A and B are fictional references. The note is explanatory text, not an inspection finding. No actual inventory, source export or parser output is supplied. Read from the opening quote through the matching closing quote before deciding where the next record begins.

Use this simple distinction when diagnosing a real difference between a command-line line count and a receiving table. Record the physical-line total as a text property and the parsed-record total as a separate result. Neither establishes inventory completeness on its own. A file can contain duplicate entries, a partial selection or records referring to an obsolete revision while its syntax remains correct. Resolve those project questions against the accepted register and scope. Do not delete embedded newlines merely to make a text count equal a previously reported number.

asset,note
A,"inspect upper
and lower face"
B,"no extra note"

Inspect parsed records without rewriting the accepted file

Python documents opening CSV files with an empty newline argument so the csv module handles newline interpretation. Its reader exposes parsed rows and a line_num attribute that counts source lines consumed, which can differ from records returned. The read-only recipe below uses an explicit comma dialect, a declared UTF-8 encoding and strict parsing. The filename is illustrative. The recipe has been reviewed against documentation; no Python execution on an actual inventory is claimed. Confirm the encoding and dialect before applying it to an accepted delivery.

The first parsed row is treated as the header by this recipe, so it is not appropriate unchanged for a headerless table. Comparing row width with header width is a useful structural check, not full validation. The strict setting can report malformed CSV input but does not establish a complete application schema or project acceptance. Keep parser errors and the source-line context rather than silently skipping problematic input. The printed record ordinal is a position within this reading operation, not a stable asset identifier suitable for a join across revisions.

# Teaching filename; confirm header, encoding and dialect first.
import csv

with open("accepted-notes.csv", encoding="utf-8", newline="") as stream:
    reader = csv.reader(stream, delimiter=",", quotechar='"', strict=True)
    header = next(reader)
    for ordinal, row in enumerate(reader, start=1):
        print(ordinal, reader.line_num, len(row), len(row) == len(header))

Compare the actual receiving application and its selection

GDAL documents quoted complex CSV attributes, including newlines, and exposes separator and header controls in its CSV driver. That is a reason to inspect the chosen reader settings rather than assume a generic text split describes the layer. For a real import, record the software version, selected layer, recognized columns and reported feature count. Compare selected known notes with the original fields, including embedded line breaks and escaped quotation marks. Keep the inspection focused on actual values rather than accepting a matching total as sufficient evidence.

If the receiver changes note formatting for display, distinguish that presentation from changes to stored content or record association. Compare stable asset references and the exact intended fields on both sides. A new single-line export may be a legitimate communication derivative, but its transformation should be deliberate and documented. Preserve the accepted multiline original and record how the derivative was produced. When a parser rejects a record, investigate the raw text and exchange contract before editing it; a convenient manual repair can hide the cause or join two unrelated notes.

Deliver the counting convention with the inventory

A useful handoff states which file revision was inspected, how its header was handled, which dialect was used and what the reported count includes. Keep the parsed record total, any rejected-record evidence and the project scope together. Include examples from the actual delivery that exercise quoted text, without replacing authoritative content with the teaching rows. Another analyst should be able to reproduce the counting convention and explain why a multiline note remains associated with one entry. Resolve duplicates and missing identifiers separately from the question of text-line boundaries.

For NiVO inventory preparation, this gives a precise response to an apparently inconsistent count: identify the unit being counted, inspect the record parser, then compare the accepted population. It complements field-type and identifier reviews while keeping syntax evidence distinct from survey quality. A successful parse does not prove complete coverage, correct classification or a measured location. Preserve those assessments with their own supporting records. Deliver the original table and the interpretation needed to read it, so recipients can investigate a discrepancy without guessing which newline represents a new asset.

Technical references

  1. RFC 4180 — common CSV format and quoted field rules ↗
  2. Python csv — newline handling, strict dialect and line_num ↗
  3. GDAL CSV driver — quoted complex attributes and reader options ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team