Significant refactoring of CountMatch and its test suite. Changes:
Separate traffic count categorization from reading raw data. reader.read now returns a set of counts, which are parsed into PTCs and STTCs using permcount.PermCountProcessor.
Derived value and growth factor calculation now occur within permcount.PermCountProcessor, but are governed by separate derivedval and growthfactor modules. This allows alternative growth factor calculators, or more derived value calculators with more sophisticated imputers, to be slotted into PermCountProcessor in the future.
Code for calculating derived values, like AADT and D_ijd, has been further modularized. There is now a separate class method for calculating each derived value (except for D_ijd, DoM_ijd, and other values that use the day-of-month ADT, but the class structure makes it easy for us to split these up if needed). Each derived value calculator class defines or inherits these methods, making it possible to build complex calculators from simple ones.
There's now a metaclass registry-based class instance initializer for both derived value and growth factor calculators, inspired by the Baseband package's VDIF header module.
Resolves #32.
Aside from the usual code read-through for this PR, we need to:
Check if there are variants of all old tests - no point in dropping well-designed and useful ones!
Compare whether the PTC and STTC dictionaries produced by this version of CountMatch are identical to rdr.sttcs and rdr.ptcs produced by older versions of CountMatch. The refactoring shouldn't have changed any final outputs.
Significant refactoring of CountMatch and its test suite. Changes:
reader.read
now returns a set of counts, which are parsed into PTCs and STTCs usingpermcount.PermCountProcessor
.permcount.PermCountProcessor
, but are governed by separatederivedval
andgrowthfactor
modules. This allows alternative growth factor calculators, or more derived value calculators with more sophisticated imputers, to be slotted intoPermCountProcessor
in the future.D_ijd
, has been further modularized. There is now a separate class method for calculating each derived value (except forD_ijd
,DoM_ijd
, and other values that use the day-of-month ADT, but the class structure makes it easy for us to split these up if needed). Each derived value calculator class defines or inherits these methods, making it possible to build complex calculators from simple ones.Resolves #32.
Aside from the usual code read-through for this PR, we need to:
rdr.sttcs
andrdr.ptcs
produced by older versions of CountMatch. The refactoring shouldn't have changed any final outputs.