MultiQC set sample name as multiple path parts

We’re creating a tool which will use varifier on multiple variant-calling pipline outputs. On the way to this, I thought I’d make and contribute a “varifier” module. varifier just stores it’s output in a “summary_stats.json” file, with no information to specify the sample in it. Thus, I was planning on getting that from the naming of the parent directories.

I’ve now spent hours reading the docs about creating module, and looked at example modules, etc., etc.

The “A typical example . . .” part in the section on “Custom sample names” seems relevant. But the “root=____” setting seems to imply that the single parent path part of the root directory will be enough to uniquely specify the name. But, in our case (and likely others) we’ll need to uniquely id the sample name by (at least) two directory path parts.
E.g. analysis_dir/sample_1/pipline1/varifier/summary_stats.json

Maybe the unique name requirement is already handled by the s_name parameter in self.clean_s_name. But it looks/seems like not properly setting the root might break things like the use of the --dirs parameter.
I can handle our specific use case, because I know the path pattern. But I’d like this to be portable to anyone using a (me-contributed) varifier module. Thus, my thinking is to use pathlib.Path(___),relative_to(analysis_dir) . . . to figure out
all/only the sample root segments.
But maybe it would be simple enough to just have it use the analysis_dir as the root???
I don’t see an obvious way for a module to get the value of the anaysis_dir path (possibly passed in on the command line). Maybe that is a key in the dictionary returned for each found file?