Skip to content

diggsweden/dataportal-web

Swedish data portal

The Swedish data portal web client – dataportal.se

Sweden´s national data portal gathers and shares data for re-use to make it easier for users to find and explore it across sectors and domains.The portal only contains information about datasets, i.e. metadata. The actual datasets are retrieved via links for download or requested by the respective organization responsible for their own datasets. The Agency for Digital Government (DIGG) is responsible for Sweden's national data portal.

Entryscape

Entryscape logotype

The Swedish data portal is tightly integrated with the EntryScape product suite from MetaSolutions AB. EntryScape Registry is a solution for managing a registry of data catalogs and related information

Requirements

node-current npm-current nextjs-current

Development

Start by creating an .env.local file. Use the .env.local.example as template. (Environment variables and tokens in .env.local.example that has placeholder value of "secret" is not available here and needs to be changed to a valid value).

Run application in development mode

Starts the application in development mode with hot-code reloading, error reporting, and more. See Nextjs Development for more information. Run:

yarn
yarn dev
# If you are having issues connecting to your localhost port for apollo:
export NODE_OPTIONS=--dns-result-order=ipv4first

Visit http://localhost:3000 in the browser.

Run application in production mode

Builds the application for production usage. See Nextjs production build for more info. And Start the Next.js production server. See Nextjs start production for more info. Run:

yarn
yarn build
yarn start

Visit http://localhost:3000 in the browser.

Run application with Docker

Run the following to start the application with docker.

#build image
docker build . -t dataportal-web

# Create container
docker run -p 3000:3000 -e PORT=3000 -e HOST=http://localhost:3000 -e REACT_APP_APOLLO_URL=http://localhost:1400 -e REACT_APP_RUNTIME_ENV=prod -e IMAGE_DOMAIN=host.docker.internal -e REACT_APP_MEDIA_BASE_URL="http://host.docker.internal:1400/assets/dataportal" --add-host=host.docker.internal:host-gateway dataportal-web

Testing in local Sandbox Environment

Go to: sandbox.localhost to test and explore the site with data from Entryscape.

Health check

NextJs answers on http://localhost:1300/api/healthcheck?secret=[HEALTHCHECK_SECRET from env] No cache, Do a request to content backend with startpage query.

{"status":"fail"}
{"status":"pass"}

Notes

Stack

  • Nextjs
  • TypeScript
  • React
  • Emotion
  • Apollo Client

Content backend

The Swedish Dataportal consumes news and content via a GraphQL proxy. The content is rendered with Apollo GraphQl and React. The proxy is not published on Github.

Component library

The project has a dependency to Digg component library. The package is published via NMP under @digg/design-system

Videos

Screen9 logotype

Display of video is done via screen9. To be able to display videos an account from screen9 is needed and an API key. The key for this frontend application has read access only to DIGG screen9 account.

Sandbox editera

To test locally in the sandbox environment, set the sandbox.editera URL on lines 6, 7, and 12 in Settings.Dev.ts

Line 6: ENTRYSCAPE_SPECS_PATH="editera.dataportal.se" Line 7: ENTRYSCAPE_TERMS_PATH="editera.dataportal.se" Line 12: ENTRYSCAPE_CONCEPT_STATS_URL="https://editera.dataportal.se/stats/entityData.json"