Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.

Latest commit

 

History

History

README.md

ArtGuide

Prerequisites

In order to run this project you will need:

Environmental variables

You must create a file called .env with the API keys in that format in order to run the module correctly.

GoogleCustomSearchAPIKey_00=AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxx
GoogleCustomSearchEngineId_EN_00=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx 
GoogleCustomSearchEngineId_IT_00=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx
GoogleCustomSearchEngineId_EN_KIDS=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx
GoogleCustomSearchEngineId_IT_KIDS=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx

How to run

npm i               # install dependencies
npm start           # start the server in watch mode

Available commands

npm i               # install dependencies
npm start           # start the server in watch mode
npm start:d         # start the server in watch mode and attach the debugger

npm run build       # compiles src/*.ts in dist/*.js
npm run watch       # automatically compiles ts when the file is saved
npm run webpack     # start webpack in watch mode (compiles the UI)

npm t               # run unit tests
npm t -- filename   # run a specific test file
npm tun test:d      # run tests and attach the debugger
npm run test:watch  # run tests in watch mode (TDD)

npm run lint        # run linter
npm run lint:fix    # run linter with --fix option

npm run docs        # generate the documentation in /docs

Linter

We are using ESLint as linter together with a plugin to make it work properly with TypeScript. The list of our rules can be found in eslintrc.js. Whenever we use a rule specified in typescript-eslint-plugin we need to disable the original ESLint rule and override it with the one provided by the plugin.

Useful links: - Available ESLint rules - Available TypeScript rules

Folder structure

  • assets contains example json that we use for testing purposes.
  • client contains the UI for testing purposes and a visualization tool for debugging.
  • docs contains the documentation of each class, automatically generated by TypeScript using the JSdoc.
  • src
    • models contains the TypeScript classes and interfaced used for the exchanged objects.
    • parser parses url and extracts page content, divides it into sections and extracts keywords using the rake approach.
    • search builds the queries and performs searches on Google Search.
    • wiki
      • wikidata extracts information from WikiData using the entities ID. It's used also to understand if the entity is recognized as a famous piece of art or as a generic class of artwork.
      • wikipedia extracts results from Wikipedia.
    • adaptation.ts abstracts communication with the adaptation modules.
    • app.ts is the server with the main flow.
    • declarations.ts contains declarations for non-typescript libraries.
    • environment.ts parses the .env file.
    • index.ts starts the server.
    • logger.ts is used to log on file.
    • utils.ts contains utility functions.
  • tests divided in unit and integration tests.
  • /
    • .env contains the environment variables.
    • config.json contains variables and settings used in our app.
    • *-cache contains the cached Google Search results, since we have a limited number of queries each day.
    • The other files are the configurations for Node.js, TypeScript, ESlint, git, etc.