# hmislk/hmis-analyzer-middleware architecture

> Architecture diagram of the GitHub repository hmislk/hmis-analyzer-middleware, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hmislk/hmis-analyzer-middleware
- Repository: https://github.com/hmislk/hmis-analyzer-middleware

## Overview

This is a Windows desktop middleware application that relays results from clinical analyzers to the HMIS/LIMS REST API and returns a response to the analyzer. The main runtime path is the serial-port event handling and HTTP exchange in FormMain; Program launches that form. The excerpts show Dimension and SysMex handling, serial acknowledgements, and the LIMS request/response path. The README describes the broader analyzer-to-API purpose, but does not document additional runtime stages. Several protocol and communication enums are present; their use is not established by the excerpts.

Main entry points: [`Middleware/FormMain.cs`](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/FormMain.cs) (Middleware Form), [`Middleware/Program.cs`](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/Program.cs) (Application Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Application"]
  node_program["Application Entry<br/>[Program.cs]"]
  node_form["Middleware Form<br/>[FormMain.cs]"]
end

subgraph group_relay["Analyzer Relay"]
  node_analyzers["Serial Analyzers"]
end

subgraph group_protocol["Protocol Definitions"]
  node_analyzer_types["Analyzer Types<br/>[Analyzer.cs]"]
  node_ascii["ASCII Codes<br/>[ASCII.cs]"]
  node_communication_modes["Communication Modes"]
  node_communication_parity["Communication Parity"]
  node_communication_protocol["Transport Types"]
end

subgraph group_services["External Systems"]
  node_lims["HMIS/LIMS API"]
end

node_operator(("Operator"))

node_program -->|"launches"| node_form
node_operator -->|"configures"| node_form
node_analyzers -->|"sends frames"| node_form
node_form -->|"sends replies"| node_analyzers
node_form -->|"sends results"| node_lims
node_lims -->|"returns response"| node_form

click node_program "https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/Program.cs"
click node_form "https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/FormMain.cs"
click node_analyzer_types "https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/Analyzer.cs"
click node_ascii "https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/ASCII.cs"
click node_communication_modes "https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/ModeOfCommunication.cs"
click node_communication_parity "https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/CommunicationParameterParity.cs"
click node_communication_protocol "https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/CommunicateProtocol.cs"

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_program,node_form toneBlue
class node_analyzers toneAmber
class node_analyzer_types,node_ascii,node_communication_modes,node_communication_parity,node_communication_protocol toneMint
class node_lims toneRose
class node_operator toneIndigo
```

## Components

### Desktop Application

- [Application Entry](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/Program.cs): `Middleware/Program.cs`
- [Middleware Form](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/FormMain.cs): `Middleware/FormMain.cs`

### Analyzer Relay

- **Serial Analyzers**

### Protocol Definitions

- [Analyzer Types](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/Analyzer.cs): `Middleware/Analyzer.cs`
- [ASCII Codes](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/ASCII.cs): `Middleware/ASCII.cs`
- [Communication Modes](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/ModeOfCommunication.cs): `Middleware/ModeOfCommunication.cs`
- [Communication Parity](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/CommunicationParameterParity.cs): `Middleware/CommunicationParameterParity.cs`
- [Transport Types](https://github.com/hmislk/hmis-analyzer-middleware/blob/master/Middleware/CommunicateProtocol.cs): `Middleware/CommunicateProtocol.cs`

### External Systems

- **HMIS/LIMS API**

### Other components

- **Operator**

## Connections

- Application Entry → Middleware Form: launches (evidence: `Middleware/Program.cs`)
- Operator → Middleware Form: configures (evidence: `Middleware/FormMain.cs`)
- Serial Analyzers → Middleware Form: sends frames (evidence: `Middleware/FormMain.cs`)
- Middleware Form → Serial Analyzers: sends replies (evidence: `Middleware/FormMain.cs`)
- Middleware Form → HMIS/LIMS API: sends results (evidence: `Middleware/FormMain.cs`)
- HMIS/LIMS API → Middleware Form: returns response (evidence: `Middleware/FormMain.cs`)
