Skip to content

Commit

Permalink
a few new courses, new readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dannguyen committed Feb 28, 2020
1 parent 779e6b1 commit a7c15c4
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 64 deletions.
62 changes: 62 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# How to contribute

If you have a suggestion for a course to add, it's as easy as [creating an issue](https://github.com/dannguyen/journalism-syllabi/issues) and pasting a URL that I can visit myself and gather the course info from.

> Note: The purpose of this site is to provide guidance and inspiration to other data journalism instructors, so *generally*, suggested courses should have a publicly-viewable syllabus.

## Filling out course info yourself

If you feel the need to be more helpful, or want to write the course info yourself, it's as easy as filling out the fields in this YAML template:

```yaml
title: "Human Readable Name of the Course"
course_listing: "DEPT 123" # if applicable; not all courses listed are from college
org: "The full name of the University"
time_period: "20XX" # year is fine, if there's a session, delimit it with a semicolon, e.g. Fall; 2019
homepage: https://the-landing-page-of-the
syllabus: https://if-the-homepage-is-not-the-syllabus/provide/direct/link/to/syllabus

description: |
Descriptive blurb about the course. I usually just copy-paste from the catalog if possible.
Can have line breaks/separate paragraphs
instructors:
- FirstName LastName
- Mabe Theres-Multiple Teachers
```
Here's an example:
```yaml
title: Data Journalism
course_listing: JOUR 407
org: University of Nebraska-Lincoln
time_period: 2014
homepage: https://github.com/mattwaite/JOUR407-Data-Journalism/tree/601b51dafb0690ff9679861258683d943449312e
syllabus: https://github.com/mattwaite/JOUR407-Data-Journalism/blob/601b51dafb0690ff9679861258683d943449312e/syllabus.md
description: |
The best reporters harness the right tools to get the story. In this class, we’ll use brainpower and software to look at raw data -- not summarized and already reported information -- to do investigative reporting. We’re going to get our hands dirty with spreadsheets, databases, maps, some basic stats and, time permitting, some stuff I’ll call “serious future s**t.” And in the end, we’ve got a project to produce. So buckle up and hold on.
instructors:
- Matt Waite
```
Again, you can create an issue and just paste the YAML you've written, and I'll add it to [some-syllabi.yaml](some-syllabi.yaml)
## Doing a pull request
If you feel the need to do the full open-source thing, I won't stop you from cloning the repo and submitting a pull request.
To have your course entry show up on the main [course listing](README.md#table-courses), make a new YAML entry as previously above and add it to the bottom of [some-syllabi.yaml](some-syllabi.yaml).
How do the YAML entries get added to the [course listing](README.md#table-courses)? Via the crude Python script in: [scripts/produce_courselist.py](scripts/produce_courselist.py)
To run that script, you can use the following `make` command:

```sh
$ make
```

If all goes well, the [README.md](README.md) file will be updated (or rather, rewritten via my sloppy Python script), and you can push the changes to [README.md](README.md) and [some-syllabi.yaml](some-syllabi.yaml) to Github for me to merge.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
default:
python scripts/produce_readme.py
./scripts/produce_readme.py
27 changes: 20 additions & 7 deletions README.md

Large diffs are not rendered by default.

121 changes: 65 additions & 56 deletions scripts/produce_readme.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
#!/usr/bin/env python

from pathlib import Path
from string import Template
import rtyaml as ryaml
from sys import stderr, stdout
SRC_PATH = Path('some-syllabi.yaml')
DEST_PATH = Path('README.md')
DESC_LENGTH = 230
DEST_START_STR = '<!--tablehere-->'
TABLE_TEMPLATE = Template("""
There are currently <strong>${rowcount}</strong> courses listed; see [some-syllabi.yaml](some-syllabi.yaml) for more data fields.
tbl = Template("""
There are currently <strong>${rowcount}</strong> courses listed; see [some-syllabi.yaml](some-syllabi.yaml) for more data fields.
<table>
<thead>
<tr>
<th>Course</th>
<th>Organization</th>
</tr>
</thead>
<tbody>${rows}</tbody>
</table>""")
<table>
<thead>
<tr>
<th>Course</th>
<th>Organization</th>
</tr>
</thead>
<tbody>${rows}</tbody>
</table>""")

row_template = Template("""
ROW_TEMPLATE = Template("""
<tr>
<td>
<h5>${course} <br>
Expand All @@ -33,53 +35,60 @@
</td>
</tr>""")

tablerows = []
data = ryaml.load(SRC_PATH.open())
for d in data:
course = '{0} | {1}'.format(d['title'], d['time_period']) if d.get('time_period') else d['title']
if d.get('description'):
desc = '<p><em>{0}</em></p>'.format(d['description'][:DESC_LENGTH] + '...' if len(d['description']) > DESC_LENGTH else d['description'])
else:
desc = ""
def main():
tablerows = []
data = ryaml.load(SRC_PATH.open())
for d in data:
course = '{0} | {1}'.format(d['title'], d['time_period']) if d.get('time_period') else d['title']
if d.get('description'):
desc = '<p><em>{0}</em></p>'.format(d['description'][:DESC_LENGTH] + '...' if len(d['description']) > DESC_LENGTH else d['description'])
else:
desc = ""

if d.get('instructors'):
teachers = '<p>Instructors: {0}</p>'.format(', '.join(d['instructors']))
else:
teachers = ''

if d.get('homepage') == d.get('syllabus'):
links = """<a href="{0}">Homepage/Syllabus</a>""".format(d['homepage'])
else:
links = ' / '.join(["""\n<a href="{1}">{0}</a>""".format(n.capitalize(), d[n]) for n in ('homepage', 'syllabus') if d.get(n)])

if d.get('instructors'):
teachers = '<p>Instructors: {0}</p>'.format(', '.join(d['instructors']))
else:
teachers = ''
tablerows.append(ROW_TEMPLATE.substitute(course=course, description=desc,
links=links, teachers=teachers,
organization=(d['org'] if d.get('org') else '')))

if d.get('homepage') == d.get('syllabus'):
links = """<a href="{0}">Homepage/Syllabus</a>""".format(d['homepage'])
else:
links = ' / '.join(["""\n<a href="{1}">{0}</a>""".format(n.capitalize(), d[n]) for n in ('homepage', 'syllabus') if d.get(n)])
# Let's try reversing things
tablerows.reverse()

tablerows.append(row_template.substitute(course=course, description=desc,
links=links, teachers=teachers,
organization=(d['org'] if d.get('org') else '')))

# Let's try reversing things
tablerows.reverse()
tbltxt = TABLE_TEMPLATE.substitute(rows=''.join(tablerows), rowcount=len(tablerows))
tbltxt = tbltxt.replace('\n', ' ')
boilerplate_text = DEST_PATH.read_text().splitlines()

try:
with DEST_PATH.open('w') as f:
for line in boilerplate_text:
if line != DEST_START_STR:
# print(line)
f.write(line + "\n")
else:
# print(DEST_START_STR)
f.write(DEST_START_STR + '\n\n')
# print(tbltxt)
# write all of the course list in one chunk
f.write(tbltxt)
print(f"Success: {len(tablerows)} courses listed")
break
# worst error-handling code ever:
except Exception as err:
stderr.write(f"Aborting...Error: {err}\n")
# lines = '\n'.join(readmetxt)
# # stderr(lines)
# with DEST_PATH.open('w') as f:
# f.writelines(lines)

tbltxt = tbl.substitute(rows=''.join(tablerows), rowcount=len(tablerows))
tbltxt = tbltxt.replace('\n', ' ')
readmetxt = DEST_PATH.read_text().splitlines()

try:
with DEST_PATH.open('w') as f:
for line in readmetxt:
if line != DEST_START_STR:
print(line)
f.write(line + "\n")
else:
print(DEST_START_STR)
f.write(DEST_START_STR + '\n\n')
print(tbltxt)
f.write(tbltxt)
break
# worst error-handling code ever:
except Exception as err:
print("Aborting...Error:", err)
lines = '\n'.join(readmetxt)
print(lines)
with DEST_PATH.open('w') as f:
f.writelines(lines)
if __name__ == '__main__':
main()
81 changes: 81 additions & 0 deletions some-syllabi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2212,3 +2212,84 @@
- Dawn Garcia
- Jay Hamilton



- title: Data Journalism, Spring 2018
org: University of California at Berkeley
course_listing: J298
time_period: 2018; Spring
syllabus: https://ucb-dataj.github.io/2018/
homepage: https://ucb-dataj.github.io/2018/
description: |
This course is for students who want to make finding and reporting stories from data part of their toolkit. It will be useful for anyone interested in investigative journalism, which nowadays is often heavily data-driven, or those keen to use data to provide context and ground-truth for regular beat reporting. You should be comfortable with numbers, and thinking critically and quantitatively. You must be prepared to work with some simple code (in R and SQL), and to get your hands dirty with real-life, messy data!
instructors:
- Peter Aldhous
- Amanda Hickman


- title: Sports Data Analysis and Visualization
org: University of Nebraska-Lincoln
course_listing: SPMC 350
time_period: 2019; Summer
homepage: https://github.com/mattwaite/sportsdatabook
syllabus: http://mattwaite.github.io/sports/
description: |
The entire course is in R and promotes replicable methods for data analysis to students who likely have done no programmatic data analysis and have zero experience working with code. The course philosophy, given those realities, is to have lots of small assignments that build on each other step by step.
instructors:
- Matt Waite
buzzwords:
- R



- title: The Data Institute 2019
org: ProPublica
time_period: 2019
syllabus: https://github.com/propublica/data-institute-2019
homepage: https://projects.propublica.org/graphics/data-institute-2019
description: |
An intensive workshop from The Ida B. Wells Society for Investigative Reporting and ProPublica on how to use data, design and code for journalism. From July 22 to Aug 2 in New York City.
- title: Data Journalism with R and the Tidyverse
org: University of Nebraska-Lincoln
course_listing: JOUR 307
time_period: 2020
homepage: https://github.com/mattwaite/datajournalismbook
syllabus: https://mattwaite.github.io/datajournalism/
description: |
In this book, you’ll get a taste of modern data journalism through programming in R, a statistics language. You’ll be challenged to think programmatically while thinking about a story you can tell to readers in a way that they’ll want to read. They might seem like two different sides of the brain – mutually exclusive skills. They aren’t. I’m confident you’ll see programming is a creative endeavor and storytelling can be analytical.
instructors:
- Matt Waite
buzzwords:
- R


- title: Programming in Journalism
org: Stanford University
homepage: https://github.com/stanfordjournalism/stanford-progj-2020
course_listing: COMM 177P/COMM 277P
time_period: 2020; Winter
description: |
This course introduces general purpose programming skills commonly used in the news. Students will gain basic proficiency in the Unix shell and Python programming while practicing skills such as web scraping, acquiring data from public APIs, cleaning and transforming data, and working with spreadsheets and databases. Automation and reproducibility will be important themes in the course. Exercises and projects will focus on helping students understand the nuances of obtaining and preparing data for use in data analysis and web applications for the news. Students must have basic SQL skills for this course.
instructors:
- Serdar Tumgoren


- title: Reporting Methods
org: Carleton University
time_period: 2020; Winter
instructors:
- David McKie
- Jim Bronskill
homepage: http://www.davidmckie.com/jour-5206-reporting-methods-2020-winter-term-carleton-school-of-journalism-and-communication/
description: |
1) Obtain a thorough grounding in journalistic research methods.
2) Acquire skills needed to make sense of the information gathered.
3) Develop the ability to shape the information into accurate and compelling stories for all platforms.

0 comments on commit a7c15c4

Please sign in to comment.