Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: cessda
  • License: apache-2.0
  • Language: TypeScript
  • Default Branch: main
  • Size: 9.27 MB
Statistics
  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • Open Issues: 6
  • Releases: 0
Created almost 2 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation

README.md

COORDINATE Portal

IMPORTANT: This repository was used during the development of version 4 of CDC Searchkit as an output of the COORDNATE project and is now archived. Further development will occur in the cessda.cdc.searchkit repository.

Build Status Quality Gate Status Coverage SQAaaS badge shields.io

This repository contains all source code for the COORDINATE Portal web application.

CESSDA's repositories are used for harvesting and indexing with very minimal changes to Elasticsearch mappings: cessda.metadata.harvester cessda.cdc.osmh-indexer.cmm

Prerequisites

Node.js version 18 (LTS) is required to install and run this application.

You will need an existing local or remote Elasticsearch version 8 instance setup and running.

Quick Start

Please be aware of Known Issues (see bottom) before running.

  1. Check Prerequisites and install any required software.
  2. Clone the repository to your local workspace.
  3. Open a Command Prompt/Terminal window and navigate to the project root directory.
  4. Enter npm install to install the application and all required dependencies.
  5. Set the required environment variables (see Configuration below).
  6. Run the application using one of the following commands.
    • Development: npm run startdev
    • Production: npm run startprod (Requires the application to be built. See Building below.)

Building: In order to run the application in production, it must first be built using the npm run build command. This will compile assets into the /dist directory. This is not needed if the application is started with npm run startdev.
Updating: When fetching/pulling new builds it is recommended to run npm install again. This will ensure all locally installed dependencies match their development environment counterparts.
Testing: Tests can be run using npm run test. Code coverage will be reported in the /coverage directory.

Configuration

The application can be configured using the following environment variables.

| Variable | Default Value | Description | ---------------------------- | ------------- | ----------- | PASC_DEBUG_MODE | false | Enables debug mode which outputs additional debugging information in the user interface and web browser console. | PASC_PORT | 8088 | The port number which will be used to access this web application. | PASC_ELASTICSEARCH_URL | http://localhost:9200/ | The web address of the Elasticsearch instance which powers all searches. | SEARCHKIT_ELASTICSEARCH_USERNAME | undefined | The username to use when accessing a secured Elasticsearch cluster. | SEARCHKIT_ELASTICSEARCH_PASSWORD | undefined | The password to use when accessing a secured Elasticsearch cluster. | SEARCHKIT_LOG_LEVEL | info | The logging level used for server side events. | SEARCHKIT_USE_JSON_LOGGING | false | Whether to log using JSON rather than plain text.

Set environment variables using the following syntax.

  • Windows: set PASC_PORT=80
  • macOS/Linux: export PASC_PORT=80
  • Dockerfile: ENV PASC_PORT=80

If running in a development environment using JetBrains WebStorm (see Tooling below), variables can be set within the IDE using this documentation.

Project Structure

This project follows a best practice structure for React+Redux applications. Redux Toolkit is used for simplified store setup and usage.

bash <ROOT> ├── coverage # The output directory for the code coverage report using the test command. ├── dist # The output directory for compilation using the build command. ├── node_modules # Third party packages and dependencies. ├── common # Common source code, shared between the client and the server. ├── server # Markup and source code for the Searchkit server. └── src # Contains all source code and assets for the client. ├── actions # Redux actions and action creators for state container. ├── components # React user interface components. ├── containers # React page container components. ├── i18n # Language translations. ├── img # Image assets. ├── reducers # Redux reducers for state container. ├── styles # SASS files for styling. └── utilities # Miscellaneous scripts and helpers. └── tests # Jest unit tests.

Technology Stack

Several frameworks are used in this application.

The primary programming language is Flow and JSX in ECMAScript 6. See Tooling (below) for compatible IDEs.

| Framework/Technology | Description | | ---------------------------------------------------- | -------------------------------------------------------- | | JavaScript/JSX | ECMAScript with XML-like syntax extensions. | | React | JavaScript library for building web applications. | | Redux | Predictable state container for JavaScript applications. | | Searchkit | React component library for Elasticsearch. | | Babel | JavaScript compiler for ECMAScript 6. | | TypeScript | Static type checker for JavaScript. | | Webpack | JavaScript module bundler. | | Sass | CSS extension language. | | Bulma | CSS framework based on Flexbox. | | Jest | JavaScript testing framework. | | React Testing Library| JavaScript testing utility for React Components. | | Winston | JavaScript logging framework. |

See package.json in the root directory for a full list of third party libraries used.

Tooling

For development, the following software tools are recommended and have full support for the technologies/languages used in this project.

How To

Add a new Collection (Thematic View)

  • See instructions in /docs/collections/howto.md.

Add a new language

  1. Create a new language file in the /src/i18n/ directory, using the 2 letter language ISO code for the directory name. It is recommended to copy the English file en/translation.json and use that as a template/starting point.
  2. Add your translations to the new file. Basic HTML mark-up is supported but its use should be limited. Some strings use variables which are defined as %(VARIABLE)s. Do not modify the JSON structure or object keys.
  3. Notify the application about this new file by adding it to the languages array defined in /src/utilities/language.js. It is expected that each language will have its own Elasticsearch index. Use the following syntax:

javascript { code: 'code', // The 2 letter ISO code for this language. label: 'label', // The native label for this language. index: 'cmmstudy_code' // The Elasticsearch index containing data for this language. }

Translations can be displayed in mark-up using const { t, i18n } = useTranslation(); and t("filters.summary.label") where t takes the JSON path to the specific string required.

Add a new field

  1. Each study retrieved from Elasticsearch is first routed through the getStudyModel() method located in /src/utilities/metadata.js. This cleans the data and applies type restrictions. Add the new field to the object returned from this method. Like other fields, it should be provided from Elasticsearch as a child property of the data._source object.
  2. If the field should be displayed on the search page for each result, modify the /src/components/Result.jsx component. Add additional HTML mark-up as necessary and the new field will be available as a child property of the item object. For example <p>{item.newField}</p>.
  3. If the field should be displayed on the study detail page, modify the /src/components/Detail.jsx component. Add additional HTML mark-up as necessary and the new field will be available as a child property of the item object. For example <p>{item.newField}</p>.
  4. Remember to add new strings to the translations located in /src/locales if necessary (i.e. for the new field label etc.)
  5. Remember to modify the getJsonLd() method if you want the new field to be available in the JSON-LD Schema (see how to Modify Schema.org JSON-LD below).

Modify search filters

All search filters are created in /src/containers/SearchPage.jsx and their Elasticsearch configuration is in /server/helper.ts.

Example of RefinementList from InstantSearch:

json { attribute: "country", field: "searchField", type: "string", nestedPath: "studyAreaCountries" }

jsx <RefinementList attribute="country" searchable sortBy={['name:asc']} limit={200} showMore={true} showMoreLimit={500} classNames={{ searchBox: 'focus-visible', checkbox: 'focus-visible', list: 'ais-CustomRefinementList' }}/>

High limit can be used here because of the ais-CustomRefinementList class that makes the values horizontally scrollable. Usually lower limit, e.g. 16, is recommended, along with showMore set to false. Setting searchable is always recommended for any filter that supports it.

Modify sorting fields

The list of available fields for sorting can be modified in the /server/helper.ts and then set in /src/containers/SearchPage.jsx.

Modify Elasticsearch queries

Queries performed against Elasticsearch are defined in /server/helper.ts and /server/elasticsearch.ts. Client being used is set in /src/utilities/searchkit.js but also defined in /server/helper.ts like most of the queries.

Modify Schema.org JSON-LD (used by Google Dataset search)

  1. General organisation information and social media links are generated for every page. JSON-LD can be modified in /src/components/Footer.jsx.
  2. Dataset metadata is generated on the detail page for a single study record. JSON-LD can be modified in /src/utilities/metadata.js using method getJsonLd(). This method takes a study returned from getStudyModel() as its input.

Google documentation on supported dataset JSON-LD properties can be found at https://developers.google.com/search/docs/data-types/dataset

Versioning

See Semantic Versioning for guidance.

License

See the LICENSE file.

Owner

  • Name: CESSDA
  • Login: cessda
  • Kind: organization
  • Location: Norway

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: CESSDA Data Catalogue - Searchkit component
message: >-
  If you use this software, please cite it using https://doi.org/10.5281/zenodo.3786299
type: software
authors:
  - given-names: Ashley
    family-names: Fox
    email: foxonlinesolutions@co.uk
    affiliation: Fox online solutions
  - given-names: John William
    family-names: Shepherdson
    email: john.shepherdson@cessda.eu
    affiliation: CESSDA
    orcid: 'https://orcid.org/0000-0002-4402-9644'
  - given-names: Matthew
    family-names: Morris
    email: matthew.morris@cessda.eu
    affiliation: CESSDA
  - given-names: Daniel
    family-names: Arnrup-Øien
    email: daniel.oien@openconcept.no
    affiliation: Open Concept
  - given-names: Markus
    family-names: Tuominen
    email: markus.tuominen@tuni.fi
    affiliation: CESSDA/TAU-FSD
    orcid: 'https://orcid.org/0000-0002-3092-1690'

GitHub Events

Total
  • Issues event: 36
  • Delete event: 21
  • Issue comment event: 48
  • Push event: 71
  • Pull request review comment event: 25
  • Pull request review event: 52
  • Pull request event: 36
  • Create event: 18
Last Year
  • Issues event: 36
  • Delete event: 21
  • Issue comment event: 48
  • Push event: 71
  • Pull request review comment event: 25
  • Pull request review event: 52
  • Pull request event: 36
  • Create event: 18

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 22
  • Total pull requests: 20
  • Average time to close issues: 3 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 6
  • Total pull request authors: 4
  • Average comments per issue: 1.09
  • Average comments per pull request: 0.55
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 6
Past Year
  • Issues: 21
  • Pull requests: 20
  • Average time to close issues: 2 months
  • Average time to close pull requests: 6 days
  • Issue authors: 6
  • Pull request authors: 4
  • Average comments per issue: 1.1
  • Average comments per pull request: 0.55
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 6
Top Authors
Issue Authors
  • matthew-morris-cessda (12)
  • markusjt (11)
  • MortenSikt (9)
  • KristinaS4 (2)
  • alen-vodopijevec-cessda (1)
  • openconcept (1)
Pull Request Authors
  • dependabot[bot] (15)
  • matthew-morris-cessda (14)
  • markusjt (14)
  • openconcept (3)
Top Labels
Issue Labels
enhancement (8) bug (4)
Pull Request Labels
dependencies (15) javascript (5) enhancement (3)

Dependencies

Dockerfile docker
  • build latest build
  • node 18 build
package-lock.json npm
  • 1022 dependencies
package.json npm
  • @babel/cli 7.21.0 development
  • @babel/core 7.21.0 development
  • @babel/plugin-proposal-class-properties 7.18.6 development
  • @babel/plugin-transform-runtime 7.21.0 development
  • @babel/preset-env 7.20.2 development
  • @babel/preset-react 7.18.6 development
  • @babel/preset-typescript 7.21.0 development
  • @redux-devtools/extension 3.3.0 development
  • @testing-library/jest-dom ^6.2.0 development
  • @testing-library/react 14.0.0 development
  • @testing-library/user-event ^14.5.2 development
  • @tsconfig/node18 1.0.1 development
  • @types/body-parser 1.19.2 development
  • @types/compression 1.7.2 development
  • @types/cors 2.8.13 development
  • @types/elasticsearch 5.0.41 development
  • @types/express 4.17.17 development
  • @types/express-http-proxy 1.6.3 development
  • @types/jest 29.4.0 development
  • @types/jquery 3.5.16 development
  • @types/lodash 4.14.191 development
  • @types/mini-css-extract-plugin 2.5.0 development
  • @types/node 18.15.5 development
  • @types/react 18.2.55 development
  • @types/react-dom 18.2.19 development
  • @types/react-redux 7.1.25 development
  • @types/react-router 5.1.20 development
  • @types/react-router-dom 5.3.3 development
  • @types/redux-mock-store 1.0.3 development
  • @types/response-time 2.3.5 development
  • @types/webpack-hot-middleware 2.25.6 development
  • @typescript-eslint/eslint-plugin 5.39.0 development
  • @typescript-eslint/parser 5.39.0 development
  • babel-jest 29.4.3 development
  • babel-loader 9.1.2 development
  • babel-plugin-transform-react-remove-prop-types 0.4.24 development
  • bulma 0.9.4 development
  • bulma-switch 2.0.4 development
  • clean-webpack-plugin 4.0.0 development
  • css-loader 6.7.3 development
  • ejs 3.1.8 development
  • eslint 8.24.0 development
  • eslint-plugin-react 7.31.8 development
  • html-loader 4.2.0 development
  • html-webpack-plugin 5.5.3 development
  • identity-obj-proxy 3.0.0 development
  • jest 29.4.3 development
  • jest-environment-jsdom 29.4.3 development
  • jest-junit 15.0.0 development
  • jest-mock-fetch 2.0.5 development
  • mini-css-extract-plugin 2.7.2 development
  • node-mocks-http 1.12.1 development
  • process 0.11.10 development
  • redux-mock-store 1.5.4 development
  • rimraf 4.3.1 development
  • sass 1.58.3 development
  • sass-loader 13.2.0 development
  • schema-dts 1.1.2 development
  • style-loader 3.3.1 development
  • ts-jest 29.0.5 development
  • ts-node 10.9.1 development
  • typescript 4.9.5 development
  • util 0.12.5 development
  • webpack 5.88.2 development
  • webpack-cli 5.1.4 development
  • webpack-dev-middleware 6.1.2 development
  • webpack-hot-middleware 2.25.4 development
  • webpack-merge 5.8.0 development
  • @elastic/elasticsearch 8.6.0
  • @js-joda/core 5.5.2
  • @reduxjs/toolkit 1.9.3
  • @searchkit/api 4.11.0
  • @searchkit/instantsearch-client 4.12.0
  • body-parser 1.20.2
  • bodybuilder 2.5.0
  • compression 1.7.4
  • cors 2.8.5
  • express 4.19.2
  • express-http-proxy 1.6.3
  • i18next 22.4.11
  • instantsearch.css 8.1.0
  • instantsearch.js 4.64.2
  • isomorphic-unfetch 4.0.2
  • jquery 3.6.4
  • lodash 4.17.21
  • prom-client 14.1.1
  • react 18.2.0
  • react-dom 18.2.0
  • react-i18next 12.2.0
  • react-icons 4.8.0
  • react-instantsearch 7.5.4
  • react-redux 8.0.2
  • react-router 6.9.0
  • react-router-dom 6.9.0
  • react-select 5.7.3
  • redux 4.2.1
  • redux-thunk 2.4.2
  • response-time 2.3.2
  • searchkit 4.11.0
  • striptags 3.2.0
  • winston 3.8.2