Repository navigation
Add a directory of the open data portals CanQuery mirrors - #146
Merged
Merged
Conversation
/portals lists every enabled catalogue source as a portal: its place and
province, its platform, the datasets held from it, how many of them have a
table or a map here, its general licence and the last day it was read, with
the portals grouped by level of government, platform and province.
- One read (listPortalDirectory) counts each portal's records with the
catalogue's own "has a table" and "has a map" rules; a portal's place
comes from the source registry. Cached for ten minutes.
- The server's HTML carries the whole directory (table, group tables, a
DataCatalog item list) and embeds the data, so the application draws the
page with no request; an in-app visit reads /web-api/v1/portals.
- The application filters by name, place, level, platform and province and
sorts by column, with the choice kept in the address. Below 1024 pixels
each portal is a card, so no figure is off screen.
- The page is in /sitemap-pages.xml, the navigation menu, the footer and
the section links of every server-rendered page.
- French portal names built from a city's name contract their article
("du District de Squamish", not "de le District").
After an independent review of the first commit. - The description names no level of government (no province's own portal is mirrored today), and the lead gives the split by level only when it adds up: a portal whose place is unknown has no level. - "Last read" is a day in Eastern time on the server and in the application, not the UTC day, which showed tomorrow's date every evening. - The sitemap dates /portals by that day rather than by each half-hourly read, keeps the page listed when one read fails, and the index dates /sitemap-pages.xml by the newest entry the file holds (the LMIA and OAS hubs included). - The total is the number of different datasets the enabled sources hold; a source named twice keeps the place it was given first. - Structured data is a CollectionPage whose list names each DataCatalog, as the place and organization hubs are. - The application: only the server's own "nothing mirrored yet" answer shows that message (any other 503 can be retried); a filter value the lists do not offer is ignored; the three groups are h2 sections; the province group follows the reader's alphabet; one dataset is "1 dataset".
- The page carries no ad while it has no portal to list: it is a 200 that only says so. - The About page's "where the data comes from" section links the list of those portals, in the server's HTML and in the application. - A test holds the directory's cache to its ten minutes (and one minute for "nothing mirrored"): the earlier test passed with any duration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
CanQuery mirrors 83 Canadian open data portals, but no page says so.
/aboutnames the sources in a paragraph, and the only list of portals is a filter on the catalogue. This adds/portals: one row per portal, with figures that exist nowhere else in one place.For each portal the page gives:
Below the table the portals are grouped by level of government, by platform and by province or territory, and a short section says what each number means.
It is reference content of CanQuery's own: something a reader choosing a portal can use, and one page another site can link to when it wants to point at "the open data portals of Canada".
How it is built
listPortalDirectorycounts each portal's records fromdataset_sourceswith the catalogue's own "has a table" and "has a map" rules, so the counts are the ones/datasets?source=…shows with the same filters. A dataset two portals list counts for both and once in the total, which is the number of different datasets the enabled sources hold between them.services/portalPages.jscaches the result for ten minutes.CollectionPagewhose list names each portal as aDataCatalog) and embeds the data, so the application draws the page without a request. An in-app visit reads/web-api/v1/portals, a website-only route outside/api/v1, its metering and the OpenAPI document./sitemap-pages.xml(dated by the day of the latest successful read), the navigation menu, the footer, the section links of every server-rendered page and the About page's "where the data comes from" section.Also here: French portal names built from a city's name contract their article ("Données ouvertes du District de Squamish", not "de le District"). The stored name changes at that source's next sync.
Checklist
server:npm run lint && npm testpassclient: lint, scoped type/format checks, tests and production build passclient/src/i18n.jsx(EN + FR), if anyNotes
catalog_sources,dataset_sources,resources,ingested_resources,resource_maps,placesandsync_runs;runtimeRoles.test.cjsruns it as the API role.noindex, carries no ad and stays out of the sitemap; a read that fails answers 503 on the page (500 on the JSON route, as the other website routes do), never an empty directory, and the sitemap keeps the page without a date.http(s)addresses.client/src/i18n.jsx.portalPages.test.js(shape, cache, JSON route, HTML, structured data, escaping, sitemap, navigation),catalogDiscoveryIntegration.test.js(the read on PostgreSQL: counts, shared datasets, places, the catalogue total),catalogSources.test.js(French names), and on the clientportals.test.js,portalData.test.jsandPortalsPage.test.jsx(table, filters, sort, the address, cards on a narrow screen, one-portal wording, both languages)./sitemap-pages.xmlolder than its newest entry (the LMIA and OAS hubs had the same gap, closed here too);h3beside 83 card headings (nowh2), the province group ignored French order, one dataset read "1 datasets";deploy/indexing-discovery.md("Portal directory").