Sign inSign up

codeformuenster/familien-dashboard

By codeformuenster

Updated over 8 years ago

Image
0

10K+

codeformuenster/familien-dashboard repository overview

Dependency Status FOSSA Status

This project was bootstrapped with https://github.com/Microsoft/TypeScript-React-Starter

Installing

npm install

Running elasticsearch and the react dev tool

sudo docker-compose up

If you get problems with file permissions on startup, check that the mounted directory ./elasticsearch/data has correct permissions.

Great Elasticsearch JS documentation is linked here: https://github.com/elastic/elasticsearch-js

Running only the react app

npm run start

Initialize the Database

cd src/scripts
../../node_modules/typescript/bin/tsc initialize-database.ts && node ./initialize-database.js  

Importing data

# Aufgrabungen und similar things
See README in `import-scripts`

# Wn events and news, and stadt münster webcams:
See README in `import-scripts/wn-events-news-cams`

Deployment auf Ubuntu 16.04

Data "type"-category values

  • construction = Baustellen
  • pool = Bäder
  • playground = Spielplätze
  • wifi = WLAN
  • kindergarden = Kitas
  • wc = WCs
  • sport = Sportstätte
  • webcam = Webcams

Indexes

Playing with the data

Open kibana:

http://localhost:5601/

go to "dev-tools"

enter this:

PUT /locations
{
  "mappings": {
    "restaurant": {
      "properties": {
        "times": {
          "type": "nested"
        },
        "address": {
          "properties": {
            "geo": {
              "type": "geo_point"
            }
          }
        }
      }
    }
  }
}

add sample location:

PUT /locations/restaurant/1?pretty
{
  "name": "Cafe Extrablatt",
  "food": ["Burger", "Pizza", "Wraps"],
  "times": [
    {
      "type": "lunch",
      "day": "monday",
      "start": 660,
      "end": 780
    },
    {
      "type": "lunch",
      "day": "tuesday",
      "start": 660,
      "end": 780
    },
    {
      "type": "lunch",
      "day": "wednesday",
      "start": 660,
      "end": 780
    },
    {
      "type": "lunch",
      "day": "thursday",
      "start": 660,
      "end": 780
    },
    {
      "type": "lunch",
      "day": "friday",
      "start": 660,
      "end": 780
    },
    {
      "type": "happy_hour",
      "day": "friday",
      "start": 1200,
      "end": 1260
    },
    {
      "type": "happy_hour",
      "day": "saturday",
      "start": 1200,
      "end": 1260
    }
  ],
  "payment_methods": ["cash", "debit_card", "credit_card"],
  "wifi": false,
  "url": "https://cafe-extrablatt.de/speisekarte",
  "address": {
    "street": "Salzstraße",
    "house_number": "7",
    "zip_code": "48143",
    "city": "Münster",
    "geo": {
      "lat": 51.9622843,
      "lon": 7.6278623
    }
  },
  "phone_number": "025144445"
}

PUT /locations/restaurant/2?pretty
{
  "name": "Der silberne Löffel",
  "type": ["Restaurant"],
  "food": ["Pasta", "Pizza"],
  "times": [
    {
      "type": "lunch",
      "day": "tuesday",
      "start": 705,
      "end": 840
    },
    {
      "type": "lunch",
      "day": "wednesday",
      "start": 705,
      "end": 840
    },
    {
      "type": "lunch",
      "day": "thursday",
      "start": 705,
      "end": 840
    },
    {
      "type": "lunch",
      "day": "friday",
      "start": 705,
      "end": 840
    },
    {
      "type": "lunch",
      "day": "friday",
      "start": 705,
      "end": 840
    },
    {
      "type": "lunch",
      "day": "saturday",
      "start": 705,
      "end": 840
    }
  ],
  "payment_methods": ["cash", "debit_card", "credit_card"],
  "wifi": false,
  "url": "https://i.imgur.com/QwsmbNb.jpg",
  "address": {
    "street": "Überwasserstraße",
    "house_number": "3",
    "zip_code": "48143",
    "city": "Münster",
    "geo": {
      "lat": 51.965230,
      "lon": 7.620721
    }
  },
  "phone_number": "+49251392045"
}

query for all locations which offer happy hours and only show times of type happy hour:

GET /locations/restaurant/_search
{
  "_source": {
    "includes": [ "*" ],
    "excludes": [ "times" ]
  },
  "query": {
    "nested": {
      "path": "times",
      "inner_hits": {
        "_source": [
          "times", "type"
        ]
      },
      "query": {
        "bool": {
          "must": [
            {
              "term": {
                "times.type": "happy_hour"
              }
            }
          ]
        }
      }
    }
  }
}

License

FOSSA Status

Tag summary

Content type

Image

Digest

Size

3.6 MB

Last updated

over 8 years ago

docker pull codeformuenster/familien-dashboard:0.3.3