remitt-server

module
v0.0.0-...-f9a33d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: GPL-2.0

README

REMITT SERVER

Build Status Go Report Card GoDoc

REMITT (Electronic Medical Information Translation and Transmission) — Go rewrite of the J2EE 0.5.x SOAP backend, targeting 100% feature parity against the same MySQL schema. Runs against a valid REMITT 0.5.x database with no modifications.

Architecture

Layer Technology
Language Go 1.25
Web framework Echo v5 (migrated from Gin)
ORM GORP + supplementary sqlc query layer
Database MySQL (same schema as REMITT 0.5.x — tables, stored procedures, column names are a fixed contract)
Auth Stateless HTTP BasicAuth (MD5 hashes — legacy 0.5.x compatibility)
Config YAML (config.yaml)
Plugin model Registry + factory pattern (init() self-registration)

Plugin Systems (all complete)

Every plugin type follows a uniform registry/factory pattern with init() self-registration:

System Interface Implementations Status
Eligibility EligibilityChecker Dummy, Gateway EDI (SOAP+PGP), NC Medicaid (SFTP+PGP), SFTP (optional PGP), Optum (Change Healthcare OAuth2 REST), Stedi (OAuth2 REST), BCBS FHIR (1upHealth), Medicare HETS (CMS SOAP/X12 270/271) 8/8 done
Transport Transporter Script (otto JS), SFTP, StoreFile, StoreFilePdf, ClaimLogic, Gateway EDI, ScriptedHttp 7/7 done
Parser Parser X12 envelope (ISA/GS/ST/SE/GE/IEA), X12 835 remittance, X12 271 eligibility response, X12 997 functional ack 4/4 done
Translation Translator X12Xml (XML→EDI text), X12Passthrough (raw bytes), FixedFormXml (XML→fixed-width), FixedFormPdf (XML→PDF via gofpdf+gofpdi) 4/4 done
Render Renderer XsltPlugin (ratago or xsltproc), PreRenderedPlugin (passthrough) 2/2 done
Callback CallbackSender SOAP callback to originating systems (WS-Security UsernameToken, fires non-blocking post-pipeline) 1/1 done
Validation Validator X12Validator (otto JS engine, scripts in resources/scripts/validation/) 1/1 done
Scooper Scooper SftpScooper, GatewayEdiSftpScooper (SFTP + PGP decrypt) 2/2 done

EDI Pipeline

Render → Translation → Transport → Callback
  1. Render — produces intermediate output (XSLT transform or passthrough)
  2. Translation — resolves format bridge (e.g. X12Xml → X12 EDI text, FixedFormXml → PDF)
  3. Transport — delivers the result (SFTP, script, HTTP, local file store)
  4. Callback — non-blocking SOAP notification to originating systems with job result

Jobs are dispatched through a channel-based worker pool (jobqueue/). Scheduled tasks (eligibility checks, scooper runs) are driven by task/scheduler.go.

API Endpoints (20/20 complete)

All 20 endpoints from the Java 0.5.x API surface are implemented:

  • Authentication & users: changePassword, getCurrentUsername, addRemittUser, listRemittUsers
  • Config: getConfigValues, setConfigValue
  • Payloads: insertPayload, resubmitPayload, getStatus, getBulkStatus
  • Files: getFile, getFileList, getOutputMonths, getOutputYears
  • Eligibility: getEligibility, batchEligibilityCheck
  • Keyring: addKeyToKeyring
  • Plugins: getPlugins, getPluginOptions
  • Protocol: getProtocolVersion
  • Validation: validatePayload
  • Parsing: parseData

Access control is role-based (admin / user) via BasicAuth middleware.

Architectural Changes from REMITT 0.5.x

  • Language: Java/J2EE → Go with Echo v5 web framework
  • Framework: Apache CXF SOAP → RESTful JSON API + SOAP 1.1 compatibility layer (soap/) for legacy Java clients
  • ORM: Hibernate → GORP with supplementary sqlc query layer for type-safe generated queries
  • Plugin model: Spring beans → registry/factory pattern with init() self-registration
  • Job execution: Thread-per-job → channel-based worker pool (jobqueue/)
  • Scheduling: Quartz → lightweight in-process scheduler (task/scheduler.go)
  • Auth: Container-managed security → stateless HTTP BasicAuth with MD5 password hashing (legacy DB compatibility)
  • Eligibility: Expanded from 4 to 8 checkers — added OAuth2 REST (Optum, Stedi), FHIR R4 (BCBS via 1upHealth), and CMS HETS SOAP/X12 270/271 (Medicare)
  • X12: Full envelope + 835/271/997 parsers with 22 DTO structs
  • PGP/GPG: Native Go armoring (crypto/pgp.go) — encrypt, decrypt, detect
  • Testing: E2E pipeline test suite (test/e2e/) with testdata fixtures + per-plugin unit tests

Testing

test/harness/sshsftp is an in-process SSH server with a real SFTP subsystem (pkg/sftp ships a server, not just a client) on a loopback port, with its own host key, its own credentials and its own temporary SFTP root. It exists so the SFTP paths — the sftp transport, gatewayedi, claimlogic, and the SftpScooper / GatewayEdiSftpScooper scoopers — can be tested for real (a handshake, host key verification, an upload, a download) without a remote host. Before it, those tests were skipped as "requires a live SFTP server" or replaced with listeners that never spoke SSH, which is how a nil HostKeyCallback and an undecrypted remittance both survived in the tree.

srv := sshsftp.Start(t)
knownHosts, err := srv.WriteKnownHosts(t.TempDir())
if err != nil {
	t.Fatal(err)
}
// paths.known-hosts -> knownHosts, and configure the endpoint with
// sftpHost=srv.Host, sftpPort=srv.Port, sftpUsername=srv.User,
// sftpPassword=srv.Password, sftpPath=srv.Dir.
// Afterwards: srv.Uploaded("payload.x12") is what the client sent.

Use it only when the assertion is about the wire; configuration parsing and fail-closed policy checks are cheaper to pin with a listener or a fake session. See test/harness/sshsftp/README.md for the full API.

To watch a real delivery by hand, start the same server standalone — it prints the connection details, a ready-to-paste known_hosts line and the transport options, then reports files as they arrive:

go run ./cmd/sshsftp-harness/

Other suites: test/e2e/ drives the render → translation → transport → callback pipeline, and go test ./... runs the per-plugin unit tests.

Dependencies

  • Echo v5 — web framework
  • GORP — database access layer
  • sqlc — type-safe generated queries (internal/db/)
  • Go-MySQL-Driver — MySQL driver
  • otto — JavaScript engine (script transports, X12 validation)
  • goquery — HTML scraping (scripted HTTP transport)
  • pkg/sftp — SFTP client, and the server the test harness (test/harness/sshsftp) runs
  • gofpdf + gofpdi — PDF generation (FixedFormPdf translation)
  • ratago — native Go XSLT processor
  • gokogiri — native Go XML/DOM/XPath support
  • golang-migrate — database migrations
  • prometheus/client_golang — metrics instrumentation

Operations

Prometheus Metrics

The server exposes standard HTTP metrics at /metrics in Prometheus text format:

  • http_requests_total — counter by method, path, status
  • http_request_duration_seconds — histogram by method, path, status
  • http_requests_in_flight — gauge of concurrent requests
Docker
docker build -t remitt-server .
docker run -p 3000:3000 -v ./remitt.yml:/etc/remitt/remitt.yml remitt-server

The multi-stage Dockerfile produces a minimal Debian-slim image with xsltproc for external XSLT transforms. All SSH/SFTP connections use Go's golang.org/x/crypto/ssh — no system SSH client required.

Quick Start

cp config.yaml.example config.yaml
# edit config.yaml with your MySQL credentials
go run ./cmd/remitt-server/

The server starts on the port configured in config.yaml (default: 8080).

Code in this repository runs against a valid REMITT 0.5.x series database with no modifications.

Full migration task list: TODO.md

Directories

Path Synopsis
api module
client module
cmd
remitt-server command
sshsftp-harness command
Command sshsftp-harness starts the in-process SSH + SFTP test server from test/harness/sshsftp on a loopback port and prints everything a developer needs to point a real transport configuration at it.
Command sshsftp-harness starts the in-process SSH + SFTP test server from test/harness/sshsftp on a loopback port and prints everything a developer needs to point a real transport configuration at it.
common module
config module
Package crypto wraps OpenPGP for the EDI payloads this server exchanges with trading partners (see eligibility/ and scooper/).
Package crypto wraps OpenPGP for the EDI payloads this server exchanges with trading partners (see eligibility/ and scooper/).
internal
jobqueue module
Package middleware provides Echo v5 middleware components.
Package middleware provides Echo v5 middleware components.
model module
user module
render module
Package soap provides a SOAP 1.1 compatibility layer that mirrors the Apache CXF JAX-WS interface from the old Java REMITT 0.5.x server.
Package soap provides a SOAP 1.1 compatibility layer that mirrors the Apache CXF JAX-WS interface from the old Java REMITT 0.5.x server.
test
harness/sshsftp
Package sshsftp starts a real SSH server with a real SFTP subsystem on a loopback port, so a test can exercise the SFTP code paths of this repository against a real handshake, a real authentication and a real file transfer without a remote host.
Package sshsftp starts a real SSH server with a real SFTP subsystem on a loopback port, so a test can exercise the SFTP code paths of this repository against a real handshake, a real authentication and a real file transfer without a remote host.
translation module
transport module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL