× This challenge is awaiting approval from an organizer.

smapshot 🏆

Crowdsourcing platform for geological data

📂 Demo

Awarded the 2021 DINAcon Open Data Award.


{ hacknight challenges }

(a quick challenge for someone to take their first steps as a user...)

(something that one could do once familiar with the project...)

(a challenge for the coders and pro users in the room...)

smapshot api

Project description

Smapshot is a crowdsourcing platform to geolocalize historical images in 3 dimension. Production version is available at https://smapshot.heig-vd.ch

This project contains the code of the smapshot API available live at https://smapshot.heig-vd.ch/api/v1/ The online documentation is available at https://smapshot.heig-vd.ch/api/v1/docs/

Initial setup

  • Copy the .env.sample file to .env and adapt it to your local environment.

    If you are developing with Docker Compose, you do not need to configure the database connection, as the database is created and configured for you.

  • You can download sample images from the Switch drive. Unzip the contents of the data.zip file into the public/data directory in this repository.

  • Once you have set up the database in the following sections, if you do not have a super_admin user account (password super_admin), you can add one with:

    INSERT INTO public.users (first_name, last_name, email, username, date_registr, letter, lang, "password", roles, active)
    VALUES ('Franck', 'Dulin', 'super_admin@smapshot.ch', 'super_admin', now(), TRUE, 'fr','$2b$12$v80JamELNdJnvHyVAQrUZOaIRJJ2BI48vTsZop4s5mgoA9jbcX4Ni','{volunteer,super_admin}',TRUE);
    

Develop with Docker Compose (recommended)

Requirements

Setup

Create and migrate the database:

npm run compose:migrate

Run the application

Command Description
npm run compose Start the application and install dependencies the first time.
npm run compose:install Run npm install to install missing/updated dependencies (slower).

Visit http://localhost:1337 once the application has started.

Run the automated tests

Command Description
npm run compose:test Run the test suite.
npm run compose:test:coverage Also generate a test coverage report (slower) in the coverage directory.
npm run compose:test:debug Run the test suite with verbose logs to help debug issues.

Useful commands

Command Description
docker-compose up --build app Run the application in the foreground (this is what npm run compose does).
docker-compose up --build --detach app Run the application in the background.
docker-compose stop Stop all containers.
docker-compose down Stop and remove all containers (but keep the data).
docker-compose down --volumes Stop and permanently delete all containers and data.
docker-compose exec app <command> Execute a command inside the running app container (e.g. docker-compose exec app npm install my-new-package).
docker-compose ps List running containers.

Running the application with docker-compose up will also automatically re-generate the API documentation and re-run the linter on code changes.

Develop locally

You will need:

Setup

  • Install Node.js dependencies:
    • Run npm ci on a fresh clone.
    • Or, run npm install to install new dependencies.
  • Intall required Python tools:

    pip3 install opencv-python numpy scipy pymap3d
    
  • Install the submodule git submodule update --init --recursive

  • Create an empty database:

    psql
    > CREATE DATABASE smapshot;
    
  • If you are using PostGIS 3+, you must also manually create the postgis and postgis_raster extensions before migrating the database:

    \connect smapshot
    CREATE EXTENSION postgis;
    CREATE EXTENSION postgis_raster;
    
  • Migrate the database (assuming you have the correct database configuration in your .env file):

    npm run migrate
    

Run the application

  • Run npm start to start the server once.
  • Or, run npm run dev to start it with live reload. It will also keep the API documentation up to date and lint the code when it changes.

Then visit http://localhost:1337.

Run the automated tests

Create a separate test database, called smapshot-test by default. You can override the test database settings (e.g. DB_NAME, DB_HOST) in a .env.test file similar to your .env file.

Command Description
npm test Run the test suite.
npm run test:coverage Also generate a test coverage report (slower) in the coverage directory.
npm run test:debug Run the test suite with verbose logs to help debug issues.
npm run test:watch Automatically run the tests when code changes.

Development guide

Read the development guide for more information.

This content is a preview from an external site.
 

Event finished

Event started

Too many steps to deploy the project on my local machine. SQL, WTF!

29.10.2021 17:06 ~ loleg

Repository updated

29.10.2021 14:32 ~ loleg

Edited

29.10.2021 14:32 ~ loleg

First post View challenge

29.10.2021 14:30 ~ loleg

Challenge

 
All attendees, sponsors, partners, volunteers and staff at our hackathon are required to agree with the Hack Code of Conduct. Organisers will enforce this code throughout the event. We expect cooperation from all participants to ensure a safe environment for everybody.

Creative Commons LicenceThe contents of this website, unless otherwise stated, are licensed under a Creative Commons Attribution 4.0 International License.