Skip to content

Latest commit

 

History

History
274 lines (202 loc) · 8.88 KB

linked-courses-importers.md

File metadata and controls

274 lines (202 loc) · 8.88 KB

Linked Courses importers and commands

Please keep this file up to date and document the new importers or update current ones if necessary.

This documentation is written to help you decide what to use if you'd like to setup your own application instance of Linked Courses.

YSO - General Finnish ontology (Required)

What is it?

First, some terminology is in order. Starting with ontology:

In computer science and information science, an ontology encompasses a representation, formal naming and definition of the categories, properties and relations between the concepts, data and entities that substantiate one, many or all domains of discourse.

From Wikipedia of Ontology (information science)

YSO, short for Yleinen suomalainen ontologia, is basically a +30,000 collection of concepts in Finnish culture, translated in 3 languages.

General Finnish Ontology YSO is a trilingual ontology consisting mainly of general concepts. YSO has been founded on the basis of concepts in Finnish cultural sphere.

From https://finto.fi/yso/en/. You can browse the concepts there if you wish

Basic example would be, let's say a Portuguese language teacher coming to Helsinki to teach Portuguese to children.

We might categorize it with "chldren", "education", "Portuguese", and "fun" concepts.

These concepts come from YSO.

What depends on it?

Linked Courses application has events. Events must be described by concepts. Therefore, all events depend on YSO.

How to use it?

python manage.py event_import yso --keywords --all

Imports all keywords in YSO into the database, without maintaining the existing hierarchy between the concepts.

This is scheduled to run daily on the instance as data doesn't change that often.

tprek - Location registry (Required)

What is it?

tprek, short for Toimipisterekisteri, is a location registry service giving access to locations in Helsinki through a REST API.

Basic example would be the location of a Kung Fu course in a certain sport facility.

What depends on it?

Linked Courses application has events. Events must have locations.

By default, all event locations are from tprek location registry.

Therefore, all events depend on tprek locations to be present.

How to use it?

python manage.py event_import tprek --places

Imports all locations, which usually have addresses, coordinates and other metadata, from tprek location registry into the database.

This is scheduled to run hourly on the instance as data changes often.

helmet - Helsinki Metropolitan Area Libraries

What is it?

helmet is an importer for Helsinki Metropolitan Area Libraries Courses from https://helmet.fi..

Basic example would be a book reading course organized by Helsinki city center library for young adults, which you can import with this importer.

What depends on it?

If you want to populate the database with courses organized by Helmet, you need helmet importer.

How to use it?

python manage.py event_import helmet --courses

NOTE: --courses flag functionality is not present at the moment but will be implemented.

Imports all courses organized by Helmet into the database.

This is scheduled to run hourly on the instance as data changes often.

install_templates

What is it?

install_templates is a django management command for giving the browsable API which comes from django-rest-framework a Helsinki brand look and feel and also instructions for the API user.

Basic example would be the live version of Linked Courses API for Helsinki city which is blue and also includes instructions on how to query the API when you'd like to apply certain filters to the /event endpoint.

What depends on it?

If you're having an application for Helsinki city and you'd like the browsable API to have Helsinki brand look and feel and also instructions for API user, you need this django management command.

How to use it?

python manage.py install_templates helevents

Installs Helsinki city templates for the browsable API.

geo_import

What is it?

geo_import is an importer which creates divisions data structure for each place object in database.

For example, a simplified place object from Sello library can be like so:

{
  ...
  "id": "tprek:15417",
  "position": {
      "type": "Point",
      "coordinates": [
          24.80992,
          60.21748
      ]
  },
  "name": {
      "fi": "Sellon kirjasto",
      "sv": "Sellobiblioteket",
      "en": "Sellon kirjasto"
  },
  ...
},

And by running this importer, you'd add divisions to the object above:

{
  ...
  "id": "tprek:15417",
  "divisions": [
      {
          "type": "muni",
          "ocd_id": "ocd-division/country:fi/kunta:espoo",
          "municipality": null,
          "name": {
              "fi": "Espoo",
              "sv": "Esbo"
          }
      }
  ],
  "position": {
      "type": "Point",
      "coordinates": [
          24.80992,
          60.21748
      ]
  },
  "name": {
      "fi": "Sellon kirjasto",
      "sv": "Sellobiblioteket",
      "en": "Sellon kirjasto"
  },
  ...
},

This allows the API user to query the /place endpoint by adding division of Espoo as an example:

/place/?division=Espoo

Or directly querying the /event endpoint by filtering division of Espoo as an example:

/event/?division=Espoo

What depends on it?

If you'd like to add support for division based filtering of events or places in your application, then you need this importer.

How to use it?

python manage.py geo_import finland --municipalities

Imports all municipalities in Finland from https://kartat.kapsi.fi/.

python manage.py geo_import helsinki --divisions

Imports all divisions in Helsinki from the Helsinki district division datasets. This allows more specific filtering for Helsinki city based on district names, sub_district names, and neighborhood names.

kulke

What is it?

kulke, short for Kulttuurikeskukset, is an importer which imports courses from City of Helsinki cultural centers (http://annantalo.fi, http://vuotalo.fi, http://malmitalo.fi etc.).

NOTE: To get access to data from City of Helsinki cultural centers, you need to have access to City of Helsinki internal network. Specifics of how to get this access for City of Helsinki developers will be documented here later.

What depends on it?

If you'd like to have courses organized by City of Helsinki cultural centers in your Linked Courses application instance, you need this importer.

How to use it?

python manage.py event_import kulke --courses

Imports all courses organized by City of Helsinki cultural centers into the database.

This is scheduled to run hourly on the instance as data changes often.

harrastushaku

What is it?

Harrastushaku is an importer which imports courses from Harrastushaku website.

What depends on it?

If you'd like to have courses from Harrastushaku website, you need this importer.

How to use it?

First, you need to import Harrastushaku locations:

python manage.py event_import harrastushaku --places

Then, you can import Harrastushaku courses:

python manage.py event_import harrastushaku --courses

Imports all courses from Harrastushaku website into the database.