Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csv to slides #56

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/slides_reveal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Generate Slides

on: [push, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout main repository
uses: actions/checkout@v3

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install Python dependencies
run: |
pip install pandas
pip install jinja2

- name: Generate slides using Python
run: python slides/generate_slides.py

- name: Install Pandoc
run: sudo apt-get install pandoc

- name: Convert Markdown to HTML using reveal.js
run: |
pandoc slides/slides.md -t revealjs -s -o slides/slides.html -V revealjs-url=./reveal.js -V theme=black

- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Generate slides"
git push
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "slides/reveal.js"]
path = slides/reveal.js
url = https://github.com/hakimel/reveal.js.git
67 changes: 67 additions & 0 deletions slides/generate_slides.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'''
this script reads in the output_ram.csv file
and populates a markdown template writing to slides.md
which can be used to generate slides using reveal.js
'''
import pandas as pd
import os
from jinja2 import Environment, FileSystemLoader

# Set up Jinja2 environment and load the templates
script_dir = os.path.dirname(os.path.abspath(__file__))
env = Environment(loader=FileSystemLoader(script_dir))
slide_project = env.get_template('slide_templates/template_project_horizontal.md')
slide_bullets = env.get_template('slide_templates/template_bullets_vertical.md')
slide_bullets2 = env.get_template('slide_templates/template_iframe_background.md')
slide_image = env.get_template('slide_templates/template_image.md')
slide_url = env.get_template('slide_templates/template_url_vertical.md')

# Read the title slide from title_template.md
with open(os.path.join(script_dir, 'slide_templates/template_title.md'), 'r') as title_file:
markdown = title_file.read()

# Read data from CSV to pandas
df = pd.read_csv(os.path.join(script_dir,'output_ram.csv'))
#group by project
df = df.groupby('Project')

# Add a slide for each project
for project in df['Project'].unique():
# add project slide with description
description = df.get_group(project[0])['Project description'].values[0]
# make sure description is not nan
if description != description:
description = ''
slide_content = slide_project.render(Project=project[0], Project_content=description)
markdown += slide_content

# check if value in Output type is RAM assessment:
if 'RAM assessment' in df.get_group(project[0])['Output type'].values:
# add slide template with image and use column "Output Media" as image_path
image_path = df.get_group(project[0])['Output Media'].values[0]
slide_content = slide_image.render(image_path=image_path)
markdown += slide_content

# add vertical slides with output bullets
bullets = df.get_group(project[0])['Output description']
#check if series contains NA
if not bullets.isnull().values.any():
slide_content = slide_bullets.render(Bullets=bullets.tolist())
markdown += slide_content

# add vertical slides with url
url = df.get_group(project[0])['Landing page']
if url.values[0] != '':
slide_content = slide_url.render(URL=url.values[0])
markdown += slide_content

# add combined slide
if (not bullets.isnull().values.any()) & (url.values[0] != ''):
slide_content = slide_bullets2.render(bullet=bullets.tolist()[0], URL=url.values[0])
markdown += slide_content

# Write the entire slide deck to a markdown file
with open(os.path.join(script_dir,'slides.md'), 'w') as md_file:
md_file.write(markdown)

print("Generated slides.md")
14 changes: 14 additions & 0 deletions slides/output_ram.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Project,Project description,Output type,Output description,Landing page,Output Media,Other Link,RAM,Active RAM engagement?,Date,Notes,Turing Programme / GC,Contact
AB Street,"An open source urban modelling platform that invites users to add different street interventions to view the impact on traffic in the surrounding neighbourhood and city at large. A/B street can help residents and planners have a shared canvas for discussing potential street-level changes, such as planting street trees or installing a model filter to encourage cycling and walking.",Stakeholder engagement,We worked with local councils to use the tool in public consultation and co-creation session.,https://a-b-street.github.io/docs/software/ltn/index.html,https://www.turing.ac.uk/blog/street-smart-putting-neighbourhood-design-hands-bristol-residents,,,Y,,,,
AI Standards Hub,,Stakeholder engagement,We facilitated external stakeholder workshops with organisations like Department for Transport,https://aistandardshub.org/,,,SL,Y,,,,
clim-recal,"The aim of clim-recal is to provide non-climate scientists with an extensive guide to the application, disadvantages/advantages and use of bias adjustment methods, provide researchers with a collated set of resources for how to technically apply the methods, with a framework for open additions, and create accessible information on methods for non quantitative researchers and lay-audience stakeholders",, ,,,,"JD, SA",Y,,,,
Colouring Cities,,, ,https://colouringcities.org/,,https://github.com/orgs/colouring-cities/repositories,,Y,,,,
Data Safe Haven,"The Turing Data Safe Haven is an open-source framework for creating secure environments to analyse sensitive data. It provides a set of scripts and templates that will allow you to deploy, administer and use your own secure environment.",,,,,,HS,Y,,,,
DfT Short Straits,"DfT Short Straits is a collaboration between TRIC, DCE, and UA with Department for Transport for creating a Digital Twin of the Short Straits around Port of Dover, including road, port, and maritime systems in the area",,We co-created resources for stakeholder engagement,,https://miro.com/app/board/uXjVMAOaBQA=/,,,Y,,,,
London Data Week,"London Data Week is a free, public festival of events across the city, run by different organisations with different communities, to bring Londoners into the conversations about data and AI",,"with Turing and LOTI we convened the London data community, in partnership with organisations like Open Data Institute, Royal Statistical Society, GLA, Better Images of AI, and the Francis Crick Institute",https://www.londondataweek.org/,,,JD,N,,,,
Scivision,,,,https://sci.vision/,,https://github.com/alan-turing-institute/scivision,AC,Y,,,,
The Turing Way Practitioner’s Hub,,,,,,,CR,Y,,,,
PitchFest at AI UK,,,We contribute to Institute-wide flagship events,,,,,N,,,,
Other,,Conference Talks / Workshops,We organize collaborationwWorkshops: Pathways to Sustainability for Research Projects and Outputs,,https://miro.com/app/board/uXjVMQDvxC0=/,,"HS, CR, ALS",N,,,,
Other,,Scoping,We have been assessing RAM potential across Turing projects ,,,,,,,,,
The Trustworthy and Ethical Assurance platform,"The platform brings together elements of Ethics and Assurance methodology like SAFED principles and argument patterns in a usable and accessible manner, and helps project teams to provide trustworthy and justifiable assurance about the processes they undertook when designing, developing, and deploying their technology or system.",RAM assessment,,https://alan-turing-institute.github.io/AssurancePlatform/,https://user-images.githubusercontent.com/5104098/262439184-1c18c514-02c2-434e-abc1-dfcdff3769ba.png, ,"SA, KW",Y,28-9,https://hackmd.io/qbm6EGeNTmqL_t2HoYBJDA?both,,
1 change: 1 addition & 0 deletions slides/reveal.js
Submodule reveal.js added at 94d98f
3 changes: 3 additions & 0 deletions slides/slide_templates/template_bullets_vertical.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section>{% for bullet in Bullets %}
- {{ bullet }}
{% endfor %}</section>
3 changes: 3 additions & 0 deletions slides/slide_templates/template_iframe_background.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section data-background-iframe="{{URL}}" style="background-color: rgba(0,0,0,0.5);">
{{ bullet }}
</section>
4 changes: 4 additions & 0 deletions slides/slide_templates/template_image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<section>
<h2>RAM assessment</h2>
<img src="{{image_path}}">
</section>
5 changes: 5 additions & 0 deletions slides/slide_templates/template_project_horizontal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

---

## {{Project}}
<section>{{Project_content}}</section>
5 changes: 5 additions & 0 deletions slides/slide_templates/template_title.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# Ram outputs NEW

<div class="footer">Slides by <a href="https://www.turing.ac.uk/research/research-programmes/tools-practices-and-systems/research-application-management">RAM Team</a></div>

1 change: 1 addition & 0 deletions slides/slide_templates/template_url_vertical.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<section><iframe src="{{URL}}" style="width: 100%; height: 200%; float: right; border: none;"></iframe></section>
Loading
Loading