Giter Club home page Giter Club logo

apiwtw's Introduction

Dashboard Wheel The World

An API to manage a straightforward visual tool for WTW people to keep a track on the maps and mappers' insights (related to Places to Stay), built using ExpressJS.

Wheel The World Logo

Project demo (integrated with its React App)

▶️ Watch Full Demo

Below is a screenshot of the Database used to query data for this API. image

Available endpoints (API Documentation)

📄 See our API Documentation page here

Maps Overview

Gets the general overview information, which includes the completed maps summary affected by the date picker and all time statistics (not affected by the date). All Time Statistics includes worldwide data of the organization, average number of photos per map, least mapped areas, average completion time and data to fill the yearly history graphic.

URL: https://apidash2.herokuapp.com/maps/overview/{initalDate}/{finisDate}

Method: GET

Response

   "summary":{
      "completedMaps":12,
      "mapsInProgress":181
   },
   "allTimeStatistics":{
      "worldwideInsights":[
         {
            "country_name":"Argentina",
            "cantidad":3
         },
         {
            "country_name":"Australia",
            "cantidad":1
         },
         {
            "country_name":"Bahrain",
            "cantidad":1
         },
         {
            "country_name":"Canada",
            "cantidad":12
         },
         {
            "country_name":"Dominican Republic",
            "cantidad":7
         },
	 ...
         {
            "country_name":"Kenya",
            "cantidad":10
         },
         {
            "country_name":"Turkey",
            "cantidad":1
         },
         {
            "country_name":"United Kingdom",
            "cantidad":21
         },
         {
            "country_name":"United States",
            "cantidad":368
         }
      ],
      "highlights":[
         {
            "country_name":"United States",
            "cantidad":368
         },
         {
            "country_name":"France",
            "cantidad":49
         },
         ...
         {
            "country_name":"Italy",
            "cantidad":8
         }
      ],
      "presence":{
         "countryNumber":27,
         "destinationNumber":206
      },
      "avgNumberOfPhotos":5,
      "leastMappedAreas":[
         {
            "inquiry_id":"beachfront",
            "menosMapeadas":37
         },
         {
            "inquiry_id":"parking",
            "menosMapeadas":91
         },
         {
            "inquiry_id":"other_areas",
            "menosMapeadas":203
         }
      ],
      "avgTimeCompletionPerMap":8,
      "completedAMSMaps":[
         {
            "cant":22,
            "mes":6,
            "año":2021
         },
         ...
         {
            "cant":12,
            "mes":6,
            "año":2022
         }
      ]
   }

Maps Table

Gets all the accommodations list affected by the date picker(:initialDate & :finishDate) and other filters. It is used as a POST method to be able to send filter data according to the expected body explained below.

URL: https://apidash2.herokuapp.com/maps/table/{initialDate}/{finishDate}

Method: POST

Expected Body

As a JSON body, it is needed to send an object with three properties inside: an array of countries, an array of cities and a string that can be "complete"/"non-complete"

{
  	  "countries": [],
  	  "cities":[],
  	   "filter": " "
}

Response

{
			"id": "1g1J1JToZrbJaxwJSHOb8yVDjyo1_1641838464537",
			"placeName": "Ambassador Chicago",
			"city": "Chicago, United States",
			"progress": 100
}

Map Details

Gets detailed information about an specific accomodation. These details include general non accessibility information about the map, mapping progress, mapping duration, mapping dates and the mapping progress detailed by area. The accommodation_uid is passed as a param to specify the accommodation that will be queried.

URL: https://apidash2.herokuapp.com/maps/detail/{accomodation_uid}

Method: GET

Response:

{
   "mapper":{
      "idMapper":94,
      "name":"Zachary",
      "lastname":"Dorsey",
      "photo":"No information"
   },
   "accomodation":{
      "nameHotel":"The Carriage House",
      "type":"Hotel",
      "address":"105 E Harmon Ave, Las Vegas, NV 89109, USA"
   },
   "progress":{
      "completedpercentage":100,
      "created":"2022-06-02T20:03:57.000Z",
      "duration":1,
      "lastUpdate":"2022-06-02T21:10:39.000Z"
   },
   "progressAreas":[
      {
         "name":"building_entrance",
         "process":95
      },
      {
         "name":"elevator",
         "process":98
      },
      {
         "name":"general_attributes",
         "process":26
      },
      {
         "name":"lobby",
         "process":53
      },
      {
         "name":"rooms",
         "process":80
      }
   ],
   "photos":[
      {
         "inquiry_id":"building_entrance",
         "cant":7
      },
      {
         "inquiry_id":"elevator",
         "cant":0
      },
      
      {
         "inquiry_id":"general_attributes",
         "cant":0
      },
      {
         "inquiry_id":"lobby",
         "cant":6
      },
      {
         "inquiry_id":"rooms",
         "cant":0
      },
      {
         "inquiry_id":"swimming_pool",
         "cant":4
      }
   ]
}

Mappers overview

Gets all mappers list with basic information such as name, profile picture, completed maps, in progress maps and contact email. Params are passed in the URI to apply sorting and search by name.

URL: https://apidash2.herokuapp.com/mappers/overview?:maps?:nombre?:apellido?:order?:page?

Method: GET

Response

[
    {
        "name": {
            "id": 256,
            "name": "Annerys",
            "lname": "Rivas",
            "photo": "https://lh3.googleusercontent.com/a-/AOh14GhRQedMjChkNHb3acJKaZt0W-ka4LWtmmCy5Ogl=s96-c"
        },
        "maps": {
            "done": 1,
            "progress": 0
        },
        "contact": "[email protected]"
	},
	...
	{
        "name": {
            "id": 121,
            "name": "Arturo",
            "lname": "Gaona",
            "photo": "https://lh3.googleusercontent.com/a-/AOh14GhRQedMjChkNHb3acJKaZt0W-ka4LWtmmCy5Ogl=s96-c"
        },
        "maps": {
            "done": 9,
            "progress": 0
        },
        "contact": "[email protected]"
	}
]

Mapper details

Gets detailed information about an specific mapper by giving its id as a param. Information includes name, contributions statistics, and last activity.

URL: https://apidash2.herokuapp.com/mappers/details/{id}

Method: GET

Response:

{
   "name":{
      "name":"Arturo",
      "lname":"Gaona",
      "photo":"https://lh3.googleusercontent.com/a-/AOh14GgRUshmT817YjvNoL3IG_wYyqvQY28OX6QPjnAH=s96-c"
   },
   "contributions":{
      "total":9,
      "WTWcontributions":"Pending",
      "inprogress":0,
      "averageTime":60.5556
   },
   "replies":{
      "lastReply":{
         "day":"16",
         "month":"05",
         "year":"2022",
         "hour":"19:07:43"
      },
      "lastCompletedArea":{
         "Area":"rooms_two",
         "location":{
            "name":"Hotel Marquis Reforma",
            "location":{
               "city":"Ciudad de México",
               "country":"Mexico"
            }
         }
      }
   }
}

Mapper Contributions

Gets all the accommodations associated to an speciffic mapper affected by filters. It is used as a POST method to be able to send filter data according to the expected body explained below. It returns the accommodations name, city and total progress.

URL: https://apidash2.herokuapp.com/mappers/contributions/{id}

Method: POST

Expected Body As a JSON body, it is needed to send an object with three properties inside: an array of countries, an array of cities and a string that can be "complete"/"non-complete".

{
	"countries": ["Mexico","France", "United States"],
    "cities": [""],
    "filter": "complete"
}

Response

[
    {
        "id": "CZ3qPFVV7qdlwqTpSSiRINgF14K3_1639426450208",
        "placeName": "Crowne Plaza Englewood, an IHG Hotel",
        "city": "Chicago, United States",
        "progress": 100
    },
    {
        "id": "CZ3qPFVV7qdlwqTpSSiRINgF14K3_1641149537492",
        "placeName": "Homewood Suites by Hilton Hamilton Township",
        "city": "Chicago, United States",
        "progress": 100
    }
    ...
]

Countries & Cities List

Gets a list of all the cities and countries available in the database to apply filters according to these arrays.

URL: https://apidash2.herokuapp.com/mappers/countries

Method: GET

Response

{
    "cities": [
        "Aberdeen",
        "Alpharetta",
        "Altamonte Springs",
        "Anaheim",
        "Arlin",
        ...
    ],
    "countries": [
        "Afghanistan",
        "Andorra",
        "Argentina",
        "Australia",
        "Bahrain",
        "Belgium",
        "United Kingdom",
        "United States",
        ...
    ]
}

Development

  • Clone the repo:
$ git clone https://github.com/VicReyes1/apiWTW.git
  • Go to the project directory and install dependencies:
$ cd apiWTW
$ npm i
  • To properly run this project, you'll need to authenticate users by using Firebase. We invite you to add an .env file manually in the root directory. Firstly, create your own firebase project and its database. Inside that .env file, add the following line:
REACT_APP_ACCESS_KEY = {your access key here, without spaces, formatted in just one line}
  • To use the required database service, please include the following data inside the same .env file:
PORT_serv = 
HOST = 
USER_db = 
PASS = 
NAME_db = 
PORT_db = 
  • Run the API locally:
$ npm run dev

Give it a try!

💻 You can get access to the API through this link: https://apidash2.herokuapp.com/

Interesting links

Contributors

  • Víctor Serrano Reyes @VicReyes1
  • José Herón Samperio León @HeronSamperio
  • Edgar Daniel Acosta Rosales @DonKatsun
  • Diana Guadalupe García Aguirre @DianaA96
  • Emmanuel Bolteada Manzo @EmmanuelBoM

apiwtw's People

Contributors

heronsamperio avatar emmanuelbom avatar dianaa96 avatar donkatsun avatar vicreyes1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.