# ianandersonlol/terraclimate-1001genome architecture

> Architecture diagram of the GitHub repository ianandersonlol/terraclimate-1001genome, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ianandersonlol/terraclimate-1001genome
- Repository: https://github.com/ianandersonlol/terraclimate-1001genome

## Overview

##### Project Type and Purpose
- This is a small data‐pipeline project written in R. Its purpose is to pull TerraClimate variables for the 1001 Genomes Arabidopsis accessions and produce a set of CSV output files (e.g., arabidopsis_tmax_data.csv, arabidopsis_srad_data.csv, etc.).

##### Analysis of File Structure
- Top-level files:
- Climatedata_pull.r – the main R script that orchestrates the data pull and processing
- Several CSV files (AETdata.csv, Testeroni.csv, arabidopsis_*.csv) – these are the processed outputs or lookup lists
- availableplantsforclimate.csv – likely the input accession list
- AETdata, Testeroni, etc., serve as example outputs

##### Core Components
a. External Service:
– TerraClimate data source (could be a HTTP/HTTPS API or remote netCDF repository)
b. Ingestion & Processing:
– R runtime environment
– Climdate_pull.r script
– R packages (e.g., httr, ncdf4, tidyverse) – if used, call them out
c. Input Data:
– availableplantsforclimate.csv (list of accessions)
d. Output Data:
– arabidopsis_*.csv (each climate variable’s dataset)
– AETdata.csv, Testeroni.csv as additional outputs

##### Architectural Pattern
- A simple linear ETL pipeline:
1. Extract: request climate variables from TerraClimate
2. Transform: process and reshape data in R
3. Load: write results to multiple CSVs

##### Technologies and Frameworks
- R language and interpreter
- R packages for HTTP or netCDF access (httr, ncdf4, raster, tidyverse, etc.)
- CSV file format (local storage)

##### Detail Without Overthinking
- Every CSV output as its own component.
- Simple ETL pattern since that is the core architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User / Scheduler
    User["User / Scheduler"]:::user

    %% External Service
    TerraClimate["TerraClimate API (External Service)"]:::external

    %% Documentation
    README["README.md"]:::data

    %% Input Data
    available["availableplantsforclimate.csv (Input List)"]:::data

    %% Compute / ETL
    script["Climatedata_pull.r (R Script / ETL Process)"]:::compute

    %% Output Data - Arabidopsis Climate Variables
    aet["arabidopsis_aet_data.csv"]:::data
    def["arabidopsis_def_data.csv"]:::data
    pet["arabidopsis_pet_data.csv"]:::data
    ppt["arabidopsis_ppt_data.csv"]:::data
    q["arabidopsis_q_data.csv"]:::data
    soil["arabidopsis_soil_data.csv"]:::data
    srad["arabidopsis_srad_data.csv"]:::data
    swe["arabidopsis_swe_data.csv"]:::data
    tmax["arabidopsis_tmax_data.csv"]:::data

    %% Additional Outputs
    AETsample["AETdata.csv"]:::data
    Testeroni["Testeroni.csv"]:::data

    %% Connections
    User -->|"Runs ETL"| script
    TerraClimate -->|"Fetch climate variables"| script
    available -->|"Read accession list"| script

    script -->|"Write arabidopsis_aet_data.csv"| aet
    script -->|"Write arabidopsis_def_data.csv"| def
    script -->|"Write arabidopsis_pet_data.csv"| pet
    script -->|"Write arabidopsis_ppt_data.csv"| ppt
    script -->|"Write arabidopsis_q_data.csv"| q
    script -->|"Write arabidopsis_soil_data.csv"| soil
    script -->|"Write arabidopsis_srad_data.csv"| srad
    script -->|"Write arabidopsis_swe_data.csv"| swe
    script -->|"Write arabidopsis_tmax_data.csv"| tmax
    script -->|"Write AETdata.csv"| AETsample
    script -->|"Write Testeroni.csv"| Testeroni

    %% Documentation link
    User -->|"References"| README

    %% Click Events
    click script "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/Climatedata_pull.r"
    click available "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/availableplantsforclimate.csv"
    click aet "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_aet_data.csv"
    click def "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_def_data.csv"
    click pet "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_pet_data.csv"
    click ppt "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_ppt_data.csv"
    click q "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_q_data.csv"
    click soil "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_soil_data.csv"
    click srad "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_srad_data.csv"
    click swe "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_swe_data.csv"
    click tmax "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/arabidopsis_tmax_data.csv"
    click AETsample "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/AETdata.csv"
    click Testeroni "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/Testeroni.csv"
    click README "https://github.com/ianandersonlol/terraclimate-1001genome/blob/master/README.md"

    %% Styles
    classDef external fill:#8AB6D6,stroke:#333,stroke-width:1px;
    classDef compute fill:#A8D5BA,stroke:#333,stroke-width:1px;
    classDef data fill:#F3B562,stroke:#333,stroke-width:1px;
    classDef user fill:#D6A4C2,stroke:#333,stroke-width:1px;
```
