# scenic555/optical architecture

> Architecture diagram of the GitHub repository scenic555/optical, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scenic555/optical
- Repository: https://github.com/scenic555/optical

## Overview

optical is an R package for optimal item calibration in computerized achievement tests. Users supply preliminary IRT item parameters; the package computes a restricted optimal allocation and returns item-assignment rules, which can be visualized and compared with random allocation for efficiency. The file tree also indicates block, uncertainty, and convergence-related functionality, but no source excerpts were available to verify how those modules interact. Edges therefore show only relationships described in the README.

Main entry points: [`R/optical_block.R`](https://github.com/scenic555/optical/blob/main/R/optical_block.R) (Optimal design), [`R/efficiency_block.R`](https://github.com/scenic555/optical/blob/main/R/efficiency_block.R) (Design efficiency), [`R/efficiency0.R`](https://github.com/scenic555/optical/blob/main/R/efficiency0.R) (Random allocation), [`R/boundaries_to_design.R`](https://github.com/scenic555/optical/blob/main/R/boundaries_to_design.R) (Item assignment rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Calibration inputs"]
  node_irt["IRT parameters"]
end

subgraph group_design["Optimal design"]
  node_optimizer["Optimal design<br/>[optical_block.R]"]
  node_allocation["Item assignment rules"]
  node_block["Block designs<br/>[optical_block.R]"]
end

subgraph group_evaluation["Evaluation and output"]
  node_efficiency["Design efficiency<br/>[efficiency_block.R]"]
  node_random["Random allocation<br/>[efficiency0.R]"]
  node_visualization["Design visualization<br/>[drawdesign.R]"]
end

subgraph group_extensions["Design extensions"]
  node_uncertainty["Ability uncertainty<br/>[crit.uncert.R]"]
  node_convergence["Convergence plots<br/>[convergenceplot.R]"]
end

node_user(("Package user"))

node_user -->|"provides"| node_irt
node_irt -->|"optimizes allocation"| node_optimizer
node_optimizer -->|"produces rules"| node_allocation
node_optimizer -->|"evaluates gain"| node_efficiency
node_random -->|"provides comparison"| node_efficiency
node_user -->|"plots design"| node_visualization

click node_optimizer "https://github.com/scenic555/optical/blob/main/R/optical_block.R"
click node_allocation "https://github.com/scenic555/optical/blob/main/R/boundaries_to_design.R"
click node_efficiency "https://github.com/scenic555/optical/blob/main/R/efficiency_block.R"
click node_random "https://github.com/scenic555/optical/blob/main/R/efficiency0.R"
click node_visualization "https://github.com/scenic555/optical/blob/main/R/drawdesign.R"
click node_block "https://github.com/scenic555/optical/blob/main/R/optical_block.R"
click node_uncertainty "https://github.com/scenic555/optical/blob/main/R/crit.uncert.R"
click node_convergence "https://github.com/scenic555/optical/blob/main/R/convergenceplot.R"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_irt,node_user toneBlue
class node_optimizer,node_allocation,node_block toneAmber
class node_efficiency,node_random,node_visualization toneMint
class node_uncertainty,node_convergence toneRose
```

## Components

### Calibration inputs

- **IRT parameters**

### Optimal design

- [Optimal design](https://github.com/scenic555/optical/blob/main/R/optical_block.R): `R/optical_block.R`
- [Item assignment rules](https://github.com/scenic555/optical/blob/main/R/boundaries_to_design.R): `R/boundaries_to_design.R`
- [Block designs](https://github.com/scenic555/optical/blob/main/R/optical_block.R): `R/optical_block.R`

### Evaluation and output

- [Design efficiency](https://github.com/scenic555/optical/blob/main/R/efficiency_block.R): `R/efficiency_block.R`
- [Random allocation](https://github.com/scenic555/optical/blob/main/R/efficiency0.R): `R/efficiency0.R`
- [Design visualization](https://github.com/scenic555/optical/blob/main/R/drawdesign.R): `R/drawdesign.R`

### Design extensions

- [Ability uncertainty](https://github.com/scenic555/optical/blob/main/R/crit.uncert.R): `R/crit.uncert.R`
- [Convergence plots](https://github.com/scenic555/optical/blob/main/R/convergenceplot.R): `R/convergenceplot.R`

### Other components

- **Package user**

## Connections

- Package user → IRT parameters: provides (evidence: `README.md`)
- IRT parameters → Optimal design: optimizes allocation (evidence: `README.md`)
- Optimal design → Item assignment rules: produces rules (evidence: `README.md`)
- Optimal design → Design efficiency: evaluates gain (evidence: `README.md`)
- Random allocation → Design efficiency: provides comparison (evidence: `README.md`)
- Package user → Design visualization: plots design (evidence: `README.md`)
