dbprocessing.inspector.inspector¶
- class dbprocessing.inspector.inspector(filename, dbu, product, **kwargs)[source]¶
ABC for inspectors to be sure the user has implemented what is required
Provides utility routines common to many inspectors
Methods
go through the filename, extract first valid YYYYMMDD as a datetime
inspect
(filename, kwargs)Override this method to implement an inspector
Attributes
- abstract inspect(filename, kwargs)[source]¶
Override this method to implement an inspector
If the input file is not a match for this product, nothing else should be updated.
If the input file is a match for the product, must update
params
dict ofdiskfile
with the following keys, which map directly to columns of thefile
table in the database:- utc_file_date (
date
) Characteristic date of the file. (
utc_file_date
)- utc_start time (
datetime
) Timestamp of first record in the file. (
utc_start_time
)- utc_stop time (
datetime
) Timestamp of last record in the file. (
utc_stop_time
)- version (
Version
) Version of the file. (
interface_version
,quality_version
,revision_version
)
The following keys may be updated, but are optional:
The inspector may use the non-private instance attributes of
this class
, including access to the database (although this should be done with care, as the inspector is called during active phases of processing). It is also expected that the inspector will open the file for reading; writing to the data file is highly discouraged at this point.- Parameters
- filenamestr
Not used; use
filename
attribute instead.- kwargsdict
Keyword arguments provided in
inspector.arguments
.
- Returns
- any
None
if the file passed in is not a match for the product, and anything else if it is.
- utc_file_date (
- filenameregex¶
Regular expression that will match a valid filename, derived from
filenameformat
. (str
)
- diskfile¶
File metadata to populate. (
Diskfile.Diskfile
)
Release: 0.1.0 Doc generation date: Feb 10, 2022