# Reconstruction proxy

The reconstruction computer's service: it receives each series from the
scanner's reconstruction client, enriches it from the sequence that played it,
and runs it on a reconstruction worker.

```{eval-rst}
.. currentmodule:: pulserver.proxy
```

The proxy listens on a TCP port and is started with

```bash
pulserver proxy --store DIR --port N --plugins DIR [--intake-port N] [--slots N] [--spares 1] [--save-data DIR] [--idle-timeout S]
pulserver proxy --store DIR --port N --forward HOST:PORT [--forward-config NAME] [--dicom]
```

the second forwarding every enriched series to the reconstruction server at
`HOST:PORT`, which is started with

```bash
pulserver recon --plugins DIR --port N [--slots N] [--spares 1] [--save-data DIR] [--idle-timeout S]
```

The MRD header of a series names the design it was played from; the proxy
reads that design's sequence chain and fills in the header and every
acquisition. The readouts arrive demodulated to the prescribed field-of-view
centre by the playout, and are passed on as received. Routing, slots and the
queue are described in {doc}`../explanations/reconstruction`, and the messages
and fields of a series in {doc}`../user-guide/reconstruction-client`.

## Reconstruction of a series

| Object | Description |
| --- | --- |
| {obj}`~pulserver.proxy.ReconProxy` | TCP MRD server enriching each series and routing it to a reconstruction worker or server. |
| {obj}`~pulserver.proxy.ReconServer` | TCP MRD server reconstructing each series with the plugin its config names. |
| {obj}`~pulserver.proxy.LocalReconstruction` | Each series checked, enriched and reconstructed in the calling process, as the proxy's workers do, for a host that starts no processes. |

## Designs

| Object | Description |
| --- | --- |
| {obj}`~pulserver.proxy.DesignCache` | The designs of a store, the most recently read kept tabulated. |
| {obj}`~pulserver.proxy.Design` | A stored design as the reconstruction side reads it. |
| {obj}`~pulserver.proxy.DESIGN_PARAMETER` | Header user parameter naming the design a series was played from. |
| {obj}`~pulserver.proxy.DesignIntake` | HTTP endpoint receiving pushed designs into the store the proxy reads. |

## Enrichment

| Object | Description |
| --- | --- |
| {obj}`~pulserver.proxy.SequenceTable` | The readouts of a sequence chain as MRD describes them, in play order. |
| {obj}`~pulserver.proxy.TableSpace` | One encoding space of a sequence table. |
| {obj}`~pulserver.proxy.enrich_header` | Describe the table's encoding spaces and sequence parameters in an MRD header. |
| {obj}`~pulserver.proxy.enrich_acquisition` | Apply one row of the table to an acquisition, in place. |
