Skip to content

Commit ee6524d

Browse files
committed
Add loose coupling example
1 parent 39d3180 commit ee6524d

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

slides.qmd

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,37 @@ Based on [workflow.yml file for](https://github.com/nptscot/nptscot.github.io/bl
114114

115115
# Approaches to cross-language projects
116116

117+
Checked boxes indicate approaches used in the NPT project.
118+
117119
- [x] "Loose coupling" (system calls)
118120
- [x] "Tight coupling" with low-level code embedded in R/Python/other packages (e.g. `sf`, `rsgeo`, `shapely`)
119121
- [ ] Project environments (e.g. `pixi`, `mamba` [`rix`](https://docs.ropensci.org/rix/))
120-
- [ ] Containerisation
122+
- [x] Containerisation
123+
124+
## Loose coupling
125+
126+
Example: [`odjitter`](https://github.com/dabreegster/odjitter/blob/98a7a6e03bc54bc79d3b3abbde91b6f79173ff1a/r/R/jitter.R#L163C1-L180C33) R package
127+
128+
```r
129+
msg = glue::glue("{odjitter_location} jitter --od-csv-path {od_csv_path} \\
130+
--zones-path {zones_path} \\
131+
--zone-name-key {zone_name_key} \\
132+
--origin-key {origin_key} \\
133+
--destination-key {destination_key} \\
134+
--subpoints-origins-path {subpoints_origins_path} \\
135+
--subpoints-destinations-path {subpoints_destinations_path} \\
136+
--disaggregation-key {disaggregation_key} \\
137+
--disaggregation-threshold {disaggregation_threshold} \\
138+
--rng-seed {rng_seed} \\
139+
{deduplicate_pairs} \\
140+
--output-path {output_path}")
141+
if(show_command) {
142+
message("command sent to the system:")
143+
cat(msg)
144+
}
145+
system(msg)
146+
res = sf::read_sf(output_path)
147+
```
121148

122149

123150
# Publishing

0 commit comments

Comments
 (0)