# austin-routt/opencif architecture

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

- Interactive diagram: https://gitdiagram.com/austin-routt/opencif
- Repository: https://github.com/austin-routt/opencif

## Overview

opencif turns cutoff and filtrate-fraction targets (or a device specification) into a planned CIF microfluidic design, DXF photomask, and build record. The main path validates the specification, computes the row schedule, lays out and draws the device, measures the drawing, runs design and physics checks, and renders figures. Separate capabilities support composition from parts and published-device designs. The README documents the end-to-end checks; source excerpts and the index confirm key module relationships. Some internal calls and unsampled subsystems are not shown, so those links are omitted.

Main entry points: [`opencif/build.py`](https://github.com/austin-routt/opencif/blob/main/opencif/build.py) (Design and drawing), [`opencif/pipeline.py`](https://github.com/austin-routt/opencif/blob/main/opencif/pipeline.py) (Build orchestration), [`opencif/api.py`](https://github.com/austin-routt/opencif/blob/main/opencif/api.py) (Python API), [`opencif/__main__.py`](https://github.com/austin-routt/opencif/blob/main/opencif/__main__.py) (Command line)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Inputs and orchestration"]
  node_cli["Command line<br/>[__main__.py]"]
  node_api["Python API<br/>[api.py]"]
  node_spec["Specification<br/>[spec.py]"]
  node_pipeline["Build orchestration<br/>[pipeline.py]"]
end

subgraph group_design["Device design"]
  node_schedule["Row schedule<br/>[schedule.py]"]
  node_kernels["Physics kernels<br/>[kernels.py]"]
  node_layout["Device layout<br/>[layout.py]"]
  node_shapes["Geometry primitives<br/>[shapes.py]"]
  node_dxf["DXF writer<br/>[dxf.py]"]
  node_builder["Design and drawing<br/>[build.py]"]
  node_composer["Part composition<br/>[compose.py]"]
end

subgraph group_verification["Measurement and checks"]
  node_measurer["Drawing measurement<br/>[measure.py]"]
  node_designchecks["Design checks<br/>[design_code.py]"]
  node_auditor["Physics auditor<br/>[auditor.py]"]
  node_ruler["Auditor ruler<br/>[ruler.py]"]
end

subgraph group_outputs["Artifacts and reuse"]
  node_proof["Build figures<br/>[proof.py]"]
  node_drawing["Figure drawing<br/>[drawing.py]"]
  node_published["Published devices<br/>[published.py]"]
  node_devicekit["Device packages<br/>[devicekit.py]"]
  node_record["Build artifacts<br/>[pipeline.py]"]
end

node_user(("Designer"))

node_user -->|"invokes"| node_cli
node_user -->|"calls"| node_api
node_cli -.->|"runs build"| node_pipeline
node_api -->|"validates"| node_spec
node_api -->|"starts run"| node_pipeline
node_pipeline -->|"loads"| node_spec
node_pipeline -->|"plans and builds"| node_builder
node_schedule -->|"uses"| node_kernels
node_builder -->|"computes design"| node_schedule
node_builder -->|"constructs layout"| node_layout
node_layout -->|"uses"| node_shapes
node_builder -->|"writes mask"| node_dxf
node_builder -->|"measures drawing"| node_measurer
node_builder -->|"runs checks"| node_designchecks
node_builder -->|"audits mask"| node_auditor
node_auditor -->|"uses"| node_ruler
node_pipeline -->|"renders figures"| node_proof
node_proof -->|"draws figures"| node_drawing
node_pipeline -->|"writes record"| node_record
node_user -->|"composes parts"| node_composer
node_composer -->|"builds composed design"| node_builder
node_user -.->|"selects design"| node_published
node_devicekit -->|"builds preset"| node_pipeline

click node_cli "https://github.com/austin-routt/opencif/blob/main/opencif/__main__.py"
click node_api "https://github.com/austin-routt/opencif/blob/main/opencif/api.py"
click node_spec "https://github.com/austin-routt/opencif/blob/main/opencif/spec.py"
click node_pipeline "https://github.com/austin-routt/opencif/blob/main/opencif/pipeline.py"
click node_schedule "https://github.com/austin-routt/opencif/blob/main/opencif/physics/schedule.py"
click node_kernels "https://github.com/austin-routt/opencif/blob/main/opencif/physics/kernels.py"
click node_layout "https://github.com/austin-routt/opencif/blob/main/opencif/geometry/layout.py"
click node_shapes "https://github.com/austin-routt/opencif/blob/main/opencif/geometry/shapes.py"
click node_dxf "https://github.com/austin-routt/opencif/blob/main/opencif/geometry/dxf.py"
click node_builder "https://github.com/austin-routt/opencif/blob/main/opencif/build.py"
click node_composer "https://github.com/austin-routt/opencif/blob/main/opencif/compose.py"
click node_measurer "https://github.com/austin-routt/opencif/blob/main/opencif/checks/measure.py"
click node_designchecks "https://github.com/austin-routt/opencif/blob/main/opencif/checks/design_code.py"
click node_auditor "https://github.com/austin-routt/opencif/blob/main/opencif/checks/auditor.py"
click node_ruler "https://github.com/austin-routt/opencif/blob/main/opencif/checks/ruler.py"
click node_proof "https://github.com/austin-routt/opencif/blob/main/opencif/figures/proof.py"
click node_drawing "https://github.com/austin-routt/opencif/blob/main/opencif/figures/drawing.py"
click node_published "https://github.com/austin-routt/opencif/blob/main/opencif/published.py"
click node_devicekit "https://github.com/austin-routt/opencif/blob/main/devices/_shared/devicekit.py"
click node_record "https://github.com/austin-routt/opencif/blob/main/opencif/pipeline.py"

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_cli,node_api,node_spec,node_pipeline toneBlue
class node_schedule,node_kernels,node_layout,node_shapes,node_dxf,node_builder,node_composer toneAmber
class node_measurer,node_designchecks,node_auditor,node_ruler toneMint
class node_proof,node_drawing,node_published,node_devicekit,node_record toneRose
class node_user toneIndigo
```

## Components

### Inputs and orchestration

- [Command line](https://github.com/austin-routt/opencif/blob/main/opencif/__main__.py): `opencif/__main__.py`
- [Python API](https://github.com/austin-routt/opencif/blob/main/opencif/api.py): `opencif/api.py`
- [Specification](https://github.com/austin-routt/opencif/blob/main/opencif/spec.py): `opencif/spec.py`
- [Build orchestration](https://github.com/austin-routt/opencif/blob/main/opencif/pipeline.py): `opencif/pipeline.py`

### Device design

- [Row schedule](https://github.com/austin-routt/opencif/blob/main/opencif/physics/schedule.py): `opencif/physics/schedule.py`
- [Physics kernels](https://github.com/austin-routt/opencif/blob/main/opencif/physics/kernels.py): `opencif/physics/kernels.py`
- [Device layout](https://github.com/austin-routt/opencif/blob/main/opencif/geometry/layout.py): `opencif/geometry/layout.py`
- [Geometry primitives](https://github.com/austin-routt/opencif/blob/main/opencif/geometry/shapes.py): `opencif/geometry/shapes.py`
- [DXF writer](https://github.com/austin-routt/opencif/blob/main/opencif/geometry/dxf.py): `opencif/geometry/dxf.py`
- [Design and drawing](https://github.com/austin-routt/opencif/blob/main/opencif/build.py): `opencif/build.py`
- [Part composition](https://github.com/austin-routt/opencif/blob/main/opencif/compose.py): `opencif/compose.py`

### Measurement and checks

- [Drawing measurement](https://github.com/austin-routt/opencif/blob/main/opencif/checks/measure.py): `opencif/checks/measure.py`
- [Design checks](https://github.com/austin-routt/opencif/blob/main/opencif/checks/design_code.py): `opencif/checks/design_code.py`
- [Physics auditor](https://github.com/austin-routt/opencif/blob/main/opencif/checks/auditor.py): `opencif/checks/auditor.py`
- [Auditor ruler](https://github.com/austin-routt/opencif/blob/main/opencif/checks/ruler.py): `opencif/checks/ruler.py`

### Artifacts and reuse

- [Build figures](https://github.com/austin-routt/opencif/blob/main/opencif/figures/proof.py): `opencif/figures/proof.py`
- [Figure drawing](https://github.com/austin-routt/opencif/blob/main/opencif/figures/drawing.py): `opencif/figures/drawing.py`
- [Published devices](https://github.com/austin-routt/opencif/blob/main/opencif/published.py): `opencif/published.py`
- [Device packages](https://github.com/austin-routt/opencif/blob/main/devices/_shared/devicekit.py): `devices/_shared/devicekit.py`
- [Build artifacts](https://github.com/austin-routt/opencif/blob/main/opencif/pipeline.py): `opencif/pipeline.py`

### Other components

- **Designer**

## Connections

- Designer → Command line: invokes
- Designer → Python API: calls
- Command line → Build orchestration: runs build
- Python API → Specification: validates (evidence: `opencif/api.py`)
- Python API → Build orchestration: starts run (evidence: `opencif/api.py`)
- Build orchestration → Specification: loads (evidence: `opencif/pipeline.py`)
- Build orchestration → Design and drawing: plans and builds (evidence: `opencif/pipeline.py`)
- Row schedule → Physics kernels: uses (evidence: `opencif/physics/schedule.py`)
- Design and drawing → Row schedule: computes design (evidence: `opencif/build.py`)
- Design and drawing → Device layout: constructs layout (evidence: `opencif/build.py`)
- Device layout → Geometry primitives: uses (evidence: `opencif/geometry/layout.py`)
- Design and drawing → DXF writer: writes mask (evidence: `opencif/build.py`)
- Design and drawing → Drawing measurement: measures drawing (evidence: `opencif/build.py`)
- Design and drawing → Design checks: runs checks (evidence: `opencif/build.py`)
- Design and drawing → Physics auditor: audits mask (evidence: `opencif/build.py`)
- Physics auditor → Auditor ruler: uses (evidence: `opencif/checks/auditor.py`)
- Build orchestration → Build figures: renders figures (evidence: `opencif/pipeline.py`)
- Build figures → Figure drawing: draws figures (evidence: `opencif/figures/proof.py`)
- Build orchestration → Build artifacts: writes record (evidence: `opencif/pipeline.py`)
- Designer → Part composition: composes parts
- Part composition → Design and drawing: builds composed design (evidence: `opencif/compose.py`)
- Designer → Published devices: selects design
- Device packages → Build orchestration: builds preset (evidence: `devices/_shared/devicekit.py`)
