Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Event database 2.0 API

License

NotificationsYou must be signed in to change notification settings

itk-dev/event-database-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WoodpeckerGitHub ReleaseGitHub Actions Workflow StatusCodecovGitHub last commitGitHub License

This is the next iteration ofthe event database used by themunicipality of Aarhus.

This repository contains the frontend API, if you are looking for the event imports, the code is located athttps://github.com/itk-dev/event-database-imports.

The event database is an API platform for event aggregation from the public vendors throughout the cites. It gets datamainly from feeds (JSON/XML) or APIs provided by the vendors. It is highly configurable in doing custom feed mappingsand extendable to read data from APIs and map this data to event. It also has a user interface to allow manual enteringof events.

The data input is pulled/pushed from a range of differently formatted sources and normalized into an event format thatcan be used across platforms.

For more detailed and technical documentation, see thedocs folder in this repository.

Record Architecture Decisions

This project utilizes record architecture decisions documents which can be located inhttps://github.com/itk-dev/event-database-imports/tree/develop/docsin this repository.

Installation

docker compose pulldocker compose up --detachdocker composeexec phpfpm composer install

Fixtures

The project comes with doctrine fixtures to help development on local machines. They can be loaded with the standarddoctrine fixture load command:

docker composeexec phpfpm bin/console app:fixtures:load<index>

<index> must be one ofevents,organizations,occurrences,daily_occurrences,tags,vocabularies orlocations (cf.src/Model/IndexName.php).

The fixtures are related to the backend where the fixtures are generated by using theapp:index:dump command. The loadabove command downloads the fixtures fromGitHub and loads them intoElasticSearch.

Tip

Usetask fixtures:load to load all fixtures into Elasticsearch.

Caution

If thetask fixtures:load command (or anybin/console app:fixtures:load incantation) fails with an error like

No alive nodes. All the 1 nodes seem to be down.

you must reset the Elasticsearch service to be ready for requests, e.g. by running

docker composeexec elasticsearch curl'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s' --verbose

until it returnsHTTP/1.1 200 OK (cf.How to Implement Elasticsearch Health Check in DockerCompose).

Alternatively, you can rundocker compose up --detach --wait to recreate all services and(automatically) wait for Elasticsearch to be ready – it takes a while …

Accessing the API

To access the API, a valid API key must be presented in theX-Api-Key header, e.g.

curl --header"X-Api-Key: api_key_1""http://$(docker compose port nginx 8080)/api/v2/events"

Valid API keys are defined via theAPP_API_KEYS environment variable:

# .env.localAPP_API_KEYS='[  {"username": "user_1", "apikey": "api_key_1"},  {"username": "user_2", "apikey": "api_key_2"}]'

Production

When installing composer and Symfony based application in production, you should not install development packages,hence use this command:

docker composeexec phpfpm composer install --no-dev --optimize-autoloader

API request examples

Get events with(out) public access:

curl --silent --header"X-Api-Key: api_key_1""http://$(docker compose port nginx 8080)/api/v2/events?publicAccess=true"| docker run --rm --interactive ghcr.io/jqlang/jq:latest'.["hydra:member"]|length'curl --silent --header"X-Api-Key: api_key_1""http://$(docker compose port nginx 8080)/api/v2/events?publicAccess=false"| docker run --rm --interactive ghcr.io/jqlang/jq:latest'.["hydra:member"]|length'

Test

task fixtures:load:test --yestask api:test

You can pass additional arguments to filter tests, e.g.

task api:test -- --filter Event

Tip

Use Task'sDry run mode (task --dry) to see the commands that areactually run, e.g.

$ task --dry api:test -- --filter Eventtask: [compose] docker composeexec phpfpm bin/phpunit --filter Event

This is useful to tweak a (test) command without changingTaskfile.yml.

About

Event database 2.0 API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp