Code Monkey home page Code Monkey logo

police-events's Introduction

police-events

Build Status

This repository consists of:

  • a CollectorService that fetches the latest event data from the Open Api of the Swedish Police every 10 minutes and stores it in a MongoDB database. When hosted in Azure, the service is an Azure function with a timer trigger
  • a .NET 8 REST API that dispatches queries to the to the MongoDB database
  • a mobile-friendly Angular front-end app that uses the REST API for searching and displaying nearby events (based on geolocation). The Angular application has a map view with overlays for Swedish counties and municipalities
  • a Blazor web-assembly application for searching among old police events. This app is hosted by the api-service

Architecture

Alt text

Alt text

The incoming requests to the Api triggers Queries that are dispatched to handlers in the Core assembly. The business logic in Core operates against the repository interfaces for fetching data. The CollectorService (and the Azure function) dispatches Commands to the Core assembly that in turn makes updates to the database via the repository interfaces.

Pre-reqs

  • Install a MongoDB instance and create a database called 'Police' with a collection called 'police_events'
  • Create a 2dsphere index on the Geo field for the collection
  • Modify the appsettings.json files in the CollectorService- and API-projects with connection strings for the database

Setup and start the CollectorService

cd police-events/CollectorService
dotnet run

You can also use the Azure functions-project if you want to trigger the data collection from an Azure function instead.

Setup and start the backend .NET Core API and the Blazor App

cd police-events/Api
dotnet run

Access the swagger endpoint for the Api

https://localhost:5001/swagger

Access the Blazor application

https://localhost:5001

Setup and start the Angular application

https is required for using geolocation from browser
A self-signed certificate is provided in the repo but you can replace it with your own

cd police-events/App
yarn install
yarn startSSL  

https://localhost:4300/

Screenshots

Alt text Alt text Alt text Alt text

police-events's People

Contributors

dependabot[bot] avatar larsbergqvist avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.