-
Notifications
You must be signed in to change notification settings - Fork 32
Reorganize ecm_prep.py #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
d12e4c2
to
d217f1e
Compare
295bcab
to
d244b6f
Compare
scout/ecm_prep.py
Outdated
@classmethod | ||
def load_json(cls, filepath: Path) -> dict: | ||
"""Loads data from a .json file | ||
class ECMUtils: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is similar to ECMPrep
, but ECMPrep
is meant to store methods that update Measure
and MeasurePackage
instances. It might make sense to merge the two since they both contain common static methods used throughout the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I like having them separate as isolating the prepare_measures
and prepare_packages
functions is useful. I'm not sure that split_clean_data
should be in ECMPrep
vs. ECMUtils
since the nature of that function seems more related to the latter.
Also, isn't it confusing to have a class named ECMUtils
and a separate module named utils.py
? Is there another candidate that would differentiate better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I changed the location of split_clean_data and changed the class name to ECMPrepHelper
12f148e
to
121debc
Compare
Thanks for the helpful summary @aspeake. Generally looks good but a few small questions, in addition to my comment above:
|
6b23ec1
to
14f0317
Compare
Yes, those types of updates will come in future PR(s). I did not break up any functions or update logic here, only reorganized location of the methods. |
Fixes #438
Improve encapsulation of ecm_prep.py by breaking out code into other modules. Only the
main()
function in ecm_prep.py exists outside of a class now. Below is a summary of changes.JsonIO
containing json file handling methods previously in ecm_prep.UtilsMyEncoder
that was previously stored in ecm_prep.pyPrintFormat
containing output format methods previously stored in ecm_prep.py (eg, verboseprint())PrintFormat.verboseprint
in ecm_prep.py and in run.pyUsefulVars
previously in ecm_prep.pyUsefulInputFiles
previously in ecm_prep.pyECMUtils
class in ecm_prep.py to store static methodsECMPrep
class in ecm_prep.py to store static methods for altering Measure and MeasurePackage instancesprepare_measures()
,prepare_packages()
, andsplit_clean_data()
EPlusGlobals
class and associated testsbreakout_mseg()
to an instance method of the Measure classTo-do in a future PR
scout/ecm_prep/
which contains:ecm_prep.Utils
Measure
Package
scout ecm_prep
that calls scout/ecm_prep/ecm_prep.py`