Skip to content

Commit

Permalink
Add orderly example
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Feb 5, 2020
1 parent 6eb342d commit 7d1e43b
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 0 deletions.
9 changes: 9 additions & 0 deletions orderly/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# orderly

This is an [`orderly`](https://github.com/vimc/orderly) project. The directories are:

* `src`: create new reports here
* `archive`: versioed results of running your report
* `data`: copies of data used in the reports

(you can delete or edit this file safely)
1 change: 1 addition & 0 deletions orderly/archive/.orderly_archive_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.7.15
5 changes: 5 additions & 0 deletions orderly/archive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# orderly: archive

This directory contains the result of running your reports. Do not edit anything inside this directory.

(you can delete or edit this file safely)
5 changes: 5 additions & 0 deletions orderly/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# orderly: data

This directory contains the results of queries run against the database, in csv and rds form. Reports will reference these by the hashes. This directory could grow quite large over time.

(you can delete or edit this file safely)
21 changes: 21 additions & 0 deletions orderly/data/csv/fb50ba8971cc96c0036f34cbcac83730.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"name","number"
"careful_bobolink",0.406830187188461
"uncalorific_bonobo",0.912875924259424
"marginal_eagle",0.293603372760117
"unterrestrial_slothbear",0.459065726259723
"illfated_anchovy",0.332394674187526
"wet_shrimp",0.65087046707049
"classless_drafthorse",0.258016780717298
"upstanding_tattler",0.478545248275623
"cranky_earwig",0.766310670645908
"uninspirable_indianglassfish",0.0842469143681228
"changeable_bream",0.875321330036968
"zealous_emperorshrimp",0.339072937844321
"brilliant_nandine",0.839440350187942
"waiting_agouti",0.34668348915875
"tricolour_xrayfish",0.333774930797517
"preagricultural_dromaeosaur",0.476351245073602
"rhombohedral_canary",0.892198335845023
"necessary_barnowl",0.864339470630512
"ethnological_oyster",0.389989543473348
"snobbish_capeghostfrog",0.777320698834956
Binary file not shown.
1 change: 1 addition & 0 deletions orderly/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- name: example
5 changes: 5 additions & 0 deletions orderly/draft/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# orderly: draft

This directory contains the result of running your reports. Do not edit anything inside this directory. These are *draft* reports and should be considered temporary. You can *commit* a draft report to move it into `archive` and to add it to the database.

(you can delete or edit this file safely)
5 changes: 5 additions & 0 deletions orderly/orderly_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
database:
source:
driver: RSQLite::SQLite
args:
dbname: source.sqlite
Binary file added orderly/source.sqlite
Binary file not shown.
5 changes: 5 additions & 0 deletions orderly/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# orderly: src

This directory contains a series of source directories for your reports. Each directory must contain a file `orderly.yml`. The directory name is important - if you change it it will be treated as a totally separate report.

(you can delete or edit this file safely)
8 changes: 8 additions & 0 deletions orderly/src/example/orderly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data:
dat:
query: SELECT name, number FROM thing
script: script.R
artefacts:
staticgraph:
description: A graph of things
filenames: mygraph.png
16 changes: 16 additions & 0 deletions orderly/src/example/script.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
library(drake)

save_bar_plot <- function(data, file) {
png(file)
par(mar = c(15, 4, 0.5, 0.5))
barplot(data, las = 2)
dev.off()
file
}

plan <- drake_plan(
bar_data = setNames(dat$number, dat$name),
bar_plot = save_bar_plot(bar_data, file_out("mygraph.png"))
)

make(plan)

0 comments on commit 7d1e43b

Please sign in to comment.