FAQ and other topics¶
Copying the web page around¶
The web page is completely stand-alone. You can copy it by copying the
directory you passed to prettyresults.ResultTree.generate_web()
and
open it in any computer using a web browser. Visualizing the web does NOT
need Inernet access.
Web page browser compatibility¶
The web page should be compatible with any major web browser. It has been tested under Firefox 67 and Chrome 75.
Result IDs: qualified and unqualified¶
Each result has an ID that uniquely identifies it. In this context, IDs can be of two types:
- Unqualified ID. An unqualified ID identifies a result in the context of its container.
If a container result has three children, their unqualified IDs must be different. However,
they may be the same as other container’s children. Whenever you create a new result using
prettyresults.results.ContainerResult
add_xxxxx methods, the ID you provide is an unqualified ID. An unqualified ID is similar to a relative path in a filesystem. - Qualified ID. A qualified ID uniquely identifies a result within a ResultTree. It is the concatenation of all parent container unqualified IDs, separated by dots. It is similar to an absolute path in a filesystem.
In this example (see Tutorial for snippets of the source code), we have the following results:
root
. This is the root of the result tree. It is implicitly added when the ResultTree gets created.region
. A ContainerResult with:bar
. A FigureResult with a bar plot.freqs
. A TableResult with a frequency table.
channel
. A ContainerResult with:bar
. A FigureResult with a bar plot.freqs
. A TableResult with a frequency table.
channel-by-region
. A ContainerResult with:bar
. A FigureResult with a bar plot.freqs
. A TableResult with a frequency table.
All the above IDs are unqualified. Note that bar
and freqs
are repeated,
which is not an issue because the results are under different containers. The above result structure
translates into the following qualified IDs:
root
root.region
root.region.bar
root.region.freqs
root.channel
root.channel.bar
root.channel.freqs
root.channel-by-region
root.channel-by-region.bar
root.channel-by-region.freqs
Note that these are unique across the entire ResultTree. Qualified IDs are employed,
for example, to retrieve results in prettyresults.ResultTree.get_result()
.
Warning
Unqualified IDs must not contain the dot character. Trying to create a result that fails to fulfill this condition will result in an exception.
Generating a Word with a subset of the results¶
If you have a large number of results, including all of them in a single Word
document may be impractical. You can use prettyresults.ResultTree.generate_word()
second parameter to reduce the number of results that get included in your Word document.
Taking the example in the Tutorial, to generate a Word document that includes region and channel data, but not the cross table:
# Generate another Word document only including region and channel results,
# but not region-vs-channel.
word_path_reduced = os.path.join(tempfile.gettempdir(), 'results_reduced.docx')
ctx.generate_word(word_path_reduced, ['root.region', 'root.channel'])