Skip to content

Commit

Permalink
move transform command into http service (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Nov 12, 2024
1 parent 30cd2df commit 69cc020
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 349 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ fabricator
fabricator_pid.txt
nohup.out
*.csv
*.zip
49 changes: 34 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,55 @@
# fabricator

Prepare a CSV to load via Islandora Workbench

This is a convenience utility to allow a more user friendly spreadsheet to then be converted to the format Workbench expects. Can be thought of as middleware between normal spreadsheet curation and the format workbench expects.
Transform a Google Sheet URL into a fully executed [Islandora Workbench](https://github.com/mjordan/islandora_workbench) task.

## Overview

- Content creators can work in Google Sheets to prepare a spreadsheet
- [A Google Appscript](./google/appsscript) is embeded in the sheet to allow easily checking their work
- When the spreadsheet is ready, it can be ingested into Islandora/Drupal via Islandora Workbench by supplying the sheet URL in [the GitHub Action](./.github/workflows/run.yml)

```mermaid
sequenceDiagram
actor Alice
Alice->>Google Sheets: Edit 1
Alice->>Google Sheets: Edit 2
Alice->>Google Sheets: Edit ...
Alice->>Google Sheets: Edit N
Google Sheets->>Alice: <br>Download CSV
Alice->>Fabricator: template.csv
Fabricator->>Fabricator: processing/validating
Fabricator->>Alice: workbench.csv
Alice->>Islandora Workbench: workbench.csv
Alice->>Google Sheets: Click check my work
Google Sheets->>Fabricator: Check this CSV
Fabricator->>Alice: Looks good 🚀
Alice->>GitHub: Run workbench workflow
GitHub->>Self-hosted Runner: Run workbench workflow
Self-hosted Runner->>Islandora Workbench: python3 workbench
Islandora Workbench->>Drupal: entity CUD
Islandora Workbench->>GitHub: logs
Alice->>GitHub: View action logs
```

## Getting started

### Start the server

```
go run main.go \
--source /path/to/google/sheet.csv \
--target workbench.csv
export SHARED_SECRET=changeme
go build
nohup ./fabrictor &
echo $! > pid
```

### Get a workbench CSV from a google sheet CSV

## TODO
- [ ] HTTP service to allow a Google Sheets Apps script to validate a spreadsheet
- [ ] Validator service
- [ ] CSV transform service
```
curl -s \
-H "X-Secret: $SHARED_SECRET" \
-XPOST \
-o target.zip \
--upload-file source.csv \
http://localhost:8080/workbench/transform
```

### Stop the service

```
kill $(cat pid)
```
Loading

0 comments on commit 69cc020

Please sign in to comment.