- Python 70.9%
- JavaScript 19.6%
- HTML 8.2%
- CSS 1.1%
- Mako 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| frontend | ||
| src | ||
| .gitignore | ||
| COPYING | ||
| MANIFEST.in | ||
| pyproject.toml | ||
| README.md | ||
splent_feature_factlabel
The factlabel feature of a SPLENT product line.
A SPLENT feature is a Python package that a product composes with others:
its models, routes, services, templates and hooks are registered when the
product starts. What this feature provides and requires is listed in the
[tool.splent.contract] section of pyproject.toml, which
splent feature:contract --write keeps in sync with the source.
Use it in a product
splent feature:add splent_feature_factlabel
What explore narrows by
When the product has explore 0.4.0 or later, this feature registers one of
its facets (facets.py): the number of features of a dataset's models, and
of each model, from the metrics the full fact label materialises
(HubfileMetrics.features). The explore page offers it as a range, and the
search API takes features_min and features_max. An older explore read
those metrics itself.
What statistics shows
When the product has statistics (0.5.0 or later), factlabel fills two of
its dashboard's slots (dashboard.py), so statistics names no fact label:
- the characterisation of the corpus, a section of the dashboard: coverage, satisfiability, the five-number summaries, the histograms, the composition of the constraints and the groups, and the largest, most constrained and most configurable models. It counts the models of the version each dataset lineage shows, only what anyone may read;
- the export of the metrics, one row per model of a public dataset, which
/statistics/export.csvand/statistics/export.jsonserve. Every row says the schema it follows (schema_version,1, raised when a column goes or changes meaning) and carriesdataset_doiandrelative_path, the citable key of a row (UV-12).
An older statistics read these tables itself, and gets nothing from here.
Frontend
The label is drawn in the browser, in the Fact label view of the file
workbench on the dataset page (hubfile.workbench.views): a tab beside the
model's code, the width of the workbench, with its display options, its
SVG and "Open with FM Fact Label" beside the tabs while it is open.
assets/js/scripts.js draws it with d3 (drawFMFactLabel), and
assets/js/panel.js follows the workbench's events (workbench:loading,
workbench:content, and workbench:view-shown, since the label measures
itself as it is drawn and waits until its tab shows it) and downloads the
label as an SVG. The SPLENT toolchain builds both, with the view's styles
(assets/css/panel.css), into assets/dist/factlabel.bundle.js (entry
factlabel, a classic script, loaded after hubfile's workbench bundle) and
assets/dist/factlabel.css, which hooks/factlabel_scripts.html links.
Nothing of it comes from another origin. d3 7.9.0 is an npm dependency
in frontend/package.json, the version the CDN's d3@7 served, and so is
the title's face, Libre Franklin Black, from @fontsource/libre-franklin
(OFL-1.1, a licence the release gate names for review): the stylesheet
declares it, and the SVG a visitor downloads carries it inside, so the file
looks the same offline. The label once imported that face from Google Fonts
and Font Awesome from cdnjs into its SVG; its icons are plain characters of
its own font now. The metric dialog is Bootstrap's Modal, the shell's, a
peerDependency (^5.2.0), and the view's markup uses the shell's CSS and
feather icons, declared in splent.shell, so product:validate checks the
product provides them.
splent feature:compile factlabel # build it once, in development mode
splent feature:compile factlabel --watch # again on every change
splent feature:compile factlabel --verify # the files match assets/meta/manifest.json
splent feature:npm factlabel outdated # a newer d3?
Develop
splent feature:test splent_feature_factlabel
splent feature:contract splent_feature_factlabel
Release
splent feature:release splent_feature_factlabel --dry-run --bump patch
splent feature:release splent_feature_factlabel
The first command rehearses the release and changes nothing. The second publishes it to the git forge and to PyPI, and a PyPI version is permanent.