{
  "info": {
    "_postman_id": "medconnect-lis-api-collection",
    "name": "MedConnect LIS API",
    "description": "Official Postman Collection for the MedConnect LIS/HIS Integration API. MedConnect acts as the HTTP client and calls these endpoints on your LIS server.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://your-lis-server.example.com/api",
      "type": "string"
    },
    {
      "key": "bearer_token",
      "value": "",
      "type": "string"
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{bearer_token}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "1. Tests API",
      "description": "Retrieve available LIS tests for mapping.",
      "item": [
        {
          "name": "Search Tests by Code",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"Name\": \"\",\n  \"Code\": \"cbc\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/tests",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "tests"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"tests\": [\n    {\n      \"ID\": \"101\",\n      \"Name\": \"COMPLETE BLOOD COUNT (CBC)\",\n      \"Code\": \"CBC\",\n      \"Type\": \"EDTA Whole Blood\"\n    }\n  ]\n}"
            }
          ]
        },
        {
          "name": "Retrieve All Tests",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"Name\": \"\",\n  \"Code\": \"\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/tests",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "tests"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"tests\": [\n    {\"ID\": \"101\", \"Name\": \"COMPLETE BLOOD COUNT (CBC)\", \"Code\": \"CBC\", \"Type\": \"EDTA Whole Blood\"},\n    {\"ID\": \"205\", \"Name\": \"GLUCOSE\", \"Code\": \"GLU\", \"Type\": \"Serum\"},\n    {\"ID\": \"310\", \"Name\": \"LIVER FUNCTION TEST\", \"Code\": \"LFT\", \"Type\": \"Serum\"}\n  ]\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "2. Orders API",
      "description": "Retrieve order details by sample number.",
      "item": [
        {
          "name": "Get Order by Sample Number",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              },
              {
                "key": "X-Expected-Sample",
                "value": "2071720201"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"SampleNumber\": \"2071720201\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/orders",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "orders"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"order\": {\n    \"SampleNumber\": \"2071720201\",\n    \"TransactionDate\": \"20250313101934\",\n    \"SampleType\": \"Serum\",\n    \"Priority\": \"R\",\n    \"patient\": {\"ID\": \"104323\", \"Name\": \"Tariq Tawfiq Hussein Mahmoud\", \"Sex\": \"M\", \"DateOfBirth\": \"19930101\", \"Age\": \"32\", \"AgeUnit\": \"Y\"},\n    \"tests\": [\"100\", \"102\", \"300\"]\n  }\n}"
            },
            {
              "name": "Not Found",
              "status": 400,
              "code": 400,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"message\": \"Sample number not found\",\n  \"errors\": [\"No order exists with sample number INVALID123\"]\n}"
            }
          ]
        },
        {
          "name": "Get Order with All Tests",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              },
              {
                "key": "X-Expected-Sample",
                "value": "2071720201"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"SampleNumber\": \"2071720201\",\n  \"allTests\": \"1\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/orders",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "orders"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"order\": {\n    \"SampleNumber\": \"2071720201\",\n    \"TransactionDate\": \"20250313101934\",\n    \"SampleType\": \"Serum\",\n    \"Priority\": \"R\",\n    \"patient\": {\"ID\": \"104323\", \"Name\": \"Tariq Tawfiq Hussein Mahmoud\", \"Sex\": \"M\", \"DateOfBirth\": \"19930101\", \"Age\": \"32\", \"AgeUnit\": \"Y\"},\n    \"tests\": [\"100\", \"102\", \"300\"]\n  }\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "3. Results API",
      "description": "Submit completed test results to the LIS.",
      "item": [
        {
          "name": "Submit Simple Results",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"results\": [\n    {\"SampleNumber\": \"2071630101\", \"TestCode\": \"15/11012\", \"SubTestCode\": \"\", \"Result\": \"36.19\"},\n    {\"SampleNumber\": \"2071630101\", \"TestCode\": \"15/11008\", \"SubTestCode\": \"\", \"Result\": \"8.62\"}\n  ]\n}"
            },
            "url": {
              "raw": "{{base_url}}/results",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "results"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"status\": \"success\"\n}"
            }
          ]
        },
        {
          "name": "Submit Panel Results (CBC)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"results\": [\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"WBC\", \"Result\": \"9.0\"},\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"RBC\", \"Result\": \"4.95\"},\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"HB\", \"Result\": \"14.2\"},\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"HCT\", \"Result\": \"41.8\"},\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"MCV\", \"Result\": \"84.6\"},\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"MCH\", \"Result\": \"28.8\"},\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"MCHC\", \"Result\": \"34.0\"},\n    {\"SampleNumber\": \"2071580504\", \"TestCode\": \"2/11084\", \"SubTestCode\": \"PLT\", \"Result\": \"309\"}\n  ]\n}"
            },
            "url": {
              "raw": "{{base_url}}/results",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "results"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"status\": \"success\"\n}"
            }
          ]
        },
        {
          "name": "Submit Microbiology Hierarchical Result",
          "description": "Microbiology result (Culture & Sensitivity / AST) from a microbiology evaluator that returns a hierarchical result model. Any microbiology instrument may emit this model; the MicroScan LabPro evaluator is the first implementing example. For these rows, LisResult.Result is a stringified hierarchical JSON object (not a numeric value): one row per Panel, TestCode = Panel LIS test ID, SubTestCode empty. Parse Result with JSON.parse. Full structure, field semantics, positive/negative examples, and deployment notes are documented in Documentation/References/Operations/Microbiology_Hierarchical_Results.md.",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              },
              {
                "key": "X-Result-Model",
                "value": "Microbiology-Hierarchical-JSON"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"results\": [\n    {\n      \"SampleNumber\": \"2071720201\",\n      \"TestCode\": \"15/21003\",\n      \"SubTestCode\": \"\",\n      \"Result\": \"{\\\"sampleNumber\\\":\\\"2071720201\\\",\\\"sampleType\\\":\\\"URINE\\\",\\\"growth\\\":\\\"POSITIVE\\\",\\\"status\\\":\\\"F\\\",\\\"isolates\\\":[{\\\"isolateNumber\\\":\\\"1\\\",\\\"organism\\\":{\\\"organismCode\\\":\\\"5080\\\",\\\"organismName\\\":\\\"ESCHERICHIA COLI\\\"},\\\"susceptibility\\\":[{\\\"drugCode\\\":\\\"AMC\\\",\\\"drugName\\\":\\\"Amoxicillin/Clavulanate\\\",\\\"mic\\\":\\\">=32\\\",\\\"result\\\":\\\"Resistant\\\",\\\"resultCode\\\":\\\"R\\\"},{\\\"drugCode\\\":\\\"FUR\\\",\\\"drugName\\\":\\\"Nitrofurantoin\\\",\\\"mic\\\":\\\"<=16\\\",\\\"result\\\":\\\"Susceptible\\\",\\\"resultCode\\\":\\\"S\\\"}]}]}\"\n    }\n  ]\n}"
            },
            "url": {
              "raw": "{{base_url}}/results",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "results"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"status\": \"success\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "4. Processed API (Optional)",
      "description": "Notify the LIS that an order has been processed.",
      "item": [
        {
          "name": "Mark Order as Processed",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"SampleNumber\": \"2071720201\",\n  \"Tests\": \"[\\\"100\\\",\\\"102\\\",\\\"300\\\"]\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/processed",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "processed"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"status\": \"success\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "5. Local API Server (Incoming Push)",
      "description": "MedConnect local HTTP server to receive order pushes from the LIS.",
      "item": [
        {
          "name": "Push Order to MedConnect",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"SampleNumber\": \"2071720201\",\n  \"TransactionDate\": \"20250313101934\",\n  \"SampleType\": \"Serum\",\n  \"patient\": {\"ID\": \"104323\", \"Name\": \"Tariq Tawfiq Hussein Mahmoud\", \"Sex\": \"M\", \"DateOfBirth\": \"19930101\"},\n  \"tests\": [\"100\", \"102\", \"300\"]\n}"
            },
            "url": {
              "raw": "http://localhost:5000/api/getSampleData",
              "protocol": "http",
              "host": [
                "localhost"
              ],
              "port": "5000",
              "path": [
                "api",
                "getSampleData"
              ]
            }
          },
          "response": [
            {
              "name": "Success",
              "status": 200,
              "code": 200,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": \"success\",\n  \"message\": \"Data received\"\n}"
            },
            {
              "name": "Missing Data",
              "status": 422,
              "code": 422,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"message\": \"Order data is missing or empty\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "6. Error Responses",
      "description": "Reference examples for error responses.",
      "item": [
        {
          "name": "400 Bad Request",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"SampleNumber\": \"INVALID123\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/orders",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "orders"
              ]
            }
          },
          "response": [
            {
              "name": "Validation Error",
              "status": 400,
              "code": 400,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"message\": \"Sample number not found\",\n  \"errors\": [\"No order exists with sample number INVALID123\"]\n}"
            }
          ]
        },
        {
          "name": "500 Server Error",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{bearer_token}}"
              },
              {
                "key": "X-Request-ID",
                "value": "{{$guid}}"
              },
              {
                "key": "X-Request-Timestamp",
                "value": "{{$timestamp}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"SampleNumber\": \"2071720201\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/orders",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "orders"
              ]
            }
          },
          "response": [
            {
              "name": "Internal Server Error",
              "status": 500,
              "code": 500,
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"message\": \"Database connection failed\",\n  \"errors\": []\n}"
            }
          ]
        }
      ]
    }
  ]
}