---
title: FastAPI 測試服務
updated: 2025-10-16 06:59:51Z
created: 2025-06-26 07:52:02Z
latitude: 25.03296940
longitude: 121.56541770
altitude: 0.0000
---

```
{
    "version": "0.2.0",
    "configurations": [
        /* ---- ① FastAPI 伺服器 ---- */
        {
            "name": "FastAPI in DevContainer",
            "type": "python",
            "request": "launch",
            "module": "uvicorn",
            "args": [
                "hygieia.main:app",
                "--host", "0.0.0.0",
                "--port", "9000",
                "--reload"
            ],
            "cwd": "${workspaceFolder}/src/hygieia",
            "env": {
                "PYTHONPATH": "${workspaceFolder}/src"
            },
            "jinja": true,
            "justMyCode": true,
            "subProcess": true,
            "redirectOutput": true,
            "console": "integratedTerminal"
        },

        /* ---- ② Pytest 除錯 ---- */
        {
            "name": "Debug Pytest",
            "type": "python",
            "request": "launch",
            "module": "pytest",              // 直接啟動 pytest
            "args": [
                "-s",                        // 把 print 直接輸出到終端機
                "tests/test_devices.py",                      // 若 tests 在 /app/tests，路徑可改成 "${workspaceFolder}/tests"
                "-k", "test_create_device_isolated", // 只跑名稱包含 "test_create_device_isolated" 的測試
            ],
            "cwd": "${workspaceFolder}",     // 讓 pytest 抓得到專案 root
            "env": {
                "PYTHONPATH": "${workspaceFolder}/src"
            },
            "justMyCode": true,
            "console": "integratedTerminal",
            "purpose": [ "debug-test" ]      // 讓 VS Code Test Explorer 也看得到
        }
    ],

    /* ---- ③ Compound：一次開兩個 ---- */
    "compounds": [
        {
            "name": "FastAPI + Tests",
            "configurations": [
                "FastAPI in DevContainer",
                "Debug Pytest"
            ],
            "stopAll": true   // 任一側停掉就全部關，避免孤兒行程
        }
    ]
}

```


第二版

```
{
    "version": "0.2.0",
    "configurations": [
        /* ---- ① FastAPI 伺服器 ---- */
        {
            "name": "FastAPI in DevContainer",
            "type": "debugpy",
            "request": "launch",
            "module": "uvicorn",
            "args": [
                "hygieia.main:app",
                "--host",
                "0.0.0.0",
                "--port",
                "8001",
                "--reload"
            ],
            "cwd": "${workspaceFolder}",
            "env": {
                "PYTHONPATH": "${workspaceFolder}/src"
            },
            "jinja": true,
            "justMyCode": true,
            "subProcess": true,
            "redirectOutput": true,
            "console": "integratedTerminal"
        },

        /* ---- ② Pytest 除錯 ---- */
        {
            "name": "Debug Pytest",
            "type": "debugpy",
            "request": "launch",
            "python": "/usr/local/bin/python",
            "module": "pytest",
            "args": [
                "-s",                        // 把 print 直接輸出到終端機
                "tests/test_devices.py",                      // 若 tests 在 /app/tests，路徑可改成 "${workspaceFolder}/tests"
                "-k", "test_create_device_isolated" // 只跑名稱包含 "test_create_device_isolated" 的測試
            ],
            "cwd": "${workspaceFolder}",     // 讓 pytest 抓得到專案 root
            "env": {
                "PYTHONPATH": "${workspaceFolder}/src"
            },
            "justMyCode": true,
            "console": "integratedTerminal",
            "purpose": [ "debug-test" ]      // 讓 VS Code Test Explorer 也看得到
        },

        /* ---- ③ 運行所有測試 ---- */
        {
            "name": "Debug All Tests", 
            "type": "debugpy",
            "request": "launch",
            "python": "/usr/local/bin/python",
            "module": "pytest",
            "args": [
                "-v",
                "tests/"
            ],
            "cwd": "${workspaceFolder}",
            "env": {
                "PYTHONPATH": "${workspaceFolder}/src"
            },
            "justMyCode": true,
            "console": "integratedTerminal",
            "purpose": [ "debug-test" ]
        }
    ],

    /* ---- ③ Compound：一次開兩個 ---- */
    "compounds": [
        {
            "name": "FastAPI + Tests",
            "configurations": [
                "FastAPI in DevContainer",
                "Debug Pytest"
            ],
            "stopAll": true   // 任一側停掉就全部關，避免孤兒行程
        }
    ]
}

```
#!/usr/bin/env bash
# batch-change-email.sh

# --------- 請填入要取代的資訊 ---------
OLD_NAME="舊作者名稱"
OLD_EMAIL="old@example.com"
NEW_NAME="新作者名稱"      # 如果只改 email，可跟 OLD_NAME 相同
NEW_EMAIL="new@example.com"

# ----------------------------------------

# 確保在專案根目錄
cd /path/to/your/repo || exit 1

# 執行 filter-branch
git filter-branch --env-filter '
  if [ "$GIT_AUTHOR_NAME" = "'"$OLD_NAME"'" ] && [ "$GIT_AUTHOR_EMAIL" = "'"$OLD_EMAIL"'" ]; then
    export GIT_AUTHOR_NAME="'"$NEW_NAME"'"
    export GIT_AUTHOR_EMAIL="'"$NEW_EMAIL"'"
  fi
  if [ "$GIT_COMMITTER_NAME" = "'"$OLD_NAME"'" ] && [ "$GIT_COMMITTER_EMAIL" = "'"$OLD_EMAIL"'" ]; then
    export GIT_COMMITTER_NAME="'"$NEW_NAME"'"
    export GIT_COMMITTER_EMAIL="'"$NEW_EMAIL"'"
  fi
' --tag-name-filter cat -- --branches --tags

echo "✅ 完成歷史重寫，請確認後再強制推送："
echo "   git push --force --tags origin 'refs/heads/*'"

```

&nbsp;

```
{
  "resourceType": "Schedule",
  "identifier": [
    {
      "system": "http://example.org/schedule-ids",
      "value": "schedule-ct-001-2024"
    }
  ],
  "active": true,
  "serviceCategory": [
    {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/service-category",
          "code": "imaging",
          "display": "影像醫學"
        }
      ]
    }
  ],
  "serviceType": [
    {
      "concept": {
        "coding": [
          {
            "system": "http://snomed.info/sct",
            "code": "78783000",
            "display": "Computed tomography (CT) scan"
          }
        ]
      }
    }
  ],
  "specialty": [
    {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/specialty",
          "code": "radiology",
          "display": "放射科"
        }
      ]
    }
  ],
  "name": "CT 掃描儀時程 - 2024年下半年",
  "actor": [
    {
      "reference": "Device/ct-scanner-001",
      "display": "Revolution CT - 影像醫學科"
    },
    {
      "reference": "Location/imaging-department",
      "display": "影像醫學科"
    }
  ],
  "planningHorizon": {
    "start": "2024-07-01T08:00:00+08:00",
    "end": "2024-12-31T17:00:00+08:00"
  },
  "comment": "此為影像醫學科CT掃描儀的排程，涵蓋2024年7月至12月。"
}
```

&nbsp;

AIzaSyBC8vSGQi8Cd-NV6j9GAGthTlPtMnZdA6s

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

syncthing

IBRA57W-MWNE6DH-RBAAKVE-GGB5H6X-OJY3VIK-JMQ7TUJ-2CCZ2DY-4Q5S2AK

&nbsp;

Brave 同步

burst destroy report execute bundle you lottery employ myth field bracket pupil grunt impulse mother enrich abandon clever duty frequent disease office fix man moral

https://parsec.gg/g/2zBUeRZ7FB8oEAUfJlWrBvExxRP/92ce0c6d/

discord bot token
MTM0MTA0MTg4Mzk0OTgzMDE5NA.Gg618p.-n9QAj6aA7Rhvcw0vOUlRqlyg5d75Kzm27PFC0

n8n api key
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4MTY2NDk1Yi0xMDkxLTQ1ZTItOTUyYy1mNTdjZTJiNTFmNGQiLCJpc3MiOiJuOG4iLCJhdWQiOiJwdWJsaWMtYXBpIiwiaWF0IjoxNzYwNTk3OTc4LCJleHAiOjE3NjMxMzYwMDB9.7G02-tvWkLDULlA8EX2GsI0kSHrCCp1yG3le9rcU4X0