Skip to content

Export Signe Laval calendar to Artsdata #66

Export Signe Laval calendar to Artsdata

Export Signe Laval calendar to Artsdata #66

name: Export Signe Laval calendar to Artsdata
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * 3" # Run at 1:00 AM ET every Wednesday
jobs:
transform-signe-laval-taxonomies:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download taxonomies from signe-laval
run: curl 'https://api.footlight.io/calendars/signe-laval/taxonomies?page=1&limit=300' >> taxonomies.json
- name: Run Python script
run: python ./util/flatten-cms-taxonomies.py taxonomies.json
- name: Upload json into artifact
uses: actions/upload-artifact@v4
with:
name: taxonomies
path: ./flatten-taxonomies.json
retention-days: 1
transform-signe-laval-calendar:
runs-on: ubuntu-latest
needs: transform-signe-laval-taxonomies
container:
image: ontotext/refine:1.2.1
options: --user root
ports:
- 7333:7333
outputs:
events_file_name: ${{ steps.step-6.outputs.events_file_name }}
places_file_name: ${{ steps.step-6.outputs.places_file_name }}
organizations_file_name: ${{ steps.step-6.outputs.organizations_file_name }}
people_file_name: ${{ steps.step-6.outputs.people_file_name }}
taxonomies_file_name: ${{steps.step-6.outputs.taxonomies_file_name}}
steps:
- name: Install requirements
id: step-1
run: apk update && apk add curl && apk add util-linux
- name: Run Onto Refine server
id: step-2
run: /opt/ontorefine/dist/bin/ontorefine &
- name: Download data from artifact
id: step-3
uses: actions/download-artifact@v4
with:
name: taxonomies
- name: Download data from Signe Laval calendar
id: step-4
run: |
curl 'https://api.footlight.io/calendars/signe-laval/events?page=1&limit=300' >> events.json &&
curl 'https://api.footlight.io/calendars/signe-laval/places?page=1&limit=300' >> places.json &&
curl 'https://api.footlight.io/calendars/signe-laval/organizations?page=1&limit=300' >> organizations.json &&
curl 'https://api.footlight.io/calendars/signe-laval/people?page=1&limit=300' >> people.json
- name: Download configuration files for transformation
id: step-5
run: |
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-events-configuration.json' >> event-transform-config.json &&
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-places-configuration.json' >> place-transform-config.json &&
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-organizations-configuration.json' >> organization-transform-config.json &&
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-people-configuration.json' >> person-transform-config.json
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-taxonomies-configuration.json' >> taxonomy-transform-config.json
- name: Set output file names for Signe Laval
id: step-6
run: |
echo "events_file_name=signe-laval-events-$(uuidgen).ttl" >> $GITHUB_OUTPUT &&
echo "places_file_name=signe-laval-places-$(uuidgen).ttl" >> $GITHUB_OUTPUT &&
echo "organizations_file_name=signe-laval-organizations-$(uuidgen).ttl" >> $GITHUB_OUTPUT &&
echo "people_file_name=signe-laval-people-$(uuidgen).ttl" >> $GITHUB_OUTPUT
echo "taxonomies_file_name"=signe-laval-taxonomies-$(uuidgen).ttl >> $GITHUB_OUTPUT
- name: Transform events in JSON to RDF
id: step-7
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform events.json \
-u http://localhost:7333 \
--configurations event-transform-config.json \
-f json >> ${{ steps.step-6.outputs.events_file_name }}
- name: Transform places in JSON to RDF
id: step-8
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform places.json \
-u http://localhost:7333 \
--configurations place-transform-config.json \
-f json >> ${{ steps.step-6.outputs.places_file_name }}
- name: Transform organizations in JSON to RDF
id: step-9
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform organizations.json \
-u http://localhost:7333 \
--configurations organization-transform-config.json \
-f json >> ${{ steps.step-6.outputs.organizations_file_name }}
- name: Transform people in JSON to RDF
id: step-10
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform people.json \
-u http://localhost:7333 \
--configurations person-transform-config.json \
-f json >> ${{ steps.step-6.outputs.people_file_name }}
- name: Transform taxonomies in JSON to RDF
id: step-11
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform '/__w/artsdata-planet-footlight/artsdata-planet-footlight/flatten-taxonomies.json' \
-u http://localhost:7333 \
--configurations taxonomy-transform-config.json \
-f json >> ${{ steps.step-6.outputs.taxonomies_file_name }}
- name: Upload events in RDF to S3
id: step-12
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.events_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload places in RDF file to S3
id: step-13
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.places_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload organizations in RDF file to S3
id: step-14
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.organizations_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload people in RDF file to S3
id: step-15
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.people_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload txonomy in RDF file to S3
id: step-16
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.taxonomies_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
import-data-to-artsdata:
needs: transform-signe-laval-calendar
runs-on: ubuntu-latest
steps:
- name: Set current date as output
id: step-1
run: echo "dumpdate=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_OUTPUT
- name: Import events to Artsdata
id: step-2
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "signe-laval-cms-events",
"comment": "Events from signe-laval-cms-events calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-signe-laval-calendar.outputs.events_file_name}}",
"downloadFile": "${{needs.transform-signe-laval-calendar.outputs.events_file_name}}",
"reportCallbackUrl": "${{inputs.call-back-url}}"
}'
- name: Import places to Artsdata
id: step-3
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "signe-laval-cms-places",
"comment": "Places from signe-laval-cms-events calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-signe-laval-calendar.outputs.places_file_name}}",
"downloadFile": "${{needs.transform-signe-laval-calendar.outputs.places_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'
- name: Import organizations to Artsdata
id: step-4
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "signe-laval-cms-organizations",
"comment": "Organizations from signe-laval-cms-events calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-signe-laval-calendar.outputs.organizations_file_name}}",
"downloadFile": "${{needs.transform-signe-laval-calendar.outputs.organizations_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'
- name: Import people to Artsdata
id: step-5
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "signe-laval-cms-people",
"comment": "People from signe-laval-cms-events calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-signe-laval-calendar.outputs.people_file_name}}",
"downloadFile": "${{needs.transform-signe-laval-calendar.outputs.people_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'
- name: Import taxonomies to Artsdata
id: step-6
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "signe-laval-cms-taxonomy",
"comment": "Taxonomies from Signe Laval calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-signe-laval-calendar.outputs.taxonomies_file_name}}",
"downloadFile": "${{needs.transform-signe-laval-calendar.outputs.taxonomies_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'