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

creation of script to generate csv #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ubiquitin
Copy link

simple file conversion json to csv for working with current FedRAMP data in Excel

simple file conversion json to csv for working with current FedRAMP data in Excel
@ubiquitin
Copy link
Author

ubiquitin commented Apr 22, 2020

request for @JohnWHamilton or @lauraGgit to test / review this simple script

@reedloden
Copy link

To be clear, you want to convert the giant data.json JSON into a CSV that you can use within Excel, yes?

As an alternate to Python and dealing with pip and possible virtualenvs, can use Homebrew with a few commands that could just be put into a bash script.

brew install csvkit jq

curl -s -o fedramp-data.json https://raw.githubusercontent.com/18F/fedramp-data/master/data/data.json

For CSPs:
jq .data.Providers < fedramp-data.json | in2csv -f json > fedramp-providers.csv

For 3PAOs:
jq .data.Assessors < fedramp-data.json | in2csv -f json > fedramp-assessors.csv

Both fedramp-providers.csv and fedramp-assessors.csv open fine in Excel from local testing.

@reedloden
Copy link

Here's a simple version of the script:

#!/bin/sh
#
# Convert FedRAMP Marketplace data from JSON into CSV
#
# Requires: `brew install csvkit jq`
#

set -e

FEDRAMP_DATA=$(mktemp -t fedramp-data)

curl -s -o $FEDRAMP_DATA https://raw.githubusercontent.com/18F/fedramp-data/master/data/data.json

META_DATE=$(jq -r .meta.Created_At < $FEDRAMP_DATA | cut -f 1 -d 'T')

jq .data.Providers < $FEDRAMP_DATA | in2csv -f json > fedramp-providers-$META_DATE.csv

jq .data.Assessors < $FEDRAMP_DATA | in2csv -f json > fedramp-assessors-$META_DATE.csv

rm $FEDRAMP_DATA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants