4.2 KiB
4.2 KiB
Pre-Flight Checklist — Before Implementation
Decisions needed before writing code
-
YAML or JSON config?
- YAML = 1 external dep (
gopkg.in/yaml.v3), more human-readable - JSON = zero external deps (
encoding/json),config.jsoninstead ofconfig.yaml - Recommendation: JSON for true stdlib-only. YAML is fine if 1 dep is ok.
- YAML = 1 external dep (
-
Patient API availability during dev
- The patient-data API doesn't exist yet (only spec in
docs/patient-api-spec.md) - Option A: Build a thin PHP stub first (copy the reference impl from the spec)
- Option B: Make patient API call optional with graceful degradation in Stage 1
- Recommendation: B for Stage 1 (multi-accession ISO falls back to accession-list filename if API unavailable). Build the real API before Stage 2.
- The patient-data API doesn't exist yet (only spec in
-
send_rimage_multiple.phpsingle vs multi routing- The HIS JS calls
send_rimage_multiple.php?accession_number=Xfor single ANDsend_rimage_multiple.php?accession_number=X,Y,Zfor multi - The Go API has TWO endpoints:
/api/iso/print(single) and/api/iso/print-multiple(multi) - Problem: nginx can't distinguish them — same PHP file, same query param name
- Fix: Merge into one Go endpoint that auto-detects commas:
GET /api/iso/print?accession_number=X→ singleGET /api/iso/print?accession_number=X,Y,Z→ comma → multi
- Then nginx maps
send_rimage_multiple.php→/api/iso/printonly
- The HIS JS calls
-
0-file edge case in DICOM fetch
- What if PACS returns success but 0 files? (valid accession, no images)
- Current plan doesn't explicitly handle this
- Fix: After FetchDICOM, check
filesCount > 0. If 0, return404 {"error":"no DICOM data"}before attempting ISO creation.
-
microdicom viewer files path
- Config:
iso.microdicom_path: "/var/www/html/microdicom" - These files are in
raw/microdicom/in this project - Must exist on the PACS server at the configured path
- If missing, ISO will still work (just no embedded viewer)
- Config:
-
CD Publisher reachability
- Config:
cd_publisher.host: "172.16.0.120", port 104 - May not be reachable from dev environment
- storescu will fail with connection refused — handle gracefully
- Config:
-
Config path
- Hardcode:
config.yamlin working directory - Or env:
MKISO_CONFIG=/etc/mkiso/config.yaml - Recommendation: env var with fallback to
./config.yaml
- Hardcode:
Files that need to be created (not just spec'd)
| File | Status |
|---|---|
go.mod |
Create with module mkiso-server |
config.example.yaml |
Template from design doc § config.yaml |
main.go |
Entrypoint |
internal/config/config.go |
Config loading |
internal/route/route.go |
Route wiring |
internal/middleware/auth.go |
API key middleware (Stage 2) |
internal/handler/health.go |
Health check |
internal/handler/iso.go |
ISO download handlers |
internal/handler/print.go |
Print/relay handlers |
internal/service/dicom.go |
DICOM orchestration |
internal/service/iso.go |
ISO creation |
internal/service/relay.go |
CD Publisher relay |
internal/repo/patient.go |
Patient API client |
pkg/dicom/command.go |
DICOM binary runner |
Implementation order (respects dependencies)
1. config.go (no deps)
2. pkg/dicom/command.go (no deps)
3. repo/patient.go (depends on config)
4. service/dicom.go (depends on #2)
5. service/iso.go (depends on #3, #4)
6. service/relay.go (depends on #3, #4)
7. handler/health.go (no deps)
8. handler/iso.go (depends on #5)
9. handler/print.go (depends on #6)
10. route/route.go (depends on #7, #8, #9)
11. middleware/auth.go (depends on config) — Stage 2
12. main.go (depends on #10)
Known gaps in the plan (addressed above)
| Gap | Resolution |
|---|---|
Nginx regex mapping bug (old $1 didn't map to Go paths) |
Fixed — explicit location = blocks with correct proxy_pass targets |
print vs print-multiple routing conflict |
Merge into single endpoint with comma detection. Update handler accordingly. |
| 0-files from PACS not handled | Check filesCount > 0 after FetchDICOM, return 404 if empty |
| Patient API doesn't exist yet | Graceful degradation in Stage 1 (skip patient name for filename) |