nprapps/anno-docs-publish-addon

Name: anno-docs-publish-addon

Owner: NPR visuals team

Description: Source files for the anno-docs publish Add-on

Created: 2017-02-28 15:14:15.0

Updated: 2017-03-02 16:00:13.0

Pushed: 2017-03-02 16:00:12.0

Homepage: null

Size: 311

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

anno-docs-publish-addon

What is this?

Google Docs Add-on to publish a non-live factcheck.

This functionality is useful to allow for a more autonomous way of producing non-live events from the editorial perspective.

The Add-on has two functions you can run:

So the overall workflow for publishing a new non-live factcheck would be:

Since this will create a publicly available resource the document that will host this addon is kept private for NPR, but you can use this repo to create your own publish workflow.

Assumptions

The following things are assumed to be true in this documentation.

For more details on the technology stack used with the app-template, see our development environment blog post.

What's in here?

The project contains the following folders and important files:

Bootstrap the project
nno-docs-publish-addon
rtualenv anno-docs-publish-addon
install -r requirements.txt

Problems installing requirements? You may need to run the pip command as ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install -r requirements.txt to work around an issue with OSX.

Hide project secrets

Project secrets should never be stored in app_config.py or anywhere else in the repository. They will be leaked to the client if you do. Instead, always store passwords, keys, etc. in environment variables and document that they are needed here in the README.

Any environment variable that starts with $PROJECT_SLUG_ will be automatically loaded when app_config.get_secrets() is called.

Run the project

There's an auxiliary flask app on the repo used only to create/refresh google drive credentials in case there¡s a need to do it.

The project is meant to be deployed to google drive and executed from there.

Google Apps Scripts Development

We use our codebase stored on github as the master for the Google Apps Scripts code. We have created a series of Fabric commands to ease the workflow of updating the actual code run inside google drive.

List projects
gs.list_projects

It will return a complete list of Google Apps Script projects. It accepts and optional owner parameter to filter out the results to a given owner. for example the following command will return only the projects that you have created:

gs.list_projects:me
Create project

If you want to create the project on your own drive, first inside app_config.py update DRIVE_PARENT_FOLDER_ID to reflect one existing folder where you want the standalone script to live in. Then you can run:

[ENVIRONMENT] gs.create

This will create a new google apps script project on a subfolder that will depend on the ÈNVIRONMENT used development or production.

Imagine your root folder on drive is called scripts. The fabric tasks expect the following folder structure:

pts
velopment
oduction
 Test as an Add-On

While you are developing changes to the google apps script, we strongly recommend that you use the Publish -> Test as add-on option on the project until you are happy with the results.

Test as an Add-On

 Upsert project

If you want to update local changes to a Google Apps Script Project you can run:

[ENVIRONMENT] gs.upsert

Where ENVIRONMENT can be: development or production. Depending on the environment passed the command will update the appropriate Google App Script Project using app_config properties. For development it would be:

development gs.upsert
Google Document Permissions

Google document permissions are restricted to the editors that will use the functionality to publish non-live factchecks

License and credits

Released under the MIT open source license. See LICENSE for details.

Contributors

This repo was developed by NPR Visuals team.

See additional CONTRIBUTORS


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.