Home - GeoSmartCity-CIP/crowd-sourcing GitHub Wiki

Crowd-Sourcing Service

Crowd-sourcing service is a collection of services that allows management of platform. The management includes overview of reported events, modification of event states, etc.

Details

The service is in fact a set of HTTP (sub)services. Most of the services allow POST method only.

Status Code

The services respond with standard HTTP/1.1 response codes. For example, 200 OK is reported if everything is fine. 4XX status codes are returned when an error occures, for example 417 Expectation Failed. In case of a problem message body contains problem description.

Settings

Different pilots require slightly different behaviour of tha service. For example, some pilots require user authentication while others do not. Table property contains predefined properties which may change how the service behave. Particular values and their meaning is described in the next sections.

Security

As the authetication may be required (depends on configuration) it is stronly recommended to use secure verion of HTTP, HTTPS.

Available services

Authentication

User Registration

List configuration

Create event

List events

Upload comment

Change event

Deployment

Database

The service was developed to use a PostgreSQL with PostGIS extansion as a backend. The spatial extension is necessity as event location is stored in form of a geometry.

Installation instructions for PostreSQL can be found at www.postgresql.org. Installation of PostGIS is explained at postgis.net/install/.

Database schema can be loaded from file stored in crowd-sourcing/server/db-schema/. These are files creaed by pgAdmin3's Backup... utility, so it's an advantage to use command Restore... to recreate the database schema.

The following tables are important to setup the service:

  • mime_type contains allowed mime types of event attachments;
  • priority contains allowed priorities;
  • property contains various properties, their meaning is self explaining;
  • status contains allowed statuses of event;
  • tag contains tags that can be associated with an event.

Service

The service is distributed as a war (web archive) file. It should be copied into webapps directory of your Tomcat installation. If you are on Windows platform the supposed directory is C:/Users/{user}/Workspaces/Tomcat{version}_webapps/ and for Linux distributions it should be /var/lib/tomcat{version}/webapps/. The service comes preconfigured with connection to postgresql running at port 5432 on localhost. The values, along with database user and password can be--and should be--changed in file web.xml.

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>CrowsSourcing</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <context-param>
    <param-name>db-url</param-name>
    <param-value>jdbc:postgresql://localhost:5432/cs</param-value>
  </context-param>
  <context-param>
    <param-name>db-user</param-name>
    <param-value>USERNAME</param-value>
  </context-param>
  <context-param>
    <param-name>db-password</param-name>
    <param-value>PASSWORD</param-value>
  </context-param>
</web-app>
⚠️ **GitHub.com Fallback** ⚠️