Open ericnost opened 10 months ago
Something like this I think is a more straightforward way of getting facilities. If we moved "get_active_facilities()` or a copy of it to DataSetResults, then we could also create a "active=True" flag.
from ECHO_modules.make_data_sets import make_data_sets
ds = make_data_sets(["Facilities"]) # Create a DataSet for handling the data
erie_facs = ds["Facilities"].store_results(region_type="County", region_value=["ERIE"], state="NY", active=True) # Store results for this DataSet as a DataSetResults object
erie_facs.dataframe # Show the results as a dataframe
Currently, there are several functions in
utilities.py
that seem like they could be methods of the DataSetResults class because they are mostly used on data that has already been loaded in a DataSetResults instance.For instance, instead of this:
We could do something like:
Eventually, perhaps even other utilities like
get_active_facilities()
andget_top_violators()
could move too. Currently, that would break the report cards generating process, I believe. It's also true that these have less to do with the program specific data that's usually stored in a DataSetResults instance. However, it's also the case that an area's facilities can be loaded usingds = make_data_sets(["Facilities"])
get_active_facilities()
andget_top_violators()
could then become methods for those specific DataSetResults instances.