Giter Site home page Giter Site logo

laravel_site_opening-hours's Introduction

Openinghours

Platform to manager opening hours for services and their channels.

Build Status Maintainability Test Coverage

Installation

Create config file

Copy the .env.example to .env and

  • Fill in the MySQL (or MariaDb) database credentials.
  • Fill in the VESTA API configuration (make sure it's not base64 encoded).
  • Fill in the VESTA_SOURCE_URL for the links to vesta services (use a ${identifier} placeholder).
  • Fill in the Queue driver, for production environments use redis, beanstalkd or SQS. DO NOT use sync as a queue, rather use database in testing environments (https://laravel.com/docs/5.4/queues).
  • Fill in the base URI that is used to build the LOD version of the openinghours triple (BASE_URI).
  • Fill in the base URI that is used to link to a data representation of something (DATA_REPRESENTATION_URI).
  • Fill in the SPARQL configuration to read data from.
  • Fill in the SPARQL configuration to write data to, don't forget the name of the graph and the specific endpoint of the sparql-graph-crud-auth, which is used to write (possibly) larger amounts of triples to.
  • Mails are sent through SMTP.
  • Set session driver to database (anything but file).
  • Set 1 worker in supervisor (https://laravel.com/docs/5.4/queues#supervisor-configuration) to handle the writes to the different systems (VESTA, LOD). Only using 1 will make sure no dirty read/writes will happen to the SPARQL endpoint, you can use supervisor or a custom system that keeps a Laravel worker up and running. Make sure that the worker is restarted after an update on the software (php artisan queue:restart).

Build the back & front-end

Build the back & front-end by running following commands:

composer install
./artisan migrate
./artisan db:seed
./artisan passport:keys
npm install
gulp build

The ./artisan db:seed command will generate an admin user with a random generated password that's outputted to the command line, the default email is [email protected].

Maintenance and deployment

When updating the software the commands you'll want to run are the following:

composer install
composer update
gulp build
php artisan migrate
php artisan cache:clear
php artisan queue:restart

Caveat: Keep an eye out for the johngrogg/ics-parser releases, currently this dependency is set to dev-master, because the branch contains an implementation that we use in order to provide correct API responses. This is an actively maintained library so (patch) releases are in play.

Fetch services

In order to fetch a list of services from the SPARQL endpoint you'll need to configure the SPARQL endpoint (READ). You can then run the following command:

php artisan openinghours:fetch-services

This will fill the services table with the identifiers, labels of the available services from the SPARQL endpoint.

Fetch recreatex

In order to add openinghours from the Recreatex application to services that are present in the Recreatex application, you can command below, after configuring the Recreatex variables in the .env file.

This command will fetch services that are available in the application and have a recreatex source, a property fetched during the retrieval of services from the SPARQL endpoint using the fetch-services command.

The recreatex command will fetch services using the configured recreatex endpoint and shop-id and will do so, year by year, currently configured to fetch data from 2017 until 2020. These events will be added to the channel "Infrastructuur".

Because Recreatex doesn't save it's events in a calendar standard, rather it saves every single day as an array of 2 events (maximum).

This would result in 365 events per channel, which is far from optimal to work with without additional tweaking, therefore a small algorithm was written that parses weekly RRULEs from the yearly event list.

php artisan openinghours:fetch-recreatex

Note: this will import openinghours from 2017 up until 2020, make sure you refresh the application in the browser after fetching the recreatex openinghours, because the front-end caches responses by default.

Email

Email is now done through SMTP

VESTA

Output can be written to VESTA on a weekly basis by using a predefined command. This will write a weekschedule to VESTA starting on monday of the week that the timestamp of execution falls in. e.g. If it's called friday at 5PM, the output will contain the schedule monday-sunday of that week that friday falls into. Scheduling it monday mornings will produce a schedule for that entire week.

php artisan openinghours:update-vesta

Usage

Queries - No APIB or Swagger available.

  • The serviceUri parameter is required and must be the URI of a service.
  • The channel parameter is optional and must be the name of a specific channel within the given service.
  • The format is optional and by default will return a JSON result, other formats can be: html, text, json-ld.

Get the schedule for the next 7 days

The URI template to get the openinghours for a certain service and a channel within that service (optional).

If no channel is passed, all channels will be returned with a schedule of the coming 7 days.

  • {host}/api/query?q=week&serviceUri={serviceUri}&channel={channel}&format={format}

Get a week schedule starting on monday

Passing a date is optional and if passed will return the monday-sunday schedule of the week that the date falls in.

  • {host}/api/query?q=fullWeek&serviceUri={serviceUri}&channel={channel}&date=dd-mm-yyyy&format={format}

Is something open right now?

  • {host}/api/query?q=now&serviceUri={serviceUri}&channel={channel}&format={format}

Get the openinghours for a specific day

  • {host}/api/query?q=day&date={mm-dd-yyyy}&serviceUri={serviceUri}&channel={channel}&format={format}

Contributions

The first iteration codebase has been written by weconnectdata, more specifically by @thgh and @coreation.

The design and functional analysis has been performed by @mietcls

Codeclimate set-up, code review and further maintenance will be done by the Digipolis team.

laravel_site_opening-hours's People

Contributors

coreation avatar daften avatar delrueba avatar dependabot[bot] avatar dhaemer avatar dubgeiser avatar hstandaert avatar jelle-s avatar jonasanne avatar matthijs-va avatar merlijncuypers avatar pmassoels avatar thgh avatar zero2one avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel_site_opening-hours's Issues

Calendar year

Allow for a calendar year to start/end on any date, not just the first of day of the year.

Make sure statuses in tables have comprehensible labels

Right now the labels are not "readable" to a human being, as we don't know what it means.

If we cannot make sure the labels are smart (indicating high or low priority), we could set something in place like "OK until MM/DD/YYYY".

Situation now:
screen shot 2016-12-20 at 15 44 28

Strived for:
screen shot 2016-12-20 at 15 44 39

README needs clarification

As it is, the README gives some instructions about setting up this project, but no real information about what this project actually does. Could you add more information about the goals behind this project and perhaps a screenshot?

Store calendar data in Virtuoso

When changing the openinghours of a service, the data must also be updated in the LOD repository.

  • Hook into the event system of a changed calendar

  • Create a graph data structure based on the non-semantic calendar data

  • Write the graph data to the Virtuoso store based on the services URI

TODO

  • API > Users > create: Should return the user object after creation
  • API > Channel > create: Should return 422 if label is empty
  • API > Channel > create: Should add myself as owner by default
  • API > Services: service.users should return the role of each user in that service

Recreatex

  • TBD: is the data arriving through a CSV dump or is the data to be fetched through a SQL query

Edit: data was coming through in a year by year overview in which every day has 2 xml elements where morning and afternoon could be passed. From this XML weekly RRULE's have been parsed as opposed to dumping 365 events in a year with a DAILY RRULE for performance reasons.

Front-end improvements

  • (Question) What's the use of the checkboxes in the service panel (0 or 1)
    (Answer: Diensten column will be removed, the goal was to display the user's roles in their services)

  • Remove the columns in the services overview with "active" and "non-active" users

  • Remove status or make it something more intuitive, not sure what the status really means. (channels + services)
    screen shot 2017-01-22 at 12 39 34

  • Edit icon is not necessary if a click on a list item (e.g. user overview/service overview does the same thing, leading to an edit view.

  • Exporting the overview of a year to an image ( @thgh something we can do front-end wise?)

  • When viewing a user detail, don't show active/inactive users in the services he's in, but show what role he has within those services. So remove the (in)active users columns and replace by the role of the user.

  • (Question) Use of the horizontal lines?
    (Answer: will be removed, same functionality as a "Bekijk")

screen shot 2017-01-24 at 11 34 51

Updates

  • disable buttons recreatex service
  • resize timeframe opening hours
  • default new versie => 2 jaar
  • priorities => van 0 tot - oneindig of ook positieve getallen?
    • Altijd 0 en negatief
    • Vroeger: priority = calendars.length
    • Vanaf nu: priority = -layer (en layer is highest layer + 1)
  • wijzig jaar op kalender view => daginfo niet beschikbaar, wel na aanklikken laag
  • catch csrf expired

GUI related: 'Add services(diensten) to your active services'

Current situation:
2 screens: 'Active services (diensten)' and 'Inactive services'

More straightforward implementation:
On 'Active services' screen: button 'Add services to your active services'
add services 1
A new screen shows services which are not yet active + search field with autocomplete to search for services
image

Add user from the user panel

Make a component that adds a user in the overview of users and allow for that user to be linked to a service.

Allow full day to be passed in a more easy way

  • Simulate an entire day by checking if the hours are filled in (00:00 - 00:00 => becomes 00:00 - 23:59) also do this when just the start date is filled in. 13:00 - 00:00 becomes => 13:00 - 23:59) - Back-end will do the same check

Make "uitzonderingen" flow logical.

The current flow does not look like the flow that has been proposed.

How can we come close to what has been proposed, or an agreement? The current situation looks hard to understand and confusing. It does not seem wise to combine the "sluitingsuren" switch, the "geldigheidsperiode", "herhalingen" and hours in one page.

What are the limitations and why does the current interface have these elements combined?

screen shot 2016-12-20 at 17 32 08

For the desired situation, please refer to Google Drive.

Overlapping calendar periods

When changing start-end of a calendar, back-end should validate if this is allowed, you cannot have overlapping periods of time. This message also needs to be displayed in the front-end.

VESTA API

  • Hook into the event of a channel being updated

  • Fetch the link between the updated service and the VESTA UID

  • Create a valid SOAP call and write the information of the service to VESTA

  • Write the services information to VESTA each week, provide a scheduled job

Colors in calendar edit view

  • Attribute a calendar colour to each layer and attribute them to that layer, not to the priority in the list of calendars. This should help people see the effect of moving up/down a calendar in a visual way.

Use a grid/flexbox to prevent overflowing situations and different screens.

For example: a long title can cause the div to not be high enough.

Consider using flexbox or the bootstrap solution to create a grid that adjusts accordingly. Medium priority because it could help the entire application to be more flexible for different situations, if the grid is used well. "fixed" does not scale.

Example of a longer title that can cause issues
screen shot 2016-12-20 at 16 44 08

Display all year calendars vertically, not separate per page

To make it easy to see the current end of the year and beginning of the next year, for instance when viewing holidays. If you want to compare now, you will have to click back and forth.

Current situation: click through pages
screen shot 2016-12-20 at 16 11 34

Desired situation: scroll vertical and click through pages
screen shot 2016-12-20 at 16 27 13

README update

  • Voeg licentie toe ( @daften aGPLv3 ?)

  • Add contributions ( @daften hoe moeten we Digipolis/StadGent vermelden? @mietcls and the WCD team had ik er ook graag bij)

  • Vul readme aan met doel van het project, ...

Services list

The list of services is quite big, adding a list would help to overview of things. This is done so by picking a service from a list of inactive services. These inactive services cannot be created, but are fetched through the weekly SPARQL query. Once they're fetched anew, they get a default flag of inactive. When an admin selects a service to be active, it's returned in the services overview and cannot be set to inactive again.

Homepage

When going to the homepage of the app, always show the same active tab (gebruikers/diensten)

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.