File size: 5,148 Bytes
50d6286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# ⚠️ ETHICS.md β€” PneumoOps Responsible AI Policy

> **This document is a mandatory part of the PneumoOps project and must be read before using or contributing to this system.**

---

## 🚨 1. NOT A Medical Device

> ❌ This tool does **NOT** detect disease with medical certainty.
> βœ… This tool **assists in prediction** as an educational MLOps demonstration.

PneumoOps is built for **academic and research purposes only**. It is a demonstration of MLOps concepts β€” A/B testing, drift monitoring, and continuous deployment β€” using chest X-ray classification as an applied example.

**This system is NOT:**
- A licensed medical device
- A substitute for professional clinical diagnosis
- Validated for use in patient care

**Every prediction must be treated as:**
- Potentially incorrect
- Requiring review by a qualified medical professional
- An educational output, not a clinical recommendation

---

## πŸ” 2. Data Privacy & Consent

### What This System Does With Your Images
- Images uploaded to this tool are processed **in-memory** for inference only
- **No images are permanently stored** on the server by default
- **No user-identifiable information** (name, date of birth, patient ID, scan metadata) is collected, logged, or retained
- Prometheus metrics log **aggregate statistics only** (prediction class counts, latency) β€” never individual images or identities

### What You Must NOT Upload
- X-rays containing embedded patient metadata (DICOM tags)
- Images with visible patient names, dates, or hospital identifiers
- Any image you do not have the right to use

### If Data Collection Is Enabled (Optional Fine-Tuning Mode)
If the `PNEUMOOPS_COLLECT_DATA=true` environment variable is set:
- A text-based **consent notice** is shown to the user before submission
- Only the **anonymized image** (stripped of metadata) and its **prediction JSON** are saved
- Data is stored locally and never transmitted to third parties
- Users can opt out by not submitting their image

---

## βš–οΈ 3. Bias & Accuracy Limitations

This model was trained on **ChestMNIST**, a research dataset with known limitations:

| Limitation | Risk |
|---|---|
| Small image size (224Γ—224, grayscale) | May miss subtle findings visible on full-resolution clinical scans |
| Dataset demographic bias | Performance may vary across different patient populations, scanner hardware, and imaging protocols |
| Class imbalance | Rare conditions (Hernia, Pneumonia) have very low F1 scores (0.0) due to insufficient training examples |
| No temporal data | The model sees single frames only β€” cannot account for disease progression |
| No radiologist validation | Predictions have NOT been validated by clinical experts |

**Macro AUROC of 0.808** is a research-grade metric. It does **not** translate to clinical accuracy, sensitivity, or specificity at a diagnostic threshold.

---

## 🧠 4. Responsible AI Language Policy

All communication from this system must follow these rules:

### βœ… Use This Language
- "The model predicts a possible finding of..."
- "This assists in identifying potential..."
- "Confidence score indicates a statistical likelihood of..."
- "Results should be reviewed by a qualified clinician."

### ❌ Never Use This Language
- "This patient has pneumonia."
- "The model detects disease with X% accuracy."
- "This result confirms a diagnosis of..."
- "No disease found." (absence of prediction β‰  absence of disease)

---

## πŸ”„ 5. Model Drift & Retraining Obligations

The drift monitoring system exists for a reason. When `DRIFT_DETECTED` is flagged:
- The incoming image is **statistically different** from training data
- Predictions on out-of-distribution data are **unreliable**
- A human reviewer should flag this image
- Retraining should be considered if drift is systematic

Ignoring persistent drift alerts in a production clinical system would be an **ethical failure**.

---

## πŸ‘₯ 6. Attribution & Accountability

| Role | Responsibility |
|---|---|
| Developers | Ensure model limitations are clearly communicated |
| Operators | Never deploy without visible disclaimers |
| Users | Never use predictions to make unsupervised clinical decisions |
| Evaluators | Judge on MLOps pipeline quality, not clinical validity |

---

## πŸ“‹ 7. Compliance Acknowledgment

By using, deploying, or contributing to PneumoOps, you acknowledge that:

- [ ] You have read this document in full
- [ ] You understand this is an educational tool, not a medical device
- [ ] You will not use predictions as a substitute for clinical judgment
- [ ] You will not upload images containing patient PII
- [ ] You accept responsibility for any use of this system

---

*This ethics policy was authored as part of the PneumoOps academic MLOps project. It follows principles from the [EU AI Act](https://www.europarl.europa.eu/topics/en/article/20230601STO93804/eu-ai-act-first-regulation-on-artificial-intelligence), [WHO Ethics Guidelines for AI in Health](https://www.who.int/publications/i/item/9789240029200), and [Google's Responsible AI Practices](https://ai.google/responsibility/responsible-ai-practices/).*