{
 "meta": {
  "captured": "2026-11-19",
  "how": "FastAPI TestClient, in-process, no server",
  "python": "3.13.18",
  "fastapi": "0.165.0",
  "pydantic": "2.14.4",
  "scikit_learn": "1.9.1",
  "pandas": "2.3.3",
  "model": "Logistic balanced",
  "threshold": 0.5,
  "features": [
   "loc",
   "v(g)",
   "ev(g)",
   "iv(g)",
   "n",
   "v",
   "l",
   "d",
   "i",
   "e",
   "b",
   "t",
   "lOCode",
   "lOComment",
   "lOBlank",
   "locCodeAndComment",
   "uniq_Op",
   "uniq_Opnd",
   "total_Op",
   "total_Opnd",
   "branchCount"
  ],
  "openapi": "3.1.0",
  "api_version": "1.0.0",
  "routes": [
   [
    "/",
    "GET"
   ],
   [
    "/docs",
    "GET,HEAD"
   ],
   [
    "/docs/oauth2-redirect",
    "GET,HEAD"
   ],
   [
    "/health",
    "GET"
   ],
   [
    "/openapi.json",
    "GET,HEAD"
   ],
   [
    "/predict",
    "POST"
   ],
   [
    "/redoc",
    "GET,HEAD"
   ]
  ]
 },
 "exchanges": [
  {
   "name": "root",
   "request": {
    "method": "GET",
    "path": "/",
    "body": null,
    "headers": {}
   },
   "response": {
    "status": 200,
    "content_type": "application/json",
    "body": {
     "message": "Group 6 KC1 Software Defect Prediction API",
     "model": "Logistic balanced"
    }
   }
  },
  {
   "name": "health",
   "request": {
    "method": "GET",
    "path": "/health",
    "body": null,
    "headers": {}
   },
   "response": {
    "status": 200,
    "content_type": "application/json",
    "body": {
     "status": "ok",
     "model_loaded": true,
     "model": "Logistic balanced",
     "threshold": 0.5,
     "feature_count": 21
    }
   }
  },
  {
   "name": "predict-sample",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": {
     "loc": 78.0,
     "v(g)": 7.0,
     "ev(g)": 1.0,
     "iv(g)": 6.0,
     "n": 213.0,
     "v": 1189.6,
     "l": 0.06,
     "d": 17.71,
     "i": 67.19,
     "e": 21062.86,
     "b": 0.4,
     "t": 1170.16,
     "lOCode": 66.0,
     "lOComment": 4.0,
     "lOBlank": 6.0,
     "locCodeAndComment": 0.0,
     "uniq_Op": 14.0,
     "uniq_Opnd": 34.0,
     "total_Op": 127.0,
     "total_Opnd": 86.0,
     "branchCount": 13.0
    },
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 200,
    "content_type": "application/json",
    "body": {
     "prediction": 1,
     "label": "Defective",
     "defect_probability": 0.7230676312840666,
     "threshold": 0.5,
     "model": "Logistic balanced"
    }
   }
  },
  {
   "name": "predict-flagged",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": {
     "loc": 1.1,
     "v(g)": 1.4,
     "ev(g)": 1.4,
     "iv(g)": 1.4,
     "n": 1.3,
     "v": 1.3,
     "l": 1.3,
     "d": 1.3,
     "i": 1.3,
     "e": 1.3,
     "b": 1.3,
     "t": 1.3,
     "lOCode": 2.0,
     "lOComment": 2.0,
     "lOBlank": 2.0,
     "locCodeAndComment": 2.0,
     "uniq_Op": 1.2,
     "uniq_Opnd": 1.2,
     "total_Op": 1.2,
     "total_Opnd": 1.2,
     "branchCount": 1.4
    },
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 200,
    "content_type": "application/json",
    "body": {
     "prediction": 1,
     "label": "Defective",
     "defect_probability": 0.6756835241062081,
     "threshold": 0.5,
     "model": "Logistic balanced"
    }
   }
  },
  {
   "name": "predict-clean",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": {
     "loc": 25.0,
     "v(g)": 3.0,
     "ev(g)": 1.0,
     "iv(g)": 3.0,
     "n": 58.0,
     "v": 254.75,
     "l": 0.11,
     "d": 9.35,
     "i": 27.25,
     "e": 2381.95,
     "b": 0.08,
     "t": 132.33,
     "lOCode": 21.0,
     "lOComment": 0.0,
     "lOBlank": 2.0,
     "locCodeAndComment": 0.0,
     "uniq_Op": 11.0,
     "uniq_Opnd": 10.0,
     "total_Op": 41.0,
     "total_Opnd": 17.0,
     "branchCount": 5.0
    },
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 200,
    "content_type": "application/json",
    "body": {
     "prediction": 0,
     "label": "Non-defective",
     "defect_probability": 0.3920490229417669,
     "threshold": 0.5,
     "model": "Logistic balanced"
    }
   }
  },
  {
   "name": "missing-fields",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": {
     "loc": 123
    },
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 422,
    "content_type": "application/json",
    "body": {
     "detail": [
      {
       "type": "missing",
       "loc": [
        "body",
        "v(g)"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "ev(g)"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "iv(g)"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "n"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "v"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "l"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "d"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "i"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "e"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "b"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "t"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "lOCode"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "lOComment"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "lOBlank"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "locCodeAndComment"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "uniq_Op"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "uniq_Opnd"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "total_Op"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "total_Opnd"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      },
      {
       "type": "missing",
       "loc": [
        "body",
        "branchCount"
       ],
       "msg": "Field required",
       "input": {
        "loc": 123
       }
      }
     ]
    }
   }
  },
  {
   "name": "extra-field",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": {
     "loc": 78.0,
     "v(g)": 7.0,
     "ev(g)": 1.0,
     "iv(g)": 6.0,
     "n": 213.0,
     "v": 1189.6,
     "l": 0.06,
     "d": 17.71,
     "i": 67.19,
     "e": 21062.86,
     "b": 0.4,
     "t": 1170.16,
     "lOCode": 66.0,
     "lOComment": 4.0,
     "lOBlank": 6.0,
     "locCodeAndComment": 0.0,
     "uniq_Op": 14.0,
     "uniq_Opnd": 34.0,
     "total_Op": 127.0,
     "total_Opnd": 86.0,
     "branchCount": 13.0,
     "module_name": "billing.c"
    },
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 422,
    "content_type": "application/json",
    "body": {
     "detail": [
      {
       "type": "extra_forbidden",
       "loc": [
        "body",
        "module_name"
       ],
       "msg": "Extra inputs are not permitted",
       "input": "billing.c"
      }
     ]
    }
   }
  },
  {
   "name": "not-a-number",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": {
     "loc": "many",
     "v(g)": 7.0,
     "ev(g)": 1.0,
     "iv(g)": 6.0,
     "n": 213.0,
     "v": 1189.6,
     "l": 0.06,
     "d": 17.71,
     "i": 67.19,
     "e": 21062.86,
     "b": 0.4,
     "t": 1170.16,
     "lOCode": 66.0,
     "lOComment": 4.0,
     "lOBlank": 6.0,
     "locCodeAndComment": 0.0,
     "uniq_Op": 14.0,
     "uniq_Opnd": 34.0,
     "total_Op": 127.0,
     "total_Opnd": 86.0,
     "branchCount": 13.0
    },
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 422,
    "content_type": "application/json",
    "body": {
     "detail": [
      {
       "type": "float_parsing",
       "loc": [
        "body",
        "loc"
       ],
       "msg": "Input should be a valid number, unable to parse string as a number",
       "input": "many"
      }
     ]
    }
   }
  },
  {
   "name": "not-finite",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": "{\"loc\": 1e999, \"v(g)\": 7.0, \"ev(g)\": 1.0, \"iv(g)\": 6.0, \"n\": 213.0, \"v\": 1189.6, \"l\": 0.06, \"d\": 17.71, \"i\": 67.19, \"e\": 21062.86, \"b\": 0.4, \"t\": 1170.16, \"lOCode\": 66.0, \"lOComment\": 4.0, \"lOBlank\": 6.0, \"locCodeAndComment\": 0.0, \"uniq_Op\": 14.0, \"uniq_Opnd\": 34.0, \"total_Op\": 127.0, \"total_Opnd\": 86.0, \"branchCount\": 13.0}",
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 500,
    "content_type": "text/plain; charset=utf-8",
    "body": "Internal Server Error"
   }
  },
  {
   "name": "python-names",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": {
     "loc": 78.0,
     "n": 213.0,
     "v": 1189.6,
     "l": 0.06,
     "d": 17.71,
     "i": 67.19,
     "e": 21062.86,
     "b": 0.4,
     "t": 1170.16,
     "lOCode": 66.0,
     "lOComment": 4.0,
     "lOBlank": 6.0,
     "locCodeAndComment": 0.0,
     "uniq_Op": 14.0,
     "uniq_Opnd": 34.0,
     "total_Op": 127.0,
     "total_Opnd": 86.0,
     "branchCount": 13.0,
     "v_g": 7.0,
     "ev_g": 1.0,
     "iv_g": 6.0
    },
    "headers": {
     "content-type": "application/json"
    }
   },
   "response": {
    "status": 200,
    "content_type": "application/json",
    "body": {
     "prediction": 1,
     "label": "Defective",
     "defect_probability": 0.7230676312840666,
     "threshold": 0.5,
     "model": "Logistic balanced"
    }
   }
  },
  {
   "name": "wrong-method",
   "request": {
    "method": "GET",
    "path": "/predict",
    "body": null,
    "headers": {}
   },
   "response": {
    "status": 405,
    "content_type": "application/json",
    "body": {
     "detail": "Method Not Allowed"
    }
   }
  },
  {
   "name": "unknown-path",
   "request": {
    "method": "GET",
    "path": "/predictions",
    "body": null,
    "headers": {}
   },
   "response": {
    "status": 404,
    "content_type": "application/json",
    "body": {
     "detail": "Not Found"
    }
   }
  },
  {
   "name": "not-json",
   "request": {
    "method": "POST",
    "path": "/predict",
    "body": "loc=123",
    "headers": {
     "content-type": "application/x-www-form-urlencoded"
    }
   },
   "response": {
    "status": 422,
    "content_type": "application/json",
    "body": {
     "detail": [
      {
       "type": "model_attributes_type",
       "loc": [
        "body"
       ],
       "msg": "Input should be a valid dictionary or object to extract fields from",
       "input": "loc=123"
      }
     ]
    }
   }
  }
 ]
}