sgMergeFiles: Merge a batch of raw SG files with their receiver...

View source: R/sgMergeFiles.R

sgMergeFilesR Documentation

Merge a batch of raw SG files with their receiver database(s).

Description

Determines which files are redundant, new, or partially new. Does *not* run the tag finder.

Usage

sgMergeFiles(files, j, dbdir = MOTUS_PATH$RECV)

Arguments

files

either a character vector of full paths to files, or the full path to a directory, which will be searched recursively for raw sensorgnome data files.

j

job, whose ID will be recorded with records of new / changed files.

dbdir

path to folder with existing receiver databases Default: MOTUS_PATH$RECV

Details

Any new content from files is merged into the files and fileContents tables of the receiver DBs.

Files are disposed of like so:

  • any files which are symlinks are deleted after merging their target's contents; i.e. the symlink is deleted, not the file it points to.

  • files whose path has MOTUS_PATH$FILE_REPO as a prefix are left as-is

  • files whose path does not have MOTUS_PATH$FILE_REPO as a prefix, and which either are new or have new content are moved to MOTUS_PATH$FILE_REPO/serno/YYYY-MM-DD

  • remaining files are moved to MOTUS_PATH$TRASH

Value

a list with two items:

  • info- a data_frame reporting the details of each file, with these columns:

    • name - full path to filename

    • use - TRUE iff data from this file will be incorporated in this run (i.e. the file is new, or has more content than its previous version)

    • new - TRUE iff a file of this name was not yet in database

    • done - TRUE iff this is a compressed file and we have its full contents

    • corrupt - TRUE the file was compressed but corrupted

    • small - TRUE iff the file contents are shorter than existing contents for that file in the receiver DB

    • partial - TRUE iff this is a partial compressed file for which an uncompressed version is in the same batch

    • serno - serial number of the receiver, parsed from this filename

    • monoBN - monotonic boot session, parsed from filename

    • ts - starting timestamp, parsed from filename

  • resumable - a logical vector indicating the tag finder can be run with –resume for each subset of files from a distinct (serno, monoBN) pair. The vector has names consisting of paste(serno, monoBN).

Returns NULL if no valid sensorgnome data files were found.

Author(s)

John Brzustowski jbrzusto@REMOVE_THIS_PART_fastmail.fm

See Also

sgRunNewFiles, which calls this function and then calls sgFindTags as appropriate.


MotusWTS/motusServer documentation built on Aug. 8, 2024, 10:23 p.m.