Lincoln Gombedza Claude Sonnet 4.6 commited on
Commit
3ebaeb6
·
0 Parent(s):

release: Nursing Knowledge Base v1.0 — LM wiki for nursing education

Browse files

Adapts Karpathy's LLM wiki pattern for the Nursing Citizen Development Organisation.
Students and educators add raw sources; Claude builds and maintains a structured wiki.

- 14 pre-seeded articles: NMC Code, Proficiency Standards, ABCDE, NEWS2, ADPIE,
Nine Rights, Drug Calculations, PICO, EBP, Person-Centred Care, MCA 2005,
Safeguarding, IPC, Duty of Candour
- Browse/search wiki by category and keyword
- Add Sources tab for pasting NICE guidelines, NMC docs, research papers
- Compile tab: Claude integrates sources into wiki (update + create articles)
- Ask tab: natural language Q&A answered from wiki with citations
- Health Check tab: Claude audits for contradictions, gaps, suggests new articles
- Import/Export: JSON backup + ZIP export (Obsidian-compatible markdown)
- BYOK Anthropic API key (session only, never stored)
- Clinical disclaimer throughout (NMC/NICE/local policy)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (10) hide show
  1. .gitignore +10 -0
  2. Dockerfile +16 -0
  3. README.md +79 -0
  4. core/__init__.py +0 -0
  5. core/compiler.py +132 -0
  6. core/linter.py +136 -0
  7. core/qa.py +149 -0
  8. requirements.txt +2 -0
  9. streamlit_app.py +745 -0
  10. wiki/starter.py +1177 -0
.gitignore ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ .env
2
+ *.pyc
3
+ __pycache__/
4
+ .DS_Store
5
+ ._*
6
+ *.zip
7
+ *.json
8
+ !requirements.txt
9
+ .streamlit/secrets.toml
10
+ .venv/
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
7
+
8
+ COPY . .
9
+
10
+ EXPOSE 7860
11
+
12
+ CMD ["streamlit", "run", "streamlit_app.py", \
13
+ "--server.port=7860", \
14
+ "--server.address=0.0.0.0", \
15
+ "--server.headless=true", \
16
+ "--browser.gatherUsageStats=false"]
README.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Nursing Knowledge Base
3
+ emoji: 📖
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ app_file: streamlit_app.py
8
+ pinned: false
9
+ license: mit
10
+ ---
11
+
12
+ # Nursing Knowledge Base
13
+
14
+ A living, LLM-maintained knowledge wiki for nursing education — built for the **Nursing Citizen Development Organisation**.
15
+
16
+ Inspired by [Karpathy's LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f): you add raw sources, Claude builds and maintains the structured knowledge base.
17
+
18
+ ## Features
19
+
20
+ | Tab | What it does |
21
+ |-----|-------------|
22
+ | 📚 **Browse Wiki** | Read 14+ pre-loaded nursing articles across 6 categories |
23
+ | ➕ **Add Sources** | Paste NICE guidelines, NMC documents, research papers |
24
+ | 🔨 **Compile** | Claude integrates sources into the wiki — updating, cross-referencing, and creating articles |
25
+ | 💬 **Ask** | Natural language Q&A answered from the wiki with citations |
26
+ | 🔍 **Health Check** | Claude audits the wiki for contradictions, gaps, and suggests new articles |
27
+ | 📋 **Log** | Append-only record of every operation |
28
+
29
+ ## Pre-loaded Wiki Content
30
+
31
+ - **Standards**: NMC Code (2018), NMC Standards of Proficiency (2018)
32
+ - **Clinical**: ABCDE Assessment, NEWS2, ADPIE Nursing Process
33
+ - **Pharmacology**: Nine Rights of Medication Administration, Drug Calculations
34
+ - **Evidence**: PICO Framework, Evidence-Based Practice (5 Steps)
35
+ - **Frameworks**: Person-Centred Care, McCormack & McCance
36
+ - **Safety**: Infection Prevention & Control, Duty of Candour
37
+ - **Law**: Mental Capacity Act 2005, Safeguarding Adults & Children
38
+
39
+ ## How to Use
40
+
41
+ 1. Browse the starter wiki — no API key required
42
+ 2. Enter your [Anthropic API key](https://console.anthropic.com) in the sidebar (BYOK — never stored)
43
+ 3. Add sources (NICE guidelines, NMC docs, research papers)
44
+ 4. Click **Compile** — Claude integrates them into the wiki
45
+ 5. Use **Ask** to query the wiki in natural language
46
+ 6. **Export** your wiki as a ZIP or JSON to save progress between sessions
47
+
48
+ ## The LLM Wiki Pattern
49
+
50
+ > "Raw data from a given number of sources is collected, then compiled by an LLM into a .md wiki, then operated on by various CLIs by the LLM to do Q&A and to incrementally enhance the wiki."
51
+ > — Andrej Karpathy
52
+
53
+ This tool adapts that pattern specifically for nursing education:
54
+ - Sources are clinical guidelines, NMC standards, and research papers
55
+ - The wiki is structured around NMC Proficiency platforms
56
+ - Q&A is grounded in UK nursing frameworks (NICE, NMC, NHS, BNF)
57
+ - Health checks flag clinical safety gaps and outdated content
58
+
59
+ ## Clinical Disclaimer
60
+
61
+ > This tool supports but does not replace clinical judgment. Always verify with authoritative sources (BNF, NICE, local trust guidelines, NMC). This wiki is for educational purposes only.
62
+
63
+ ## Stack
64
+
65
+ - [Streamlit](https://streamlit.io) — UI
66
+ - [Anthropic Claude](https://anthropic.com) — Wiki compilation, Q&A, health checks (BYOK)
67
+ - No external data APIs — all AI features use your own Anthropic key
68
+ - Export wiki as ZIP (Obsidian-compatible markdown) or JSON
69
+
70
+ ## Part of CQAI
71
+
72
+ Built by [Clinical Quality Artificial Intelligence](https://github.com/Clinical-Quality-Artifical-Intelligence) — open-source nursing education tools aligned with NMC Standards.
73
+
74
+ Other tools in the suite:
75
+ - [EBP Research Tool](https://huggingface.co/spaces/NurseCitizenDeveloper/nursing-ebp-tool)
76
+ - [Drug Card Generator](https://huggingface.co/spaces/NurseCitizenDeveloper/nursing-drug-cards)
77
+ - [NCLEX Prep](https://huggingface.co/spaces/NurseCitizenDeveloper/nclex-prep)
78
+ - [Medication Safety Checker](https://huggingface.co/spaces/NurseCitizenDeveloper/medication-safety)
79
+ - [Wound Assessment Tool](https://huggingface.co/spaces/NurseCitizenDeveloper/nursing-wound-assessment)
core/__init__.py ADDED
File without changes
core/compiler.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Wiki compiler — uses Claude to integrate raw sources into structured wiki articles."""
2
+
3
+ import json
4
+ import datetime
5
+ import anthropic
6
+
7
+ COMPILE_SYSTEM_PROMPT = """You are a clinical knowledge wiki curator for the Nursing Citizen Development Organisation.
8
+ Your job is to integrate new source material into an existing nursing knowledge base (wiki).
9
+
10
+ The wiki is a collection of markdown articles organised by category. Each article has:
11
+ - A title, category, tags, and backlinks to other articles
12
+ - Substantive clinical content aligned with NMC Standards of Proficiency (2018), UK law, and NHS frameworks
13
+
14
+ When given new source material, you must:
15
+ 1. Identify key nursing concepts, frameworks, guidelines, or clinical information in the source
16
+ 2. Decide which existing articles should be UPDATED with new information
17
+ 3. Identify any new articles that should be CREATED for concepts not yet covered
18
+ 4. Integrate the information accurately and clinically appropriately
19
+ 5. Add/update backlinks between related articles
20
+ 6. Always cite the source in any updated/created articles
21
+
22
+ Return a JSON object with this structure:
23
+ {
24
+ "summary": "Brief summary of what was integrated and why",
25
+ "articles_updated": [
26
+ {
27
+ "slug": "article_slug",
28
+ "title": "Article Title",
29
+ "category": "category_name",
30
+ "tags": ["tag1", "tag2"],
31
+ "content": "Full markdown content of the updated article"
32
+ }
33
+ ],
34
+ "articles_created": [
35
+ {
36
+ "slug": "new_slug",
37
+ "title": "New Article Title",
38
+ "category": "category_name",
39
+ "tags": ["tag1", "tag2"],
40
+ "content": "Full markdown content of the new article"
41
+ }
42
+ ],
43
+ "index_updates": "Updated one-line entries for the index (markdown format)",
44
+ "log_entry": "Log entry text for this compilation"
45
+ }
46
+
47
+ Categories to use: standards, clinical, pharmacology, evidence, frameworks, safety, law, mental_health, research, ethics
48
+
49
+ Clinical content must:
50
+ - Be accurate and evidence-based
51
+ - Include NMC proficiency mappings where relevant
52
+ - Include UK-specific references (NICE, NMC, NHS, BNF)
53
+ - Include the disclaimer: "This tool supports but does not replace clinical judgment."
54
+ - Use UK spellings (organisation, anaesthesia, etc.)
55
+ """
56
+
57
+
58
+ def compile_source(client: anthropic.Anthropic, source_title: str, source_content: str,
59
+ existing_index: str, existing_articles: dict, model: str = "claude-sonnet-4-6") -> dict:
60
+ """
61
+ Integrate a new source into the wiki.
62
+
63
+ Returns a dict with updated/created articles and metadata.
64
+ """
65
+ # Build context: index + up to 5 most relevant article summaries
66
+ articles_context = ""
67
+ if existing_articles:
68
+ # Include first 500 chars of each article as context
69
+ for slug, art in list(existing_articles.items())[:8]:
70
+ preview = art["content"][:400].replace("\n", " ")
71
+ articles_context += f"\n- **{art['title']}** ({art['category']}): {preview}...\n"
72
+
73
+ user_prompt = f"""## Existing Wiki Index
74
+ {existing_index}
75
+
76
+ ## Sample of Existing Articles (previews)
77
+ {articles_context}
78
+
79
+ ## New Source to Integrate
80
+ **Title**: {source_title}
81
+
82
+ **Content**:
83
+ {source_content[:8000]}
84
+
85
+ Please integrate this source into the wiki. Return valid JSON only, no markdown code fences."""
86
+
87
+ response = client.messages.create(
88
+ model=model,
89
+ max_tokens=4096,
90
+ system=COMPILE_SYSTEM_PROMPT,
91
+ messages=[{"role": "user", "content": user_prompt}],
92
+ )
93
+
94
+ raw = response.content[0].text.strip()
95
+ # Strip markdown fences if present
96
+ if raw.startswith("```"):
97
+ raw = raw.split("\n", 1)[1]
98
+ if raw.endswith("```"):
99
+ raw = raw.rsplit("```", 1)[0]
100
+
101
+ result = json.loads(raw)
102
+
103
+ # Add metadata
104
+ today = datetime.date.today().isoformat()
105
+ for art in result.get("articles_updated", []) + result.get("articles_created", []):
106
+ art["last_updated"] = today
107
+ art["sources"] = art.get("sources", []) + [source_title]
108
+
109
+ return result
110
+
111
+
112
+ def rebuild_index(client: anthropic.Anthropic, articles: dict, model: str = "claude-sonnet-4-6") -> str:
113
+ """Regenerate the wiki index from all articles."""
114
+ article_list = []
115
+ for slug, art in articles.items():
116
+ article_list.append(f"- **{art['title']}** ({art['category']}): {', '.join(art.get('tags', []))}")
117
+
118
+ prompt = f"""Regenerate a well-organised wiki index for these nursing knowledge articles.
119
+ Group them by category. Each entry should be a one-line summary.
120
+ Format as markdown with category headers (##).
121
+
122
+ Articles:
123
+ {chr(10).join(article_list)}
124
+
125
+ Return only the markdown index content."""
126
+
127
+ response = client.messages.create(
128
+ model=model,
129
+ max_tokens=2048,
130
+ messages=[{"role": "user", "content": prompt}],
131
+ )
132
+ return response.content[0].text.strip()
core/linter.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Wiki linter — health-checks the knowledge base for issues."""
2
+
3
+ import anthropic
4
+ import json
5
+
6
+ LINT_SYSTEM_PROMPT = """You are auditing a nursing knowledge wiki for the Nursing Citizen Development Organisation.
7
+ Perform a thorough health check and identify:
8
+
9
+ 1. **Contradictions**: Where articles disagree with each other or with current evidence
10
+ 2. **Stale content**: Claims that may be outdated (check against NMC 2018, NICE, NHS guidelines)
11
+ 3. **Orphan articles**: Articles with few or no backlinks (disconnected from the rest of the wiki)
12
+ 4. **Missing cross-references**: Where articles should link to each other but don't
13
+ 5. **Clinical safety gaps**: Important safety information that is absent or incomplete
14
+ 6. **Missing articles**: Important nursing topics not yet covered (suggest 3-5 new articles)
15
+ 7. **Evidence gaps**: Claims without adequate citation
16
+
17
+ Return a structured JSON report:
18
+ {
19
+ "overall_health": "Good/Fair/Needs attention",
20
+ "total_issues": number,
21
+ "issues": [
22
+ {
23
+ "type": "contradiction|stale|orphan|missing_link|safety_gap|evidence_gap",
24
+ "severity": "high|medium|low",
25
+ "article": "article_slug or 'wiki-wide'",
26
+ "description": "Clear description of the issue",
27
+ "recommendation": "Specific action to fix it"
28
+ }
29
+ ],
30
+ "suggested_new_articles": [
31
+ {
32
+ "title": "Suggested Article Title",
33
+ "category": "category",
34
+ "rationale": "Why this article is needed",
35
+ "key_topics": ["topic1", "topic2"]
36
+ }
37
+ ],
38
+ "strengths": ["What the wiki does well"],
39
+ "summary": "Brief overall assessment"
40
+ }
41
+ """
42
+
43
+
44
+ def lint_wiki(client: anthropic.Anthropic, articles: dict, index_summary: str,
45
+ model: str = "claude-sonnet-4-6") -> dict:
46
+ """
47
+ Run a health check on the wiki.
48
+
49
+ Returns a structured report with issues and recommendations.
50
+ """
51
+ # Build article summaries for the linter
52
+ article_summaries = []
53
+ for slug, art in articles.items():
54
+ # Extract backlinks from content
55
+ import re
56
+ backlinks = re.findall(r'\[\[([^\]]+)\]\]', art["content"])
57
+ article_summaries.append({
58
+ "slug": slug,
59
+ "title": art["title"],
60
+ "category": art["category"],
61
+ "tags": art.get("tags", []),
62
+ "last_updated": art.get("last_updated", "unknown"),
63
+ "word_count": len(art["content"].split()),
64
+ "backlinks": backlinks,
65
+ "sources": art.get("sources", []),
66
+ "content_preview": art["content"][:600],
67
+ })
68
+
69
+ prompt = f"""## Wiki Index
70
+ {index_summary}
71
+
72
+ ## Article Summaries
73
+ {json.dumps(article_summaries, indent=2)[:12000]}
74
+
75
+ Please perform a thorough health check of this nursing knowledge wiki.
76
+ Return valid JSON only, no markdown fences."""
77
+
78
+ response = client.messages.create(
79
+ model=model,
80
+ max_tokens=3000,
81
+ system=LINT_SYSTEM_PROMPT,
82
+ messages=[{"role": "user", "content": prompt}],
83
+ )
84
+
85
+ raw = response.content[0].text.strip()
86
+ if raw.startswith("```"):
87
+ raw = raw.split("\n", 1)[1]
88
+ if raw.endswith("```"):
89
+ raw = raw.rsplit("```", 1)[0]
90
+
91
+ return json.loads(raw)
92
+
93
+
94
+ def generate_missing_article(client: anthropic.Anthropic, title: str, category: str,
95
+ key_topics: list, existing_index: str,
96
+ model: str = "claude-sonnet-4-6") -> dict:
97
+ """Generate a new article for a topic identified as missing by the linter."""
98
+ import datetime
99
+
100
+ prompt = f"""Write a comprehensive nursing knowledge wiki article on: **{title}**
101
+
102
+ Category: {category}
103
+ Key topics to cover: {', '.join(key_topics)}
104
+
105
+ Existing wiki context (do not duplicate, but do cross-reference):
106
+ {existing_index}
107
+
108
+ The article should:
109
+ - Be clinically accurate and evidence-based (NMC 2018, NICE, NHS, BNF standards)
110
+ - Use UK spellings and references
111
+ - Include backlinks to related articles using [[Article Title]] format
112
+ - Have clear sections with ## headers
113
+ - Include a References section
114
+ - Be suitable for student nurses
115
+
116
+ Return the full markdown article content only (no JSON, just the markdown)."""
117
+
118
+ response = client.messages.create(
119
+ model=model,
120
+ max_tokens=3000,
121
+ messages=[{"role": "user", "content": prompt}],
122
+ )
123
+
124
+ content = response.content[0].text.strip()
125
+ slug = title.lower().replace(" ", "_").replace("-", "_")
126
+ slug = "".join(c for c in slug if c.isalnum() or c == "_")
127
+
128
+ return {
129
+ "slug": slug,
130
+ "title": title,
131
+ "category": category,
132
+ "tags": key_topics[:5],
133
+ "content": content,
134
+ "last_updated": datetime.date.today().isoformat(),
135
+ "sources": ["AI-generated from lint suggestion"],
136
+ }
core/qa.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Q&A module — answers nursing questions from the wiki using Claude."""
2
+
3
+ import anthropic
4
+
5
+ QA_SYSTEM_PROMPT = """You are a nursing knowledge assistant for the Nursing Citizen Development Organisation.
6
+ You answer questions by drawing on a curated nursing knowledge wiki aligned with NMC Standards of Proficiency (2018) and UK clinical practice.
7
+
8
+ When answering:
9
+ 1. Read the provided wiki articles carefully
10
+ 2. Give a clear, accurate, clinically appropriate answer
11
+ 3. Cite specific wiki articles you used (e.g. [[The NMC Code]])
12
+ 4. Suggest related articles the student might want to explore
13
+ 5. Flag any clinical safety considerations prominently
14
+ 6. Use UK clinical terminology and references (NICE, NMC, NHS, BNF)
15
+ 7. Map your answer to NMC Proficiency platforms where relevant
16
+
17
+ Always end with: "This tool supports but does not replace clinical judgment."
18
+
19
+ Format your response in clean markdown with:
20
+ - A direct answer paragraph
21
+ - Key points as a bulleted list (if appropriate)
22
+ - **NMC Proficiency**: which platforms are relevant
23
+ - **Sources used**: list of wiki articles cited
24
+ - **Explore further**: 2-3 related articles to read next
25
+ """
26
+
27
+ ARTICLE_SELECTION_PROMPT = """You are selecting which wiki articles are most relevant to answer a nursing question.
28
+
29
+ Given the question and a list of available articles, return the slugs of the 5-8 most relevant articles.
30
+ Return only a JSON array of slugs, nothing else.
31
+
32
+ Example: ["nmc_code", "abcde_assessment", "news2"]
33
+ """
34
+
35
+
36
+ def select_relevant_articles(client: anthropic.Anthropic, question: str,
37
+ article_index: dict, model: str = "claude-haiku-4-5-20251001") -> list[str]:
38
+ """Use Claude Haiku to quickly identify the most relevant articles for a question."""
39
+ article_list = "\n".join([
40
+ f"- {slug}: {art['title']} ({art['category']}) — {', '.join(art.get('tags', []))}"
41
+ for slug, art in article_index.items()
42
+ ])
43
+
44
+ prompt = f"""Question: {question}
45
+
46
+ Available wiki articles:
47
+ {article_list}
48
+
49
+ Return a JSON array of the 5-8 most relevant article slugs."""
50
+
51
+ response = client.messages.create(
52
+ model=model,
53
+ max_tokens=256,
54
+ system=ARTICLE_SELECTION_PROMPT,
55
+ messages=[{"role": "user", "content": prompt}],
56
+ )
57
+
58
+ raw = response.content[0].text.strip()
59
+ if raw.startswith("["):
60
+ import json
61
+ try:
62
+ return json.loads(raw)
63
+ except Exception:
64
+ pass
65
+ # Fallback: return all article slugs (up to 8)
66
+ return list(article_index.keys())[:8]
67
+
68
+
69
+ def answer_question(client: anthropic.Anthropic, question: str, articles: dict,
70
+ model: str = "claude-sonnet-4-6") -> str:
71
+ """
72
+ Answer a nursing question using the wiki.
73
+
74
+ Returns a markdown-formatted answer with citations.
75
+ """
76
+ # Select relevant articles
77
+ relevant_slugs = select_relevant_articles(client, question, articles, model="claude-haiku-4-5-20251001")
78
+
79
+ # Build context from selected articles
80
+ context_parts = []
81
+ for slug in relevant_slugs:
82
+ if slug in articles:
83
+ art = articles[slug]
84
+ context_parts.append(f"## {art['title']}\n{art['content']}\n")
85
+
86
+ wiki_context = "\n---\n".join(context_parts)
87
+
88
+ user_prompt = f"""## Nursing Question
89
+ {question}
90
+
91
+ ## Relevant Wiki Articles
92
+ {wiki_context[:10000]}
93
+
94
+ Please answer the question using the wiki content above."""
95
+
96
+ response = client.messages.create(
97
+ model=model,
98
+ max_tokens=2048,
99
+ system=QA_SYSTEM_PROMPT,
100
+ messages=[{"role": "user", "content": user_prompt}],
101
+ )
102
+
103
+ return response.content[0].text.strip()
104
+
105
+
106
+ def file_answer_to_wiki(client: anthropic.Anthropic, question: str, answer: str,
107
+ model: str = "claude-haiku-4-5-20251001") -> dict:
108
+ """
109
+ Convert a Q&A exchange into a wiki article for filing back.
110
+
111
+ Returns article dict or None if not worth filing.
112
+ """
113
+ import datetime
114
+
115
+ prompt = f"""This Q&A exchange from a nursing knowledge base may be worth filing as a new wiki article.
116
+
117
+ Question: {question}
118
+ Answer: {answer}
119
+
120
+ If this answer contains substantial reusable nursing knowledge not easily found in a single article,
121
+ create a new wiki article. If not, return null.
122
+
123
+ Return JSON:
124
+ {{
125
+ "should_file": true/false,
126
+ "slug": "article_slug",
127
+ "title": "Article Title",
128
+ "category": "category_name",
129
+ "tags": ["tag1", "tag2"],
130
+ "content": "Full markdown article content"
131
+ }}"""
132
+
133
+ response = client.messages.create(
134
+ model=model,
135
+ max_tokens=2048,
136
+ messages=[{"role": "user", "content": prompt}],
137
+ )
138
+
139
+ raw = response.content[0].text.strip()
140
+ if raw.startswith("```"):
141
+ raw = raw.split("\n", 1)[1].rsplit("```", 1)[0]
142
+
143
+ import json
144
+ result = json.loads(raw)
145
+ if result.get("should_file"):
146
+ result["last_updated"] = datetime.date.today().isoformat()
147
+ result["sources"] = ["Q&A session"]
148
+ return result
149
+ return None
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit>=1.35.0
2
+ anthropic>=0.28.0
streamlit_app.py ADDED
@@ -0,0 +1,745 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Nursing Knowledge Base — LM Wiki for Nursing Education.
2
+
3
+ Inspired by Karpathy's LLM Wiki pattern, adapted for the Nursing Citizen Development Organisation.
4
+ Students and educators add raw sources; Claude builds and maintains a structured nursing wiki.
5
+ """
6
+
7
+ import streamlit as st
8
+ import anthropic
9
+ import json
10
+ import zipfile
11
+ import io
12
+ import datetime
13
+ import re
14
+ import sys
15
+ import os
16
+
17
+ sys.path.insert(0, os.path.dirname(__file__))
18
+ from wiki.starter import get_starter_wiki
19
+ from core.compiler import compile_source, rebuild_index
20
+ from core.qa import answer_question, file_answer_to_wiki
21
+ from core.linter import lint_wiki, generate_missing_article
22
+
23
+ # ─── Page config ───────────────────────────────────────────────────────────────
24
+ st.set_page_config(
25
+ page_title="Nursing Knowledge Base | CQAI",
26
+ page_icon="📖",
27
+ layout="wide",
28
+ initial_sidebar_state="expanded",
29
+ )
30
+
31
+ # ─── Styles ────────────────────────────────────────────────────────────────────
32
+ st.markdown("""
33
+ <style>
34
+ /* Main palette */
35
+ :root {
36
+ --nhs-blue: #003087;
37
+ --nhs-light-blue: #005EB8;
38
+ --nhs-green: #007F3B;
39
+ --nhs-warm-yellow: #FFB81C;
40
+ --nhs-pale-grey: #F0F4F5;
41
+ }
42
+ .stApp { background: #F8FAFC; }
43
+ .article-card {
44
+ background: white;
45
+ border-radius: 8px;
46
+ padding: 1rem 1.2rem;
47
+ border-left: 4px solid #005EB8;
48
+ margin-bottom: 0.5rem;
49
+ cursor: pointer;
50
+ }
51
+ .article-card:hover { border-left-color: #007F3B; background: #F0F4F5; }
52
+ .category-badge {
53
+ display: inline-block;
54
+ background: #005EB8;
55
+ color: white;
56
+ padding: 2px 8px;
57
+ border-radius: 12px;
58
+ font-size: 0.75rem;
59
+ margin-right: 4px;
60
+ }
61
+ .tag-badge {
62
+ display: inline-block;
63
+ background: #F0F4F5;
64
+ color: #333;
65
+ padding: 2px 6px;
66
+ border-radius: 10px;
67
+ font-size: 0.7rem;
68
+ margin: 1px;
69
+ }
70
+ .disclaimer {
71
+ background: #FFF4CC;
72
+ border: 1px solid #FFB81C;
73
+ border-radius: 6px;
74
+ padding: 8px 12px;
75
+ font-size: 0.85rem;
76
+ color: #5A4B00;
77
+ margin: 8px 0;
78
+ }
79
+ .stat-card {
80
+ background: white;
81
+ border-radius: 8px;
82
+ padding: 12px;
83
+ text-align: center;
84
+ border: 1px solid #E0E8F0;
85
+ }
86
+ .stat-number { font-size: 1.8rem; font-weight: 700; color: #005EB8; }
87
+ .stat-label { font-size: 0.8rem; color: #666; }
88
+ .issue-high { border-left: 3px solid #D93025; padding: 8px; margin: 4px 0; background: #FEF3F2; border-radius: 4px; }
89
+ .issue-medium { border-left: 3px solid #FFB81C; padding: 8px; margin: 4px 0; background: #FFFBF0; border-radius: 4px; }
90
+ .issue-low { border-left: 3px solid #007F3B; padding: 8px; margin: 4px 0; background: #F0FAF4; border-radius: 4px; }
91
+ .wiki-title {
92
+ font-size: 1.6rem;
93
+ font-weight: 700;
94
+ color: #003087;
95
+ margin-bottom: 0.2rem;
96
+ }
97
+ </style>
98
+ """, unsafe_allow_html=True)
99
+
100
+ # ─── Session state ──────────────────────────────────────────────────────────────
101
+ if "wiki" not in st.session_state:
102
+ st.session_state.wiki = get_starter_wiki()
103
+ if "selected_article" not in st.session_state:
104
+ st.session_state.selected_article = None
105
+ if "qa_history" not in st.session_state:
106
+ st.session_state.qa_history = []
107
+ if "lint_report" not in st.session_state:
108
+ st.session_state.lint_report = None
109
+ if "compile_status" not in st.session_state:
110
+ st.session_state.compile_status = ""
111
+
112
+ wiki = st.session_state.wiki
113
+
114
+
115
+ def get_client() -> anthropic.Anthropic | None:
116
+ key = st.session_state.get("api_key", "").strip()
117
+ if not key:
118
+ return None
119
+ return anthropic.Anthropic(api_key=key)
120
+
121
+
122
+ def log(entry: str):
123
+ today = datetime.date.today().isoformat()
124
+ wiki["log"].append(f"## [{today}] {entry}")
125
+
126
+
127
+ def add_or_update_article(article: dict):
128
+ slug = article["slug"]
129
+ wiki["articles"][slug] = {
130
+ "title": article["title"],
131
+ "category": article["category"],
132
+ "tags": article.get("tags", []),
133
+ "last_updated": article.get("last_updated", datetime.date.today().isoformat()),
134
+ "sources": article.get("sources", []),
135
+ "content": article["content"],
136
+ }
137
+ wiki["metadata"]["article_count"] = len(wiki["articles"])
138
+
139
+
140
+ def export_wiki_zip() -> bytes:
141
+ buf = io.BytesIO()
142
+ with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as zf:
143
+ # Index
144
+ zf.writestr("wiki/index.md", wiki.get("index_summary", ""))
145
+ # Log
146
+ zf.writestr("wiki/log.md", "\n\n".join(wiki.get("log", [])))
147
+ # Articles
148
+ for slug, art in wiki["articles"].items():
149
+ category = art.get("category", "general")
150
+ zf.writestr(f"wiki/{category}/{slug}.md", art["content"])
151
+ # Raw sources
152
+ for src_id, src in wiki.get("sources", {}).items():
153
+ zf.writestr(f"raw/{src_id}.md", f"# {src['title']}\n\n{src['content']}")
154
+ # Full JSON backup
155
+ zf.writestr("wiki_backup.json", json.dumps(wiki, indent=2))
156
+ buf.seek(0)
157
+ return buf.getvalue()
158
+
159
+
160
+ def category_color(cat: str) -> str:
161
+ colors = {
162
+ "standards": "#003087", "clinical": "#007F3B", "pharmacology": "#8B0000",
163
+ "evidence": "#6B21A8", "frameworks": "#0369A1", "safety": "#C05621",
164
+ "law": "#1F2937", "mental_health": "#065F46", "research": "#4338CA",
165
+ "ethics": "#92400E",
166
+ }
167
+ return colors.get(cat, "#005EB8")
168
+
169
+
170
+ # ─── Sidebar ────────────────────────────────────────────────────────────────────
171
+ with st.sidebar:
172
+ st.markdown('<div class="wiki-title">📖 Nursing Wiki</div>', unsafe_allow_html=True)
173
+ st.caption("Nursing Citizen Development Organisation")
174
+ st.divider()
175
+
176
+ # API Key
177
+ with st.expander("🔑 Claude API Key (BYOK)", expanded=not st.session_state.get("api_key")):
178
+ api_key = st.text_input(
179
+ "Anthropic API Key",
180
+ type="password",
181
+ value=st.session_state.get("api_key", ""),
182
+ help="Required for Compile, Q&A, and Lint features. Never stored — session only.",
183
+ key="api_key_input",
184
+ )
185
+ if api_key != st.session_state.get("api_key", ""):
186
+ st.session_state.api_key = api_key
187
+ st.rerun()
188
+ if st.session_state.get("api_key"):
189
+ st.success("API key set")
190
+ else:
191
+ st.info("Enter key to enable AI features")
192
+
193
+ st.divider()
194
+
195
+ # Wiki stats
196
+ st.markdown("**Wiki Statistics**")
197
+ articles = wiki["articles"]
198
+ sources = wiki.get("sources", {})
199
+ categories = {}
200
+ for art in articles.values():
201
+ cat = art.get("category", "other")
202
+ categories[cat] = categories.get(cat, 0) + 1
203
+
204
+ col1, col2 = st.columns(2)
205
+ with col1:
206
+ st.markdown(f'<div class="stat-card"><div class="stat-number">{len(articles)}</div><div class="stat-label">Articles</div></div>', unsafe_allow_html=True)
207
+ with col2:
208
+ st.markdown(f'<div class="stat-card"><div class="stat-number">{len(sources)}</div><div class="stat-label">Sources</div></div>', unsafe_allow_html=True)
209
+
210
+ st.markdown("**Categories**")
211
+ for cat, count in sorted(categories.items(), key=lambda x: -x[1]):
212
+ color = category_color(cat)
213
+ st.markdown(f'<span style="color:{color}">●</span> {cat.replace("_", " ").title()}: **{count}**', unsafe_allow_html=True)
214
+
215
+ st.divider()
216
+
217
+ # Import/Export
218
+ st.markdown("**Import / Export**")
219
+ uploaded = st.file_uploader("Import wiki (JSON)", type="json", key="wiki_import")
220
+ if uploaded:
221
+ try:
222
+ imported = json.load(uploaded)
223
+ if "articles" in imported:
224
+ st.session_state.wiki = imported
225
+ st.success(f"Imported {len(imported['articles'])} articles")
226
+ st.rerun()
227
+ except Exception as e:
228
+ st.error(f"Import failed: {e}")
229
+
230
+ zip_bytes = export_wiki_zip()
231
+ st.download_button(
232
+ "📥 Export Wiki (ZIP)",
233
+ data=zip_bytes,
234
+ file_name=f"nursing_wiki_{datetime.date.today()}.zip",
235
+ mime="application/zip",
236
+ use_container_width=True,
237
+ )
238
+
239
+ json_bytes = json.dumps(wiki, indent=2).encode()
240
+ st.download_button(
241
+ "💾 Save Wiki (JSON)",
242
+ data=json_bytes,
243
+ file_name=f"nursing_wiki_{datetime.date.today()}.json",
244
+ mime="application/json",
245
+ use_container_width=True,
246
+ )
247
+
248
+ # ─── Main tabs ──────────────────────────────────────────────────────────────────
249
+ tab_browse, tab_sources, tab_compile, tab_qa, tab_lint, tab_log = st.tabs([
250
+ "📚 Browse Wiki",
251
+ "➕ Add Sources",
252
+ "🔨 Compile",
253
+ "💬 Ask",
254
+ "🔍 Health Check",
255
+ "📋 Log",
256
+ ])
257
+
258
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
259
+ # TAB 1: BROWSE
260
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
261
+ with tab_browse:
262
+ st.markdown('<div class="disclaimer">📖 This wiki supports nursing education and CPD. It does not replace clinical judgment, current NMC guidance, or local trust policies.</div>', unsafe_allow_html=True)
263
+
264
+ col_list, col_reader = st.columns([1, 2])
265
+
266
+ with col_list:
267
+ st.markdown("### Articles")
268
+
269
+ # Search
270
+ search = st.text_input("🔍 Search", placeholder="e.g. ABCDE, medications, safeguarding")
271
+
272
+ # Category filter
273
+ all_cats = sorted(set(a.get("category", "other") for a in wiki["articles"].values()))
274
+ cat_filter = st.selectbox("Category", ["All"] + [c.replace("_", " ").title() for c in all_cats])
275
+
276
+ # Filter articles
277
+ filtered = {}
278
+ for slug, art in wiki["articles"].items():
279
+ cat_match = cat_filter == "All" or art.get("category", "").replace("_", " ").title() == cat_filter
280
+ if search:
281
+ text = (art["title"] + " " + " ".join(art.get("tags", []))).lower()
282
+ search_match = all(term in text for term in search.lower().split())
283
+ else:
284
+ search_match = True
285
+ if cat_match and search_match:
286
+ filtered[slug] = art
287
+
288
+ # Sort by category then title
289
+ sorted_articles = sorted(filtered.items(), key=lambda x: (x[1].get("category", ""), x[1]["title"]))
290
+
291
+ # Group by category
292
+ current_cat = None
293
+ for slug, art in sorted_articles:
294
+ cat = art.get("category", "other")
295
+ if cat != current_cat:
296
+ current_cat = cat
297
+ color = category_color(cat)
298
+ st.markdown(f'<div style="margin-top:12px;margin-bottom:4px;font-weight:600;color:{color};font-size:0.85rem;text-transform:uppercase;letter-spacing:0.05em">{cat.replace("_"," ")}</div>', unsafe_allow_html=True)
299
+
300
+ if st.button(
301
+ art["title"],
302
+ key=f"art_{slug}",
303
+ use_container_width=True,
304
+ type="secondary" if st.session_state.selected_article != slug else "primary",
305
+ ):
306
+ st.session_state.selected_article = slug
307
+ st.rerun()
308
+
309
+ st.caption(f"{len(filtered)} of {len(wiki['articles'])} articles")
310
+
311
+ with col_reader:
312
+ if st.session_state.selected_article and st.session_state.selected_article in wiki["articles"]:
313
+ art = wiki["articles"][st.session_state.selected_article]
314
+ slug = st.session_state.selected_article
315
+
316
+ # Header
317
+ col_title, col_meta = st.columns([3, 1])
318
+ with col_title:
319
+ st.markdown(f"## {art['title']}")
320
+ with col_meta:
321
+ color = category_color(art.get("category", ""))
322
+ st.markdown(f'<span class="category-badge" style="background:{color}">{art.get("category", "").replace("_", " ")}</span>', unsafe_allow_html=True)
323
+ st.caption(f"Updated: {art.get('last_updated', 'n/a')}")
324
+
325
+ # Tags
326
+ tags_html = " ".join([f'<span class="tag-badge">{t}</span>' for t in art.get("tags", [])])
327
+ st.markdown(tags_html, unsafe_allow_html=True)
328
+
329
+ st.divider()
330
+
331
+ # Content — render backlinks as bold
332
+ content = art["content"]
333
+ content = re.sub(r'\[\[([^\]]+)\]\]', r'**\1**', content)
334
+ st.markdown(content)
335
+
336
+ st.divider()
337
+ # Download article
338
+ st.download_button(
339
+ "📄 Download article (.md)",
340
+ data=art["content"].encode(),
341
+ file_name=f"{slug}.md",
342
+ mime="text/markdown",
343
+ )
344
+
345
+ # Edit option (for power users)
346
+ with st.expander("✏️ Edit this article"):
347
+ new_content = st.text_area("Content (markdown)", value=art["content"], height=400, key=f"edit_{slug}")
348
+ if st.button("Save changes", key=f"save_{slug}"):
349
+ wiki["articles"][slug]["content"] = new_content
350
+ wiki["articles"][slug]["last_updated"] = datetime.date.today().isoformat()
351
+ log(f"edit | {art['title']} — manually edited")
352
+ st.success("Saved")
353
+ st.rerun()
354
+ else:
355
+ st.markdown("### Welcome to the Nursing Knowledge Base")
356
+ st.markdown("""
357
+ This wiki is a living knowledge base for nursing education, powered by Claude AI.
358
+
359
+ **Getting started:**
360
+ 1. **Browse** articles using the list on the left — click any article to read it
361
+ 2. **Add Sources** — paste guidelines, articles, or clinical notes
362
+ 3. **Compile** — Claude integrates your sources into the wiki
363
+ 4. **Ask** — ask nursing questions; Claude answers from the wiki
364
+ 5. **Health Check** — audit the wiki for gaps, contradictions, and suggestions
365
+
366
+ **Pre-loaded content** covers:
367
+ - NMC Code & Proficiency Standards 2018
368
+ - ABCDE Assessment and NEWS2
369
+ - Drug calculations and the Nine Rights
370
+ - PICO and Evidence-Based Practice
371
+ - Person-Centred Care and the Six Cs
372
+ - Mental Capacity Act 2005
373
+ - Safeguarding Adults and Children
374
+ - Infection Prevention and Control
375
+ - Duty of Candour
376
+
377
+ *Select an article on the left to begin reading.*
378
+ """)
379
+ st.markdown(f'<div class="disclaimer">This tool supports but does not replace clinical judgment. Always refer to current NMC guidelines, your local trust policy, and senior clinical colleagues.</div>', unsafe_allow_html=True)
380
+
381
+
382
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
383
+ # TAB 2: ADD SOURCES
384
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
385
+ with tab_sources:
386
+ st.markdown("### Add Raw Sources")
387
+ st.markdown("""
388
+ Add source material to the wiki. Claude will integrate it when you run **Compile**.
389
+
390
+ Suitable sources include:
391
+ - NICE clinical guidelines (copy and paste the text)
392
+ - NMC guidance documents
393
+ - Research paper abstracts or full text
394
+ - NHS trust protocols
395
+ - Textbook chapters
396
+ - Clinical audit findings
397
+ - Your own clinical notes or case studies
398
+ """)
399
+
400
+ col_add, col_list_src = st.columns([1, 1])
401
+
402
+ with col_add:
403
+ st.markdown("#### Add New Source")
404
+ src_title = st.text_input("Source title", placeholder="e.g. NICE NG51 — Sepsis (2016)")
405
+ src_type = st.selectbox("Type", ["Clinical Guideline", "Research Paper", "NMC Document", "NHS Protocol", "Textbook", "Other"])
406
+ src_content = st.text_area(
407
+ "Source content (paste text here)",
408
+ height=300,
409
+ placeholder="Paste the full text of the guideline, paper, or document here...",
410
+ )
411
+
412
+ if st.button("➕ Add Source", type="primary", disabled=not (src_title and src_content)):
413
+ src_id = f"src_{len(wiki.get('sources', {})) + 1:04d}"
414
+ if "sources" not in wiki:
415
+ wiki["sources"] = {}
416
+ wiki["sources"][src_id] = {
417
+ "title": src_title,
418
+ "type": src_type,
419
+ "content": src_content,
420
+ "added": datetime.date.today().isoformat(),
421
+ "processed": False,
422
+ }
423
+ log(f"ingest | Added source: {src_title}")
424
+ st.success(f"Source added: {src_title}")
425
+ st.rerun()
426
+
427
+ with col_list_src:
428
+ st.markdown("#### Sources")
429
+ sources = wiki.get("sources", {})
430
+
431
+ if not sources:
432
+ st.info("No sources added yet. Add your first source on the left.")
433
+ else:
434
+ for src_id, src in sources.items():
435
+ status = "✅ Compiled" if src.get("processed") else "⏳ Pending compile"
436
+ with st.expander(f"{src['title']} — {status}"):
437
+ st.caption(f"Type: {src['type']} | Added: {src['added']}")
438
+ st.text(src["content"][:400] + ("..." if len(src["content"]) > 400 else ""))
439
+ if st.button("🗑️ Remove", key=f"del_{src_id}"):
440
+ del wiki["sources"][src_id]
441
+ log(f"delete | Removed source: {src['title']}")
442
+ st.rerun()
443
+
444
+
445
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
446
+ # TAB 3: COMPILE
447
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
448
+ with tab_compile:
449
+ st.markdown("### Compile Wiki")
450
+ st.markdown("""
451
+ Claude reads your raw sources and integrates them into the wiki — updating existing articles,
452
+ creating new ones, adding cross-references, and keeping the index current.
453
+
454
+ This is the core Karpathy pattern: **you add sources, Claude maintains the knowledge base.**
455
+ """)
456
+
457
+ client = get_client()
458
+ if not client:
459
+ st.warning("Enter your Anthropic API key in the sidebar to use Compile.")
460
+ else:
461
+ pending = {sid: s for sid, s in wiki.get("sources", {}).items() if not s.get("processed")}
462
+
463
+ if not pending:
464
+ st.info("No pending sources. Add sources in the **Add Sources** tab, then compile.")
465
+ else:
466
+ st.markdown(f"**{len(pending)} source(s) ready to compile:**")
467
+ for src_id, src in pending.items():
468
+ st.markdown(f"- {src['title']} ({src['type']})")
469
+
470
+ model = st.selectbox("Model", ["claude-sonnet-4-6", "claude-opus-4-6"],
471
+ help="Sonnet is faster and cheaper; Opus produces richer articles.")
472
+
473
+ if st.button("🔨 Compile Now", type="primary"):
474
+ progress = st.progress(0)
475
+ status = st.empty()
476
+ results_container = st.container()
477
+
478
+ for i, (src_id, src) in enumerate(pending.items()):
479
+ status.markdown(f"⚙️ Compiling: **{src['title']}** ({i+1}/{len(pending)})...")
480
+ try:
481
+ result = compile_source(
482
+ client=client,
483
+ source_title=src["title"],
484
+ source_content=src["content"],
485
+ existing_index=wiki.get("index_summary", ""),
486
+ existing_articles=wiki["articles"],
487
+ model=model,
488
+ )
489
+
490
+ updated_count = len(result.get("articles_updated", []))
491
+ created_count = len(result.get("articles_created", []))
492
+
493
+ for art in result.get("articles_updated", []):
494
+ add_or_update_article(art)
495
+ for art in result.get("articles_created", []):
496
+ add_or_update_article(art)
497
+
498
+ wiki["sources"][src_id]["processed"] = True
499
+ log(f"compile | {src['title']} — updated {updated_count} articles, created {created_count} new articles")
500
+
501
+ with results_container:
502
+ st.success(f"✅ **{src['title']}**: {updated_count} updated, {created_count} created")
503
+ if result.get("summary"):
504
+ st.caption(result["summary"])
505
+
506
+ except Exception as e:
507
+ with results_container:
508
+ st.error(f"❌ Failed to compile {src['title']}: {e}")
509
+
510
+ progress.progress((i + 1) / len(pending))
511
+
512
+ # Rebuild index
513
+ status.markdown("📑 Rebuilding wiki index...")
514
+ try:
515
+ new_index = rebuild_index(client, wiki["articles"], model=model)
516
+ wiki["index_summary"] = new_index
517
+ log(f"index | Wiki index rebuilt — {len(wiki['articles'])} articles")
518
+ except Exception as e:
519
+ st.warning(f"Index rebuild failed: {e}")
520
+
521
+ status.markdown("✅ Compilation complete!")
522
+ progress.progress(1.0)
523
+ st.rerun()
524
+
525
+ # Manual rebuild index
526
+ st.divider()
527
+ st.markdown("**Rebuild Index**")
528
+ st.caption("Regenerate the wiki index from all current articles (useful after manual edits).")
529
+ if st.button("📑 Rebuild Index"):
530
+ if client:
531
+ with st.spinner("Rebuilding..."):
532
+ try:
533
+ new_index = rebuild_index(client, wiki["articles"])
534
+ wiki["index_summary"] = new_index
535
+ log("index | Manual index rebuild")
536
+ st.success("Index rebuilt")
537
+ st.text_area("Updated Index", value=new_index, height=300)
538
+ except Exception as e:
539
+ st.error(f"Failed: {e}")
540
+
541
+
542
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
543
+ # TAB 4: Q&A
544
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
545
+ with tab_qa:
546
+ st.markdown("### Ask the Wiki")
547
+ st.markdown('<div class="disclaimer">Answers are generated from the wiki content and are for educational use only. This tool does not replace clinical judgment or current NMC/NICE guidelines.</div>', unsafe_allow_html=True)
548
+
549
+ client = get_client()
550
+ if not client:
551
+ st.warning("Enter your Anthropic API key in the sidebar to use Q&A.")
552
+ else:
553
+ # Example questions
554
+ st.markdown("**Example questions:**")
555
+ examples = [
556
+ "What are the five statutory principles of the Mental Capacity Act?",
557
+ "How do I calculate an IV drip rate for 1000 mL over 6 hours?",
558
+ "What does the NMC Code say about delegation?",
559
+ "What is the NEWS2 threshold for emergency escalation?",
560
+ "How do I apply the PICO framework to a clinical question about wound care?",
561
+ ]
562
+ cols = st.columns(3)
563
+ for i, ex in enumerate(examples):
564
+ if cols[i % 3].button(ex, key=f"ex_{i}", use_container_width=True):
565
+ st.session_state["qa_question"] = ex
566
+
567
+ # Question input
568
+ question = st.text_area(
569
+ "Your question",
570
+ value=st.session_state.get("qa_question", ""),
571
+ height=100,
572
+ placeholder="Ask any nursing question...",
573
+ key="qa_input",
574
+ )
575
+
576
+ model = st.selectbox("Model", ["claude-sonnet-4-6", "claude-opus-4-6"], key="qa_model")
577
+ col_ask, col_file = st.columns([3, 1])
578
+ ask_clicked = col_ask.button("💬 Ask", type="primary", disabled=not question)
579
+ file_last = col_file.checkbox("File answer to wiki", value=False,
580
+ help="Save valuable Q&A answers as new wiki articles")
581
+
582
+ if ask_clicked and question:
583
+ with st.spinner("Searching wiki and composing answer..."):
584
+ try:
585
+ answer = answer_question(client, question, wiki["articles"], model=model)
586
+
587
+ # Add to history
588
+ st.session_state.qa_history.append({
589
+ "question": question,
590
+ "answer": answer,
591
+ "timestamp": datetime.datetime.now().isoformat(),
592
+ })
593
+ log(f"query | {question[:80]}")
594
+
595
+ # Optionally file to wiki
596
+ if file_last:
597
+ with st.spinner("Filing answer to wiki..."):
598
+ new_art = file_answer_to_wiki(client, question, answer, model="claude-haiku-4-5-20251001")
599
+ if new_art:
600
+ add_or_update_article(new_art)
601
+ log(f"file | Created article from Q&A: {new_art['title']}")
602
+ st.success(f"Filed as new article: **{new_art['title']}**")
603
+
604
+ st.session_state["qa_question"] = ""
605
+ except Exception as e:
606
+ st.error(f"Error: {e}")
607
+
608
+ # Display Q&A history (newest first)
609
+ if st.session_state.qa_history:
610
+ st.divider()
611
+ st.markdown("### Recent Questions")
612
+
613
+ for qa in reversed(st.session_state.qa_history[-10:]):
614
+ with st.expander(f"❓ {qa['question'][:80]}{'...' if len(qa['question'])>80 else ''}", expanded=False):
615
+ st.markdown(qa["answer"])
616
+ st.download_button(
617
+ "📄 Save answer",
618
+ data=f"# {qa['question']}\n\n{qa['answer']}".encode(),
619
+ file_name="answer.md",
620
+ mime="text/markdown",
621
+ key=f"dl_{qa['timestamp']}",
622
+ )
623
+
624
+ if st.button("🗑️ Clear history"):
625
+ st.session_state.qa_history = []
626
+ st.rerun()
627
+
628
+
629
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
630
+ # TAB 5: HEALTH CHECK (LINT)
631
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
632
+ with tab_lint:
633
+ st.markdown("### Wiki Health Check")
634
+ st.markdown("""
635
+ Claude audits the wiki for:
636
+ - **Contradictions** between articles
637
+ - **Stale content** that may need updating
638
+ - **Orphan articles** with few cross-references
639
+ - **Missing links** between related articles
640
+ - **Clinical safety gaps** — important missing content
641
+ - **Suggested new articles** to expand the wiki
642
+ """)
643
+
644
+ client = get_client()
645
+ if not client:
646
+ st.warning("Enter your Anthropic API key in the sidebar to run a health check.")
647
+ else:
648
+ model = st.selectbox("Model", ["claude-sonnet-4-6", "claude-opus-4-6"], key="lint_model")
649
+
650
+ if st.button("🔍 Run Health Check", type="primary"):
651
+ with st.spinner("Auditing wiki... this may take a moment"):
652
+ try:
653
+ report = lint_wiki(client, wiki["articles"], wiki.get("index_summary", ""), model=model)
654
+ st.session_state.lint_report = report
655
+ log(f"lint | Health check completed — {report.get('total_issues', 0)} issues found")
656
+ except Exception as e:
657
+ st.error(f"Health check failed: {e}")
658
+
659
+ report = st.session_state.lint_report
660
+ if report:
661
+ st.divider()
662
+
663
+ # Overall status
664
+ health = report.get("overall_health", "Unknown")
665
+ health_color = {"Good": "#007F3B", "Fair": "#FFB81C", "Needs attention": "#D93025"}.get(health, "#666")
666
+ st.markdown(f'<h3 style="color:{health_color}">Overall Health: {health}</h3>', unsafe_allow_html=True)
667
+ st.markdown(report.get("summary", ""))
668
+
669
+ col_issues, col_suggestions = st.columns([1, 1])
670
+
671
+ with col_issues:
672
+ st.markdown(f"### Issues ({report.get('total_issues', 0)})")
673
+
674
+ for issue in report.get("issues", []):
675
+ sev = issue.get("severity", "low")
676
+ css = f"issue-{sev}"
677
+ icon = {"high": "🔴", "medium": "🟡", "low": "🟢"}.get(sev, "●")
678
+ st.markdown(
679
+ f'<div class="{css}"><strong>{icon} {issue.get("type", "").replace("_", " ").title()}</strong> '
680
+ f'— {issue.get("article", "wiki-wide")}<br>'
681
+ f'{issue.get("description", "")}<br>'
682
+ f'<em>Fix: {issue.get("recommendation", "")}</em></div>',
683
+ unsafe_allow_html=True,
684
+ )
685
+
686
+ if report.get("strengths"):
687
+ st.markdown("### Strengths")
688
+ for s in report["strengths"]:
689
+ st.markdown(f"✅ {s}")
690
+
691
+ with col_suggestions:
692
+ st.markdown("### Suggested New Articles")
693
+ suggested = report.get("suggested_new_articles", [])
694
+
695
+ if not suggested:
696
+ st.info("No new articles suggested.")
697
+ else:
698
+ for suggestion in suggested:
699
+ with st.expander(f"📝 {suggestion['title']} ({suggestion['category']})"):
700
+ st.caption(suggestion.get("rationale", ""))
701
+ if suggestion.get("key_topics"):
702
+ st.markdown("**Key topics**: " + ", ".join(suggestion["key_topics"]))
703
+
704
+ if st.button(f"Generate article: {suggestion['title'][:30]}...",
705
+ key=f"gen_{suggestion['title'][:20]}"):
706
+ with st.spinner(f"Generating: {suggestion['title']}..."):
707
+ try:
708
+ new_art = generate_missing_article(
709
+ client,
710
+ suggestion["title"],
711
+ suggestion["category"],
712
+ suggestion.get("key_topics", []),
713
+ wiki.get("index_summary", ""),
714
+ model=model,
715
+ )
716
+ add_or_update_article(new_art)
717
+ log(f"generate | Created article: {suggestion['title']} (from lint suggestion)")
718
+ st.success(f"Created: **{new_art['title']}**")
719
+ st.rerun()
720
+ except Exception as e:
721
+ st.error(f"Failed: {e}")
722
+
723
+
724
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
725
+ # TAB 6: LOG
726
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
727
+ with tab_log:
728
+ st.markdown("### Operation Log")
729
+ st.caption("Append-only chronological record of all wiki operations.")
730
+
731
+ log_entries = wiki.get("log", [])
732
+
733
+ if not log_entries:
734
+ st.info("No log entries yet.")
735
+ else:
736
+ # Show newest first
737
+ for entry in reversed(log_entries):
738
+ st.markdown(entry)
739
+
740
+ st.download_button(
741
+ "📄 Download Log",
742
+ data="\n\n".join(log_entries).encode(),
743
+ file_name=f"wiki_log_{datetime.date.today()}.md",
744
+ mime="text/markdown",
745
+ )
wiki/starter.py ADDED
@@ -0,0 +1,1177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Starter wiki content for the Nursing Knowledge Base.
2
+
3
+ This module provides a pre-seeded wiki covering core nursing knowledge,
4
+ aligned with NMC Standards of Proficiency (2018) and UK clinical frameworks.
5
+ """
6
+
7
+ STARTER_WIKI = {
8
+ "articles": {
9
+ "nmc_code": {
10
+ "title": "The NMC Code",
11
+ "category": "standards",
12
+ "tags": ["nmc", "professional", "code", "ethics", "accountability"],
13
+ "last_updated": "2026-04-04",
14
+ "sources": ["built-in"],
15
+ "content": """# The NMC Code
16
+
17
+ The **NMC Code** (2015, updated 2018) sets out the professional standards that registered nurses, midwives and nursing associates must uphold. It is structured around four themes.
18
+
19
+ ## The Four Themes
20
+
21
+ ### 1. Prioritise People
22
+ - Treat people as individuals and uphold their dignity
23
+ - Listen to people and respond to their preferences and concerns
24
+ - Make sure people's physical, social and psychological needs are assessed and responded to
25
+ - Act in the best interests of people at all times
26
+ - Respect and uphold people's rights to make their own decisions
27
+
28
+ ### 2. Practise Effectively
29
+ - Always practise in line with the best available evidence
30
+ - Communicate clearly — maintain clear and accurate records
31
+ - Work cooperatively — work with colleagues to evaluate the quality of your work
32
+ - Share your skills, knowledge and experience for the benefit of people receiving care and your colleagues
33
+ - Keep your knowledge and skills up to date throughout your working life
34
+
35
+ ### 3. Preserve Safety
36
+ - Recognise and work within your own competence
37
+ - Be open and candid with all service users about all aspects of care — **Duty of Candour**
38
+ - Act without delay in situations that put people at risk
39
+ - Raise concerns immediately if you believe a person is vulnerable or at risk
40
+ - Advise on, prescribe, supply, dispense or administer medicines within the limits of your training and competence
41
+
42
+ ### 4. Promote Professionalism and Trust
43
+ - Uphold the reputation of your profession at all times
44
+ - Uphold your position as a registered nurse, midwife or nursing associate
45
+ - Fulfil all registration requirements
46
+ - Cooperate with all investigations and audits
47
+
48
+ ## Key Accountability Principles
49
+
50
+ - You are **personally accountable** for your actions and omissions in your practice
51
+ - Delegation does not remove your accountability as the registered nurse
52
+ - You must **escalate concerns** using local policies (e.g. Datix, RIDDOR) without delay
53
+ - The NMC can take action if your fitness to practise is impaired
54
+
55
+ ## Related Articles
56
+ - [[NMC Proficiency Standards 2018]]
57
+ - [[Duty of Candour]]
58
+ - [[Delegation in Nursing]]
59
+ - [[NMC Revalidation]]
60
+
61
+ ## References
62
+ - NMC (2018) *The Code: Professional standards of practice and behaviour for nurses, midwives and nursing associates*. London: NMC.
63
+ """,
64
+ },
65
+ "nmc_proficiency": {
66
+ "title": "NMC Standards of Proficiency 2018",
67
+ "category": "standards",
68
+ "tags": ["nmc", "proficiency", "standards", "competency", "registration"],
69
+ "last_updated": "2026-04-04",
70
+ "sources": ["built-in"],
71
+ "content": """# NMC Standards of Proficiency 2018
72
+
73
+ The **NMC Standards of Proficiency for Registered Nurses** (2018) set out what all nursing students must know, understand, and be able to do at the point of registration. They are organised into seven platforms plus Annexes A and B.
74
+
75
+ ## The Seven Platforms
76
+
77
+ ### Platform 1: Being an Accountable Professional
78
+ Nurses act in the best interests of people, making evidence-based decisions and maintaining professional standards. Includes reflective practice, escalation of concerns, and accountability.
79
+
80
+ ### Platform 2: Promoting Health and Preventing Ill Health
81
+ Understanding public health, health promotion, and disease prevention. Includes social determinants of health, health screening, and vaccination programmes.
82
+
83
+ ### Platform 3: Assessing Needs and Planning Care
84
+ Using evidence-based assessment frameworks and tools. Includes systematic assessment (ABCDE, NEWS2), holistic needs assessment, and care planning (ADPIE).
85
+
86
+ ### Platform 4: Providing and Evaluating Care
87
+ Delivering and evaluating safe, effective, person-centred care. Includes clinical skills, therapeutic interventions, and outcome measurement.
88
+
89
+ ### Platform 5: Leading and Managing Nursing Care and Working in Teams
90
+ Prioritisation, delegation, and inter-professional working. Includes team leadership, conflict management, and workload management.
91
+
92
+ ### Platform 6: Improving Safety and Quality of Care
93
+ Patient safety principles, clinical governance, and quality improvement. Includes incident reporting, risk assessment, and audit.
94
+
95
+ ### Platform 7: Coordinating Care
96
+ Coordinating complex care across teams and organisations. Includes discharge planning, referral processes, and integrated care pathways.
97
+
98
+ ## Annexe A: Communication and Relationship Management Skills
99
+ Therapeutic communication, breaking bad news, working with interpreters, health literacy.
100
+
101
+ ## Annexe B: Nursing Procedures
102
+ The practical skills all registered nurses must demonstrate, organised by body system:
103
+ - Wound care and pressure ulcer prevention
104
+ - Venepuncture and cannulation
105
+ - Medication administration
106
+ - Catheterisation
107
+ - Moving and handling
108
+ - Vital signs monitoring (including NEWS2)
109
+
110
+ ## Field-Specific Standards
111
+ The generic standards apply across all four fields:
112
+ - **Adult nursing**
113
+ - **Mental health nursing**
114
+ - **Learning disabilities nursing**
115
+ - **Children's nursing**
116
+
117
+ Field-specific proficiencies build on the generic standards.
118
+
119
+ ## Related Articles
120
+ - [[The NMC Code]]
121
+ - [[ABCDE Assessment]]
122
+ - [[NEWS2 - National Early Warning Score]]
123
+ - [[ADPIE - The Nursing Process]]
124
+ - [[NMC Revalidation]]
125
+
126
+ ## References
127
+ - NMC (2018) *Future Nurse: Standards of Proficiency for Registered Nurses*. London: NMC.
128
+ """,
129
+ },
130
+ "abcde_assessment": {
131
+ "title": "ABCDE Assessment Framework",
132
+ "category": "clinical",
133
+ "tags": ["assessment", "abcde", "deteriorating patient", "clinical", "emergency"],
134
+ "last_updated": "2026-04-04",
135
+ "sources": ["built-in"],
136
+ "content": """# ABCDE Assessment Framework
137
+
138
+ The **ABCDE approach** is the systematic method for assessing and managing acutely ill or deteriorating patients. It is recommended by the Resuscitation Council UK and underpins NEWS2 escalation.
139
+
140
+ ## The Five Components
141
+
142
+ ### A — Airway
143
+ **Goal**: Ensure the airway is patent (open and unobstructed).
144
+
145
+ - Look for signs of airway obstruction: gurgling, stridor, paradoxical chest movement
146
+ - Assess for secretions, foreign body, swelling, or positional compromise
147
+ - **Interventions**: Head-tilt chin-lift, jaw thrust, suction, airway adjuncts (nasopharyngeal, oropharyngeal), call anaesthetist for advanced airway
148
+ - If airway is compromised, call for help immediately (**2222 in hospital**)
149
+
150
+ ### B — Breathing
151
+ **Goal**: Assess adequacy of ventilation and gas exchange.
152
+
153
+ - **Inspect**: rate (normal 12–20/min), depth, symmetry, use of accessory muscles
154
+ - **Palpate**: tracheal position, chest expansion
155
+ - **Percuss**: dullness (consolidation/effusion), hyper-resonance (pneumothorax)
156
+ - **Auscultate**: air entry, added sounds (wheeze, crackles, pleural rub)
157
+ - **Measure**: SpO₂ (target 94–98%; 88–92% in COPD), peak flow if asthma
158
+ - **Interventions**: positioning (upright), oxygen therapy, nebulisers, call for review
159
+
160
+ ### C — Circulation
161
+ **Goal**: Assess cardiovascular status and perfusion.
162
+
163
+ - **Heart rate**: normal 60–100 bpm; note rhythm (regular/irregular)
164
+ - **Blood pressure**: systolic <90 mmHg = hypotension; >140/90 = hypertension
165
+ - **Capillary refill time (CRT)**: normal <2 seconds; press sternum or fingertip
166
+ - **Skin**: temperature, colour, turgor, diaphoresis
167
+ - **Urine output**: normal >0.5 mL/kg/hr
168
+ - **12-lead ECG** if cardiac arrhythmia suspected
169
+ - **Interventions**: IV access, fluid challenge, catheter for urine output monitoring
170
+
171
+ ### D — Disability
172
+ **Goal**: Assess neurological status.
173
+
174
+ - **AVPU scale**: Alert, Voice, Pain, Unresponsive
175
+ - **GCS (Glasgow Coma Scale)**: Eyes (4), Verbal (5), Motor (6) — normal = 15
176
+ - **Blood glucose**: BM/CBG — hypoglycaemia (<4 mmol/L) is a medical emergency
177
+ - **Pupillary response**: size, equality, reactivity to light
178
+ - **Limb movement**: power and sensation
179
+ - **Interventions**: glucose correction, neurological referral, seizure management
180
+
181
+ ### E — Exposure
182
+ **Goal**: Identify all clinical problems; avoid missing findings.
183
+
184
+ - Fully expose the patient while maintaining dignity and warmth
185
+ - Check skin: rashes, wounds, oedema, pressure areas, surgical drains, IV sites
186
+ - Temperature: pyrexia (>38°C), hypothermia (<36°C)
187
+ - Examine abdomen: distension, tenderness, bowel sounds
188
+ - Prevent hypothermia: warm blankets, warm IV fluids if needed
189
+
190
+ ## SBAR Handover After ABCDE
191
+ After completing ABCDE, communicate findings using **SBAR**:
192
+ - **S**ituation: who you are, about whom, the problem
193
+ - **B**ackground: relevant history, medications
194
+ - **A**ssessment: your ABCDE findings
195
+ - **R**ecommendation: what you need from the senior/team
196
+
197
+ ## Related Articles
198
+ - [[NEWS2 - National Early Warning Score]]
199
+ - [[SBAR Communication]]
200
+ - [[Sepsis Recognition and Management]]
201
+ - [[Oxygen Therapy]]
202
+
203
+ ## References
204
+ - Resuscitation Council UK (2021) *The ABCDE approach*. resus.org.uk
205
+ - Smith, G. (2010) *In-hospital cardiac arrest: Is it time for an in-hospital chain of prevention?* Resuscitation 81(9): 1209–1211.
206
+ """,
207
+ },
208
+ "news2": {
209
+ "title": "NEWS2 - National Early Warning Score",
210
+ "category": "clinical",
211
+ "tags": ["news2", "early warning", "deteriorating patient", "escalation", "vital signs"],
212
+ "last_updated": "2026-04-04",
213
+ "sources": ["built-in"],
214
+ "content": """# NEWS2 — National Early Warning Score
215
+
216
+ **NEWS2** is the standardised early warning score recommended by NHS England and NICE (NG94, 2018) for identifying acutely ill adults in hospital and pre-hospital settings. It replaced NEWS1 and is mandatory across NHS trusts.
217
+
218
+ ## The Seven Parameters Scored
219
+
220
+ | Parameter | Range | Score |
221
+ |-----------|-------|-------|
222
+ | Respiration rate (breaths/min) | ≤8 | 3 |
223
+ | | 9–11 | 1 |
224
+ | | 12–20 | 0 |
225
+ | | 21–24 | 2 |
226
+ | | ≥25 | 3 |
227
+ | SpO₂ Scale 1 (%) | ≤91 | 3 |
228
+ | | 92–93 | 2 |
229
+ | | 94–95 | 1 |
230
+ | | ≥96 | 0 |
231
+ | SpO₂ Scale 2 (COPD target 88–92%) | ≤83 | 3 |
232
+ | | 84–85 | 2 |
233
+ | | 86–87 | 1 |
234
+ | | 88–92 or ≥93 on air | 0 |
235
+ | Air or oxygen? | Oxygen | 2 |
236
+ | | Air | 0 |
237
+ | Systolic BP (mmHg) | ≤90 | 3 |
238
+ | | 91–100 | 2 |
239
+ | | 101–110 | 1 |
240
+ | | 111–219 | 0 |
241
+ | | ≥220 | 3 |
242
+ | Pulse (bpm) | ≤40 | 3 |
243
+ | | 41–50 | 1 |
244
+ | | 51–90 | 0 |
245
+ | | 91–110 | 1 |
246
+ | | 111–130 | 2 |
247
+ | | ≥131 | 3 |
248
+ | Consciousness | Alert | 0 |
249
+ | | CVPU (New confusion, Voice, Pain, Unresponsive) | 3 |
250
+ | Temperature (°C) | ≤35.0 | 3 |
251
+ | | 35.1–36.0 | 1 |
252
+ | | 36.1–38.0 | 0 |
253
+ | | 38.1–39.0 | 1 |
254
+ | | ≥39.1 | 2 |
255
+
256
+ ## Clinical Response Thresholds
257
+
258
+ | Score | Risk | Response |
259
+ |-------|------|---------|
260
+ | 0 | Low | Routine obs (minimum 12-hourly) |
261
+ | 1–4 | Low | Increase monitoring; nurse to assess |
262
+ | 3 in one parameter | Low-Medium | Nurse to urgently inform ward doctor |
263
+ | 5–6 | Medium | Urgent doctor review; consider HDU |
264
+ | ≥7 | High | Emergency response — 2222 arrest call |
265
+
266
+ **New onset confusion** (C in CVPU) scores 3 — even if other obs are normal, this must trigger urgent review.
267
+
268
+ ## Important Caveats
269
+
270
+ - **SpO₂ Scale 2**: Use only for patients with confirmed hypercapnic respiratory failure (usually COPD) with a prescribed target of 88–92%
271
+ - **Pregnancy**: Standard NEWS2 is **not validated** in pregnancy — use MEOWS (Modified Early Obstetric Warning Score)
272
+ - **Children**: Use PEWS (Paediatric Early Warning Score) — not NEWS2
273
+ - NEWS2 is a **trigger**, not a diagnosis — always use clinical judgement alongside the score
274
+
275
+ ## Escalation and Documentation
276
+
277
+ 1. Calculate NEWS2 at every observation set
278
+ 2. Document on NEWS2 chart/in EPR
279
+ 3. Escalate according to trust protocol (SBAR handover)
280
+ 4. If in doubt — escalate; it is always better to call unnecessarily
281
+
282
+ ## Related Articles
283
+ - [[ABCDE Assessment Framework]]
284
+ - [[Sepsis Recognition and Management]]
285
+ - [[SBAR Communication]]
286
+ - [[Vital Signs - Normal Ranges]]
287
+
288
+ ## References
289
+ - Royal College of Physicians (2017) *National Early Warning Score (NEWS) 2*. London: RCP.
290
+ - NICE (2018) *NG94: Sepsis: recognition, diagnosis and early management*. London: NICE.
291
+ """,
292
+ },
293
+ "adpie": {
294
+ "title": "ADPIE - The Nursing Process",
295
+ "category": "clinical",
296
+ "tags": ["adpie", "nursing process", "care planning", "assessment", "evaluation"],
297
+ "last_updated": "2026-04-04",
298
+ "sources": ["built-in"],
299
+ "content": """# ADPIE — The Nursing Process
300
+
301
+ **ADPIE** is the five-step nursing process used to deliver individualised, evidence-based care. It provides a systematic, cyclical framework for clinical decision-making.
302
+
303
+ ## The Five Steps
304
+
305
+ ### A — Assessment
306
+ **Purpose**: Gather comprehensive, holistic data about the patient.
307
+
308
+ **Subjective data** (what the patient tells you):
309
+ - Chief complaint, symptoms, pain (SOCRATES), history of presenting complaint
310
+ - Past medical history, medications, allergies
311
+ - Functional status, social history, cultural and spiritual needs
312
+
313
+ **Objective data** (what you observe and measure):
314
+ - Vital signs, NEWS2, physical examination
315
+ - Laboratory and diagnostic results
316
+ - Behavioural and psychological observations
317
+
318
+ **Tools**: ABCDE, NEWS2, nutritional screening (MUST), falls risk (Morse), pressure ulcer risk (Braden/Waterlow), pain scales (NRS, Wong-Baker)
319
+
320
+ ### D — Diagnosis (Nursing Diagnosis)
321
+ **Purpose**: Identify actual and potential nursing problems.
322
+
323
+ Use **NANDA-I** nursing diagnoses (not medical diagnoses):
324
+ - **Actual problem**: "Acute pain related to surgical incision as evidenced by facial grimacing and verbal report of 8/10 pain"
325
+ - **Risk problem**: "Risk for infection related to compromised skin integrity"
326
+ - **Health promotion**: "Readiness for enhanced self-management"
327
+
328
+ Structure: **Problem + Related to (aetiology) + As evidenced by (signs/symptoms)**
329
+
330
+ Prioritise using **Maslow's Hierarchy**: physiological → safety → love/belonging → esteem → self-actualisation
331
+
332
+ ### P — Planning
333
+ **Purpose**: Set measurable goals and select interventions.
334
+
335
+ **SMART Goals**:
336
+ - **S**pecific, **M**easurable, **A**chievable, **R**elevant, **T**ime-bound
337
+ - Example: "Patient will report pain ≤3/10 within 30 minutes of analgesia administration"
338
+
339
+ **Short-term goals**: within hours/days (acute care)
340
+ **Long-term goals**: discharge and rehabilitation focused
341
+
342
+ Document planned interventions and rationale.
343
+
344
+ ### I — Implementation
345
+ **Purpose**: Carry out the planned interventions.
346
+
347
+ Types of nursing interventions:
348
+ - **Independent**: actions within nursing scope without medical order (e.g., repositioning, education)
349
+ - **Dependent**: require medical order (e.g., medications, investigations)
350
+ - **Collaborative/Interdependent**: with other health professionals (e.g., physiotherapy referral)
351
+
352
+ Document all care delivered, responses, and changes.
353
+
354
+ ### E — Evaluation
355
+ **Purpose**: Determine whether goals have been met and revise the plan.
356
+
357
+ - Compare patient outcomes to the goals set in Planning
358
+ - **Goal met**: document and continue
359
+ - **Partially met**: identify barriers; modify interventions
360
+ - **Not met**: reassess; revise nursing diagnosis and plan
361
+
362
+ Evaluation is **continuous**, not just at discharge. ADPIE is cyclical — re-assessment triggers a new cycle.
363
+
364
+ ## Documentation in ADPIE
365
+ All five steps must be documented in patient records per:
366
+ - NMC Code (2018): accurate, contemporaneous records
367
+ - Local trust policies and EPR systems
368
+ - GDPR and Caldicott Principles (patient confidentiality)
369
+
370
+ ## Related Articles
371
+ - [[ABCDE Assessment Framework]]
372
+ - [[NANDA Nursing Diagnoses]]
373
+ - [[Person-Centred Care]]
374
+ - [[Documentation Standards]]
375
+
376
+ ## References
377
+ - NMC (2018) *Future Nurse: Standards of Proficiency for Registered Nurses*. Platform 3.
378
+ - Alfaro-LeFevre, R. (2019) *Critical Thinking, Clinical Reasoning, and Clinical Judgment*. 7th ed. Elsevier.
379
+ """,
380
+ },
381
+ "nine_rights": {
382
+ "title": "The Nine Rights of Medication Administration",
383
+ "category": "pharmacology",
384
+ "tags": ["medication", "safety", "nine rights", "drug administration", "pharmacology"],
385
+ "last_updated": "2026-04-04",
386
+ "sources": ["built-in"],
387
+ "content": """# The Nine Rights of Medication Administration
388
+
389
+ The **Nine Rights** (expanded from the traditional Five Rights) provide a framework for safe medication administration. They are a core component of **NMC Proficiency** and the **NMC Code**.
390
+
391
+ ## The Nine Rights
392
+
393
+ ### 1. Right Patient
394
+ - Verify identity using at least **two identifiers**: name + date of birth (not bed number)
395
+ - Check patient ID band against the prescription chart/EPR
396
+ - Ask the patient to state their name and DOB (if conscious and able)
397
+ - **Never** rely on verbal confirmation alone or room/bed location
398
+
399
+ ### 2. Right Drug (Medication)
400
+ - Check the drug name against the prescription: beware **LASA** (Look-Alike Sound-Alike) drugs
401
+ - Know the drug: indication, mechanism, therapeutic range
402
+ - Check for allergies — cross-reference allergy record before administration
403
+ - Confirm with BNF or local formulary if unsure
404
+
405
+ ### 3. Right Dose
406
+ - Calculate the dose: **Dose = Desired / Have × Volume**
407
+ - Verify dose is within normal therapeutic range
408
+ - For high-alert medications (e.g., heparin, insulin), a second registered nurse must independently double-check
409
+ - Weight-based dosing: confirm current weight; recalculate for paediatric patients
410
+
411
+ ### 4. Right Route
412
+ - Confirm prescribed route (oral, IV, IM, SC, topical, inhaled, PR, etc.)
413
+ - Ensure the formulation matches the route (e.g., never give oral solution intravenously)
414
+ - Modified-release preparations must never be crushed
415
+
416
+ ### 5. Right Time
417
+ - Administer at the correct prescribed time
418
+ - Understand time-critical medications (e.g., antibiotics in sepsis within 1 hour, insulin, anticoagulants)
419
+ - Document time of administration promptly
420
+
421
+ ### 6. Right Documentation
422
+ - Record immediately after administration (not before)
423
+ - Sign/initial the prescription chart or EPR at time of administration
424
+ - If medication not given, document reason with appropriate code
425
+
426
+ ### 7. Right Reason
427
+ - Understand *why* the patient is receiving this medication
428
+ - Confirm the indication is still appropriate
429
+ - Question prescriptions you do not understand — prescribers have a duty to explain
430
+
431
+ ### 8. Right Response
432
+ - Monitor patient after administration for therapeutic effect and adverse reactions
433
+ - Know expected onset and duration of action
434
+ - Know the signs of adverse effects and anaphylaxis
435
+ - Document patient response
436
+
437
+ ### 9. Right Refusal
438
+ - Patients have the right to refuse medication (Mental Capacity Act 2005 / Gillick competence for children)
439
+ - Document refusal clearly; inform the prescriber
440
+ - Explore reasons for refusal; do not coerce
441
+
442
+ ## Double-Checking Policy
443
+ High-alert medications typically require two registered nurses to independently:
444
+ - Calculate the dose
445
+ - Check the drug, concentration, route, and rate (for infusions)
446
+ - Prepare and administer
447
+
448
+ Refer to local trust policy for the list of drugs requiring double-checking.
449
+
450
+ ## Related Articles
451
+ - [[ISMP High-Alert Medications]]
452
+ - [[Drug Calculations]]
453
+ - [[Mental Capacity Act 2005]]
454
+ - [[Medication Safety - LASA Drugs]]
455
+ - [[Anaphylaxis Management]]
456
+
457
+ ## References
458
+ - NMC (2018) *Future Nurse: Standards of Proficiency*, Annexe B.
459
+ - ISMP (2023) *List of High-Alert Medications*. ismp.org
460
+ - BNF (current edition). bnf.nice.org.uk
461
+ """,
462
+ },
463
+ "drug_calculations": {
464
+ "title": "Drug Calculations",
465
+ "category": "pharmacology",
466
+ "tags": ["drug calculations", "dosage", "iv rate", "weight-based", "maths"],
467
+ "last_updated": "2026-04-04",
468
+ "sources": ["built-in"],
469
+ "content": """# Drug Calculations
470
+
471
+ Accurate drug calculations are a core NMC competency. All nurses must be able to perform these calculations safely and accurately.
472
+
473
+ ## Core Formulae
474
+
475
+ ### 1. Tablets / Capsules
476
+ ```
477
+ Number of tablets = What you WANT ÷ What you HAVE
478
+ ```
479
+ **Example**: Prescribed 75 mg, available 25 mg tablets → 75 ÷ 25 = **3 tablets**
480
+
481
+ ### 2. Liquid Oral / Injectable Medications
482
+ ```
483
+ Volume to give = (What you WANT ÷ What you HAVE) × Volume of stock
484
+ ```
485
+ **Example**: Prescribed 250 mg, available 500 mg/5 mL → (250 ÷ 500) × 5 = **2.5 mL**
486
+
487
+ ### 3. IV Drip Rate (Drops per Minute)
488
+ ```
489
+ Drops per minute = (Volume (mL) × Drop factor) ÷ Time (minutes)
490
+ ```
491
+ - Standard giving set: **20 drops/mL**
492
+ - Blood/viscous fluids: **15 drops/mL**
493
+ - Microdrop set: **60 drops/mL**
494
+
495
+ **Example**: 1000 mL over 8 hours (480 min) using standard set → (1000 × 20) ÷ 480 = **41.7 ≈ 42 drops/min**
496
+
497
+ ### 4. IV Flow Rate (mL per Hour — for infusion pump)
498
+ ```
499
+ Rate (mL/hr) = Volume (mL) ÷ Time (hours)
500
+ ```
501
+ **Example**: 500 mL over 6 hours → 500 ÷ 6 = **83.3 mL/hr**
502
+
503
+ ### 5. Weight-Based Dosing
504
+ ```
505
+ Dose = Prescribed dose (mg/kg) × Patient weight (kg)
506
+ ```
507
+ **Example**: Prescribed 5 mg/kg, patient weighs 70 kg → 5 × 70 = **350 mg**
508
+
509
+ ### 6. Concentration / Infusion Rate
510
+ ```
511
+ Rate (mL/hr) = [Dose (mcg/kg/min) × Weight (kg) × 60] ÷ Concentration (mcg/mL)
512
+ ```
513
+ **Example**: Noradrenaline 0.1 mcg/kg/min, 80 kg patient, 4 mg in 50 mL (= 80 mcg/mL)
514
+ → (0.1 × 80 × 60) ÷ 80 = 480 ÷ 80 = **6 mL/hr**
515
+
516
+ ### 7. Percentage Concentrations
517
+ - **w/v (weight in volume)**: grams per 100 mL → 0.9% NaCl = 0.9 g per 100 mL
518
+ - **v/v (volume in volume)**: mL per 100 mL
519
+
520
+ ### 8. Unit Conversions
521
+ | From | To | Multiply by |
522
+ |------|----|-------------|
523
+ | grams (g) | milligrams (mg) | × 1,000 |
524
+ | milligrams (mg) | micrograms (mcg) | × 1,000 |
525
+ | micrograms (mcg) | nanograms (ng) | × 1,000 |
526
+ | litres (L) | millilitres (mL) | × 1,000 |
527
+
528
+ **Always convert to the same units before calculating.**
529
+
530
+ ## Checking Your Answer
531
+ 1. Does it seem clinically reasonable? (e.g., >10 tablets is a red flag)
532
+ 2. For IV rates: cross-check by working backwards
533
+ 3. High-risk drugs: always have a second registered nurse independently verify
534
+
535
+ ## Common Errors to Avoid
536
+ - Decimal point errors (e.g., 1.5 mg vs 15 mg)
537
+ - Unit confusion (mg vs mcg — 1000× difference)
538
+ - Miscalculating rate for variable-rate infusions (e.g., sliding scale insulin)
539
+ - Using an incorrect patient weight (use current measured weight)
540
+
541
+ ## Paediatric Considerations
542
+ - Always use **current weight** (weighed today, not estimated)
543
+ - Use **Broselow tape** in emergencies for estimated weight
544
+ - Paediatric doses are **always weight-based**
545
+ - Maximum adult doses apply — never exceed even if calculation gives higher
546
+ - Use paediatric BNF (BNFc) or local formulary
547
+
548
+ ## Related Articles
549
+ - [[The Nine Rights of Medication Administration]]
550
+ - [[ISMP High-Alert Medications]]
551
+ - [[Insulin Administration]]
552
+ - [[IV Therapy and Fluid Management]]
553
+
554
+ ## References
555
+ - NMC (2018) *Future Nurse: Standards of Proficiency*, Annexe B.
556
+ - BNF/BNFc (current edition). bnf.nice.org.uk / bnfc.nice.org.uk
557
+ - Wright, K. (2009) *Drug calculations for nurses*. Nursing Standard 23(28): 35–40.
558
+ """,
559
+ },
560
+ "pico_framework": {
561
+ "title": "PICO Framework for Evidence-Based Practice",
562
+ "category": "evidence",
563
+ "tags": ["pico", "ebp", "evidence", "research", "clinical question"],
564
+ "last_updated": "2026-04-04",
565
+ "sources": ["built-in"],
566
+ "content": """# PICO Framework for Evidence-Based Practice
567
+
568
+ **PICO** is the structured format for formulating clinical questions to guide evidence searches. It is foundational to Evidence-Based Practice (EBP) in nursing.
569
+
570
+ ## The PICO Components
571
+
572
+ | Letter | Stands For | Question to Ask |
573
+ |--------|-----------|-----------------|
574
+ | **P** | Population / Patient / Problem | Who is the patient? What is the condition/problem? |
575
+ | **I** | Intervention | What is the main intervention, treatment, or exposure? |
576
+ | **C** | Comparison | What is the main alternative (if any)? |
577
+ | **O** | Outcome | What are you trying to achieve or measure? |
578
+
579
+ ## Example PICO Question
580
+
581
+ **Clinical scenario**: An elderly patient with a pressure ulcer on their heel. You wonder whether hydrocolloid dressings are better than foam dressings.
582
+
583
+ | Component | Example |
584
+ |-----------|---------|
585
+ | P | Adults aged ≥65 with Category II pressure ulcers |
586
+ | I | Hydrocolloid dressings |
587
+ | C | Foam dressings |
588
+ | O | Wound healing time, pain, infection rates |
589
+
590
+ **PICO question**: "In adults aged ≥65 with Category II pressure ulcers (P), do hydrocolloid dressings (I) compared to foam dressings (C) reduce wound healing time and infection rates (O)?"
591
+
592
+ ## PICO Variations
593
+
594
+ ### PICOT (adding Time)
595
+ - **T**: Time — over what period is the outcome measured?
596
+ - Useful for longitudinal studies or time-sensitive outcomes
597
+
598
+ ### PICOS (adding Study design)
599
+ - **S**: Study design — what type of study is most appropriate?
600
+ - Useful when you want to specify RCT, cohort study, etc.
601
+
602
+ ### PEO (Qualitative questions)
603
+ For qualitative research: **P**opulation, **E**xposure/Experience, **O**utcome
604
+ - "What are the experiences (O) of patients with chronic pain (P) regarding acupuncture (E)?"
605
+
606
+ ## Using PICO for Database Searching
607
+
608
+ 1. Identify PICO components
609
+ 2. Generate **synonyms and MeSH terms** for each component
610
+ 3. Use **Boolean operators**: AND (between components), OR (between synonyms)
611
+ 4. Apply **filters**: date range, language, study type, human subjects
612
+
613
+ **Search string example**:
614
+ `("pressure ulcer" OR "pressure injury" OR "decubitus ulcer") AND ("hydrocolloid" OR "occlusive dressing") AND ("foam dressing") AND ("wound healing" OR "ulcer healing")`
615
+
616
+ ## Levels of Evidence (Melnyk Hierarchy)
617
+
618
+ | Level | Study Type |
619
+ |-------|-----------|
620
+ | I | Systematic review / Meta-analysis of RCTs |
621
+ | II | Well-designed RCT |
622
+ | III | Controlled trial without randomisation |
623
+ | IV | Case-control or cohort study |
624
+ | V | Systematic review of descriptive/qualitative studies |
625
+ | VI | Single descriptive or qualitative study |
626
+ | VII | Expert opinion, clinical guidelines, consensus |
627
+
628
+ Always seek the **highest level of evidence** available for your question.
629
+
630
+ ## Related Articles
631
+ - [[Evidence-Based Practice - The Five Steps]]
632
+ - [[Critical Appraisal Tools]]
633
+ - [[Systematic Reviews and Meta-Analysis]]
634
+ - [[Database Searching for Nursing Research]]
635
+
636
+ ## References
637
+ - Melnyk, B.M. & Fineout-Overholt, E. (2019) *Evidence-Based Practice in Nursing & Healthcare*. 4th ed. Lippincott.
638
+ - Richardson, W.S. et al. (1995) The well-built clinical question: a key to evidence-based decisions. ACP Journal Club 123(3): A12.
639
+ """,
640
+ },
641
+ "person_centred_care": {
642
+ "title": "Person-Centred Care",
643
+ "category": "frameworks",
644
+ "tags": ["person-centred", "care", "framework", "mccormack", "dignity", "holistic"],
645
+ "last_updated": "2026-04-04",
646
+ "sources": ["built-in"],
647
+ "content": """# Person-Centred Care
648
+
649
+ **Person-centred care** places the individual — their values, preferences, and goals — at the centre of all care decisions. It is a core principle of the NMC Code, NHS Long Term Plan (2019), and Health Education England frameworks.
650
+
651
+ ## Core Principles
652
+
653
+ 1. **Respect for individuality**: Recognise each person's unique needs, values, beliefs, and preferences
654
+ 2. **Shared decision-making**: Involve people in decisions about their own care; provide information to enable informed choice
655
+ 3. **Therapeutic relationship**: Build trust through empathy, genuineness, and unconditional positive regard (Carl Rogers)
656
+ 4. **Holistic care**: Address physical, psychological, social, spiritual, and cultural needs
657
+ 5. **Continuity and coordination**: Ensure seamless care across settings and over time
658
+
659
+ ## McCormack & McCance Person-Centred Nursing Framework (2010, updated 2017)
660
+
661
+ Four constructs:
662
+
663
+ ### 1. Prerequisites (Nurse Attributes)
664
+ Professional competence, interpersonal skills, commitment to the job, clarity of beliefs and values, self-awareness.
665
+
666
+ ### 2. Care Environment
667
+ Appropriate skill mix, shared decision-making systems, effective staff relationships, supportive organisational systems, physical environment.
668
+
669
+ ### 3. Person-Centred Processes
670
+ - Working with the patient's beliefs and values
671
+ - Engaging authentically
672
+ - Being sympathetically present
673
+ - Sharing decision-making
674
+ - Providing holistic care
675
+
676
+ ### 4. Outcomes
677
+ Patient satisfaction, involvement in care, feeling of well-being, therapeutic culture.
678
+
679
+ ## Six Cs of Nursing (NHS, 2012 — Compassion in Practice)
680
+
681
+ | C | Definition |
682
+ |---|-----------|
683
+ | **Care** | Core business of nursing |
684
+ | **Compassion** | Empathy; how care is delivered |
685
+ | **Competence** | Technical and clinical skills + knowledge |
686
+ | **Communication** | Effective, clear, respectful |
687
+ | **Courage** | Doing the right thing; speaking up |
688
+ | **Commitment** | To patients, profession, and outcomes |
689
+
690
+ ## Barriers to Person-Centred Care
691
+ - Time pressures and high workloads
692
+ - Hierarchical institutional culture
693
+ - Lack of staff training in communication
694
+ - Electronic systems that depersonalise care
695
+ - Negative attitudes and burnout
696
+
697
+ ## Legal and Ethical Foundations
698
+ - **Mental Capacity Act 2005**: Presumption of capacity; involve people in decisions; best interests if no capacity
699
+ - **Human Rights Act 1998**: Article 8 (right to private and family life); Article 3 (freedom from degrading treatment)
700
+ - **Equality Act 2010**: Nine protected characteristics; duty to make reasonable adjustments
701
+
702
+ ## Related Articles
703
+ - [[The NMC Code]]
704
+ - [[Mental Capacity Act 2005]]
705
+ - [[Communication Skills in Nursing]]
706
+ - [[ADPIE - The Nursing Process]]
707
+ - [[Dignity in Care]]
708
+
709
+ ## References
710
+ - McCormack, B. & McCance, T. (2017) *Person-Centred Practice in Nursing and Health Care*. 2nd ed. Wiley-Blackwell.
711
+ - NHS England (2019) *The NHS Long Term Plan*. NHS England.
712
+ - Rogers, C. (1961) *On Becoming a Person*. Houghton Mifflin.
713
+ """,
714
+ },
715
+ "mental_capacity_act": {
716
+ "title": "Mental Capacity Act 2005",
717
+ "category": "law",
718
+ "tags": ["mental capacity", "law", "mca", "consent", "best interests", "deprivation of liberty"],
719
+ "last_updated": "2026-04-04",
720
+ "sources": ["built-in"],
721
+ "content": """# Mental Capacity Act 2005
722
+
723
+ The **Mental Capacity Act (MCA) 2005** is the legal framework for making decisions for people who may lack capacity to make decisions for themselves. It applies to everyone aged 16+ in England and Wales.
724
+
725
+ ## The Five Statutory Principles
726
+
727
+ 1. **A person must be assumed to have capacity** unless it is established otherwise
728
+ 2. **A person is not to be treated as unable to make a decision** unless all practicable steps to help them have been taken without success
729
+ 3. **A person is not to be treated as unable to make a decision** merely because they make an unwise decision
730
+ 4. **An act done or decision made** for a person who lacks capacity must be done in their **best interests**
731
+ 5. Before an act or decision is taken, regard must be had to whether the purpose can be as effectively achieved in a way that is **less restrictive** of the person's rights and freedom of action
732
+
733
+ ## Two-Stage Capacity Assessment
734
+
735
+ ### Stage 1: Is there an impairment or disturbance of mind or brain?
736
+ - Dementia, brain injury, mental health condition, delirium, unconsciousness, intoxication
737
+ - This is **time-specific** and **decision-specific**
738
+
739
+ ### Stage 2: Does the impairment affect their ability to make THIS decision?
740
+ A person lacks capacity if they cannot do **one or more** of:
741
+ - **Understand** the information relevant to the decision
742
+ - **Retain** that information long enough to make the decision
743
+ - **Use or weigh** the information as part of the decision-making process
744
+ - **Communicate** the decision (by any means)
745
+
746
+ **Document the assessment clearly in patient records.**
747
+
748
+ ## Best Interests Decision-Making
749
+
750
+ When a person lacks capacity, decisions must be made in their **best interests**:
751
+ - Consider the person's past and present wishes, feelings, values and beliefs
752
+ - Consult carers, family members, and anyone named by the person
753
+ - Consider less restrictive options
754
+ - Hold a **best interests meeting** for complex decisions
755
+
756
+ ## Key Roles
757
+
758
+ | Role | Who | Powers |
759
+ |------|-----|--------|
760
+ | **Lasting Power of Attorney (LPA)** | Appointed by person while capacitous | Health & welfare, property & finance (separate LPAs) |
761
+ | **Court-Appointed Deputy** | Appointed by Court of Protection | Usually property/finance; rarely health |
762
+ | **Independent Mental Capacity Advocate (IMCA)** | Statutory advocate | Serious medical treatment for unbefriended patients |
763
+
764
+ ## Deprivation of Liberty Safeguards (DoLS) / Liberty Protection Safeguards (LPS)
765
+
766
+ People in care homes and hospitals who lack capacity may be **deprived of their liberty** only under legal authorisation:
767
+ - **DoLS**: authorised by local authority; applies in care homes and hospitals
768
+ - **LPS**: replacing DoLS (planned but delayed); applies wider settings
769
+ - **Community Deprivation of Liberty**: requires Court of Protection order (Re X)
770
+
771
+ ## Advance Decisions
772
+
773
+ - **Advance Decision to Refuse Treatment (ADRT)**: legally binding refusal of specific treatment in specific circumstances, made while capacitous
774
+ - Must be in writing, signed, and witnessed for life-sustaining treatment
775
+ - **Advance Statement**: preferences; not legally binding but must be considered in best interests
776
+
777
+ ## Related Articles
778
+ - [[The NMC Code]]
779
+ - [[Consent in Nursing]]
780
+ - [[Person-Centred Care]]
781
+ - [[Safeguarding Adults]]
782
+ - [[Duty of Candour]]
783
+
784
+ ## References
785
+ - Mental Capacity Act 2005. legislation.gov.uk
786
+ - Department of Health (2005) *Mental Capacity Act Code of Practice*. The Stationery Office.
787
+ - NMC (2018) *The Code*. Section 4.2.
788
+ """,
789
+ },
790
+ "infection_control": {
791
+ "title": "Infection Prevention and Control",
792
+ "category": "safety",
793
+ "tags": ["infection control", "hand hygiene", "ppe", "standard precautions", "ipc", "hcai"],
794
+ "last_updated": "2026-04-04",
795
+ "sources": ["built-in"],
796
+ "content": """# Infection Prevention and Control
797
+
798
+ Infection Prevention and Control (IPC) is a fundamental nursing responsibility. Healthcare-associated infections (HCAIs) affect 1 in 15 NHS patients at any time (NICE, 2014).
799
+
800
+ ## Standard Precautions (apply to ALL patients, ALL the time)
801
+
802
+ Standard precautions assume that **all blood, body fluids, secretions, excretions, non-intact skin, and mucous membranes** may be infectious.
803
+
804
+ ### 1. Hand Hygiene — The Single Most Important IPC Measure
805
+
806
+ **WHO 5 Moments for Hand Hygiene:**
807
+ 1. **Before** patient contact
808
+ 2. **Before** a clean/aseptic procedure
809
+ 3. **After** body fluid exposure risk
810
+ 4. **After** patient contact
811
+ 5. **After** contact with patient surroundings
812
+
813
+ **Technique:**
814
+ - Alcohol-based handrub (ABHR): 20–30 seconds — preferred when hands are visibly clean
815
+ - Soap and water: 40–60 seconds — mandatory when hands are visibly soiled, before eating, and after caring for patients with *Clostridioides difficile* or *norovirus*
816
+
817
+ **Six-step technique** (Ayliffe method):
818
+ 1. Palm to palm
819
+ 2. Right palm over left dorsum (and vice versa)
820
+ 3. Palm to palm, fingers interlaced
821
+ 4. Backs of fingers to opposing palms (interlocked)
822
+ 5. Rotational rubbing of right thumb in left palm (and vice versa)
823
+ 6. Rotational rubbing of fingertips of right hand in left palm (and vice versa)
824
+
825
+ Nails kept short, no nail varnish or artificial nails, no rings/watches/bracelets.
826
+
827
+ ### 2. Personal Protective Equipment (PPE)
828
+
829
+ | Risk Level | Minimum PPE |
830
+ |-----------|-------------|
831
+ | Low risk (no contact with blood/body fluids) | Apron + gloves |
832
+ | Splash risk (procedures, wound care) | Apron + gloves + fluid-resistant surgical mask + eye protection |
833
+ | Aerosol Generating Procedure (AGP) | Gown + gloves + FFP3 respirator + eye protection |
834
+ | Contact precautions (MRSA, VRE) | Apron + gloves (+ gown for high risk) |
835
+
836
+ **Donning order**: Hand hygiene → gown → mask/respirator → eye protection → gloves
837
+ **Doffing order**: Gloves → hand hygiene → gown/apron → eye protection → mask → hand hygiene
838
+
839
+ ### 3. Safe Management of Sharps
840
+ - Never re-sheath needles
841
+ - Dispose of sharps at point of use into sharps bin (not more than ¾ full)
842
+ - Never pass sharps hand-to-hand
843
+ - Report needlestick injuries immediately: first aid (encourage bleeding, wash with running water), complete incident form, occupational health
844
+
845
+ ### 4. Waste Management
846
+ | Waste Type | Colour Code | Example |
847
+ |-----------|-------------|---------|
848
+ | Infectious clinical waste | Yellow | Dressings, PPE, used sharps |
849
+ | Cytotoxic/cytostatic | Purple | Chemotherapy waste |
850
+ | Domestic | Black/grey | Non-clinical waste |
851
+ | Confidential | Black (with marking) | Patient records |
852
+ | Sharps | Yellow sharps bin | All needles, blades |
853
+
854
+ ## Transmission-Based Precautions
855
+
856
+ Applied **in addition to** standard precautions for specific organisms:
857
+
858
+ | Route | Organisms | Additional Precautions |
859
+ |-------|-----------|----------------------|
860
+ | **Contact** | MRSA, VRE, *C. difficile*, scabies | Side room, dedicated equipment, gloves + apron |
861
+ | **Droplet** | Influenza, meningococcal, streptococcal | Side room, surgical mask, gloves + apron |
862
+ | **Airborne** | TB, measles, chickenpox, COVID-19 (AGP) | Negative pressure side room, FFP3 respirator |
863
+
864
+ ## Common HCAIs in the UK
865
+ - **MRSA** (Meticillin-resistant *Staphylococcus aureus*) — skin, surgical wounds, bloodstream
866
+ - **C. difficile** — antibiotic-associated diarrhoea; spore-forming; only soap and water (NOT ABHR)
867
+ - **CAUTI** — catheter-associated urinary tract infection; minimise catheter use
868
+ - **CLABSI** — central line-associated bloodstream infection; aseptic technique
869
+ - **SSI** — surgical site infection; pre-op bundles
870
+
871
+ ## Chain of Infection
872
+
873
+ Break **any** link to prevent infection:
874
+ ```
875
+ Infectious agent → Reservoir → Portal of exit → Mode of transmission → Portal of entry → Susceptible host
876
+ ```
877
+
878
+ ## Related Articles
879
+ - [[Hand Hygiene - WHO Technique]]
880
+ - [[Catheter Care (CAUTI Prevention)]]
881
+ - [[MRSA Management]]
882
+ - [[C. difficile Management]]
883
+ - [[Sepsis Recognition and Management]]
884
+
885
+ ## References
886
+ - WHO (2009) *Guidelines on Hand Hygiene in Health Care*. WHO Press.
887
+ - NICE (2014, updated 2017) *NG125: Healthcare-associated infections: prevention and control in primary and community care*.
888
+ - NHS England (2022) *National Infection Prevention and Control Manual (NIPCM)*. england.nhs.uk
889
+ """,
890
+ },
891
+ "duty_of_candour": {
892
+ "title": "Duty of Candour",
893
+ "category": "safety",
894
+ "tags": ["duty of candour", "candour", "openness", "transparency", "incident", "apology", "francis"],
895
+ "last_updated": "2026-04-04",
896
+ "sources": ["built-in"],
897
+ "content": """# Duty of Candour
898
+
899
+ **Duty of Candour** is the professional and statutory obligation to be open and honest with patients when things go wrong. It was introduced following the **Francis Report (2013)** into Mid Staffordshire NHS Foundation Trust.
900
+
901
+ ## Two Layers of Duty
902
+
903
+ ### 1. Professional Duty (NMC, individual nurses)
904
+ Under the **NMC Code (2018)**, all registered nurses must:
905
+ - Act without delay if they believe that there is a risk to patient safety (clause 16)
906
+ - Raise and escalate concerns immediately (clause 17)
907
+ - Be open and honest and act with integrity (clause 23)
908
+ - Be open and candid with the people in their care — including when things go wrong (clause 24)
909
+
910
+ ### 2. Statutory Duty (NHS organisations)
911
+ Under **Regulation 20** of the Health and Social Care Act 2008 (Regulated Activities) Regulations 2014, NHS trusts must, as soon as reasonably practicable after a **notifiable safety incident**:
912
+ 1. Notify the patient (or their representative) in person
913
+ 2. Provide a written **apology** (an apology is not an admission of legal liability)
914
+ 3. Provide a truthful account of all that is known about the incident
915
+ 4. Explain what enquiries are being undertaken
916
+ 5. Follow up in writing
917
+
918
+ ## What is a Notifiable Safety Incident?
919
+ An incident that, in the reasonable opinion of a registered professional, could result in (or has resulted in) **moderate harm, severe harm, prolonged psychological harm, or death**.
920
+
921
+ ## What Duty of Candour Requires in Practice
922
+
923
+ 1. **Tell the patient** what happened as soon as possible after the incident
924
+ 2. **Apologise**: "I am sorry this happened" — this is **not** an admission of liability
925
+ 3. Provide **truthful information** about what happened and what is being done
926
+ 4. **Do not mislead** patients — even by omission
927
+ 5. **Document** all communications with the patient regarding the incident
928
+ 6. **Support the patient** — identify what support is available
929
+
930
+ ## Barriers to Candour (why it sometimes fails)
931
+ - Fear of litigation
932
+ - Fear of disciplinary action
933
+ - Institutional culture of blame
934
+ - Lack of training in disclosure conversations
935
+ - Hierarchy and power imbalances
936
+
937
+ ## Supporting Framework: SBAR + Datix
938
+ - Use **SBAR** to escalate concerns
939
+ - Complete a **Datix** (or equivalent incident report) contemporaneously
940
+ - Involve the **PALS** (Patient Advice and Liaison Service) if appropriate
941
+
942
+ ## Related Articles
943
+ - [[The NMC Code]]
944
+ - [[Incident Reporting (Datix)]]
945
+ - [[Patient Safety Culture]]
946
+ - [[Safeguarding Adults]]
947
+
948
+ ## References
949
+ - Francis, R. (2013) *Report of the Mid Staffordshire NHS Foundation Trust Public Inquiry*. The Stationery Office.
950
+ - NMC (2018) *The Code*, clause 24.
951
+ - CQC (2014) *Regulation 20: Duty of Candour*. legislation.gov.uk
952
+ """,
953
+ },
954
+ "ebp_framework": {
955
+ "title": "Evidence-Based Practice — The Five Steps",
956
+ "category": "evidence",
957
+ "tags": ["ebp", "evidence-based", "clinical question", "pico", "research", "sackett"],
958
+ "last_updated": "2026-04-04",
959
+ "sources": ["built-in"],
960
+ "content": """# Evidence-Based Practice — The Five Steps
961
+
962
+ **Evidence-Based Practice (EBP)** is "the conscientious, explicit and judicious use of current best evidence in making decisions about the care of individual patients" (Sackett et al., 1996). It integrates:
963
+ - **Best available external evidence** (research)
964
+ - **Clinical expertise** (professional judgement)
965
+ - **Patient preferences and values**
966
+
967
+ ## The Five-Step EBP Process
968
+
969
+ ### Step 1: Ask — Formulate the Clinical Question
970
+ Convert the clinical problem into a searchable, answerable question using **PICO** (or PICOT/PEO for qualitative questions).
971
+
972
+ **Example**: "In adults with type 2 diabetes (P), does structured self-management education (I) compared to standard care (C) improve glycaemic control (HbA1c) (O) over 12 months (T)?"
973
+
974
+ ### Step 2: Acquire — Search for Evidence
975
+ Search databases systematically:
976
+ - **MEDLINE/PubMed** (biomedical literature)
977
+ - **CINAHL** (nursing and allied health)
978
+ - **Cochrane Library** (systematic reviews)
979
+ - **NICE Evidence** (clinical guidelines)
980
+ - **BNF** (pharmacological evidence)
981
+ - **NHS Evidence / OpenAthens**
982
+
983
+ Apply filters: date, language, study type, human subjects.
984
+
985
+ ### Step 3: Appraise — Critical Appraisal
986
+ Evaluate the evidence for **validity, importance, and applicability**:
987
+ - **CASP tools** (Critical Appraisal Skills Programme): RCT checklist, systematic review checklist, qualitative checklist
988
+ - **GRADE framework**: quality of evidence — High / Moderate / Low / Very Low
989
+ - **Cochrane Risk of Bias tool** (for RCTs)
990
+ - **Newcastle-Ottawa Scale** (for cohort/case-control studies)
991
+
992
+ Key appraisal questions:
993
+ 1. Is the study design appropriate for the question?
994
+ 2. Are the methods valid and the results reliable?
995
+ 3. What are the results, and are they clinically significant?
996
+ 4. Are the results applicable to my patient?
997
+
998
+ ### Step 4: Apply — Integrate Evidence with Clinical Expertise and Patient Values
999
+ - Integrate the evidence with your clinical experience
1000
+ - Discuss evidence with the patient: their preferences, circumstances, and values must be considered
1001
+ - Consider local factors: resources, trust protocols, patient population
1002
+ - Share decision-making
1003
+
1004
+ ### Step 5: Evaluate — Assess the Outcome
1005
+ - Monitor patient outcomes after applying the evidence
1006
+ - Audit clinical practice against the evidence
1007
+ - Share findings with colleagues (clinical governance, journal clubs)
1008
+ - Feed back into the EBP cycle
1009
+
1010
+ ## Levels of Evidence
1011
+ See [[PICO Framework]] for Melnyk's seven-level hierarchy.
1012
+
1013
+ ## EBP in the NMC Standards
1014
+ - **Platform 1** (Accountable Professional): practise in line with best available evidence
1015
+ - **Platform 3** (Assessment): use evidence-based assessment tools
1016
+ - **Platform 6** (Safety & Quality): contribute to clinical audit and quality improvement
1017
+
1018
+ ## Related Articles
1019
+ - [[PICO Framework for Evidence-Based Practice]]
1020
+ - [[Critical Appraisal Tools (CASP)]]
1021
+ - [[Systematic Reviews and Meta-Analysis]]
1022
+ - [[Clinical Guidelines — NICE, SIGN, BTS]]
1023
+
1024
+ ## References
1025
+ - Sackett, D.L. et al. (1996) Evidence based medicine: what it is and what it isn't. BMJ 312: 71–72.
1026
+ - Melnyk, B.M. & Fineout-Overholt, E. (2019) *Evidence-Based Practice in Nursing & Healthcare*. 4th ed. Lippincott.
1027
+ - CASP (2022) *Critical Appraisal Skills Programme checklists*. casp-uk.net
1028
+ """,
1029
+ },
1030
+ "safeguarding": {
1031
+ "title": "Safeguarding Adults and Children",
1032
+ "category": "law",
1033
+ "tags": ["safeguarding", "abuse", "neglect", "children", "adults", "law", "section 47"],
1034
+ "last_updated": "2026-04-04",
1035
+ "sources": ["built-in"],
1036
+ "content": """# Safeguarding Adults and Children
1037
+
1038
+ Safeguarding is everyone's responsibility. Nurses have a statutory and professional duty to recognise, report, and respond to abuse and neglect.
1039
+
1040
+ ## Safeguarding Adults
1041
+
1042
+ ### Legal Framework
1043
+ - **Care Act 2014**: Local authorities have a duty to investigate safeguarding concerns for adults at risk
1044
+ - **Care and Support Statutory Guidance (2014, updated 2023)**
1045
+ - **Mental Capacity Act 2005**: Protects people who lack capacity
1046
+
1047
+ ### Who is an Adult at Risk?
1048
+ An adult (18+) who:
1049
+ - Has care and support needs (regardless of whether they receive services)
1050
+ - Is experiencing, or is at risk of, abuse or neglect
1051
+ - Cannot protect themselves because of their care and support needs
1052
+
1053
+ ### Types of Abuse (Care Act 2014)
1054
+ 1. Physical abuse
1055
+ 2. Domestic violence/abuse
1056
+ 3. Sexual abuse
1057
+ 4. Psychological/emotional abuse
1058
+ 5. Financial/material abuse
1059
+ 6. Modern slavery
1060
+ 7. Discriminatory abuse
1061
+ 8. Organisational/institutional abuse
1062
+ 9. Neglect and acts of omission
1063
+ 10. Self-neglect
1064
+
1065
+ ### The Six Principles of Adult Safeguarding
1066
+ **Empowerment, Prevention, Proportionality, Protection, Partnership, Accountability**
1067
+
1068
+ ### Making a Safeguarding Referral (Adults)
1069
+ 1. Identify concern — use SBAR to articulate
1070
+ 2. Inform your manager/senior immediately
1071
+ 3. Do not investigate yourself
1072
+ 4. Make a referral to the local authority safeguarding team
1073
+ 5. Document the concern clearly and factually
1074
+ 6. If immediate danger: call 999 first
1075
+
1076
+ ## Safeguarding Children
1077
+
1078
+ ### Legal Framework
1079
+ - **Children Act 1989**: "Children's welfare is paramount"
1080
+ - **Children Act 2004**: Section 11 — duty to cooperate to safeguard children
1081
+ - **Working Together to Safeguard Children (2023)**: Multi-agency guidance
1082
+ - **Keeping Children Safe in Education (2023)**
1083
+
1084
+ ### Categories of Abuse (Children)
1085
+ 1. Physical abuse
1086
+ 2. Emotional abuse
1087
+ 3. Sexual abuse
1088
+ 4. Neglect
1089
+
1090
+ ### Child Protection Process
1091
+ 1. **Concern**: Nurse identifies signs/disclosure of abuse
1092
+ 2. **Report**: Immediately to Named Nurse for Safeguarding or manager
1093
+ 3. **Section 47 enquiry**: Local authority + police investigate (if child at risk of significant harm)
1094
+ 4. **Child Protection Conference**: Multi-agency decision
1095
+ 5. **Child Protection Plan**: If child needs ongoing protection
1096
+
1097
+ ### Signs of Abuse — General Indicators
1098
+ - Unexplained injuries or bruising inconsistent with explanation
1099
+ - Changes in behaviour (withdrawal, aggression, fearfulness)
1100
+ - Disclosure — always take seriously and never promise confidentiality
1101
+ - Signs of neglect (poor hygiene, hunger, inappropriate clothing)
1102
+ - Sexualised behaviour beyond developmental stage
1103
+
1104
+ ## What to Do If Someone Discloses
1105
+
1106
+ 1. **Listen** — do not interrupt or ask leading questions
1107
+ 2. **Believe** — take the disclosure seriously
1108
+ 3. **Reassure** — tell them they were right to tell you
1109
+ 4. **Explain confidentiality limits** — you must share information to protect them
1110
+ 5. **Report immediately** — inform manager/senior; make a safeguarding referral
1111
+ 6. **Document** — verbatim what was said, using the person's own words
1112
+ 7. **Do not investigate or confront** the alleged abuser
1113
+
1114
+ ## Related Articles
1115
+ - [[The NMC Code]]
1116
+ - [[Mental Capacity Act 2005]]
1117
+ - [[Duty of Candour]]
1118
+ - [[GDPR and Patient Confidentiality]]
1119
+
1120
+ ## References
1121
+ - Care Act 2014. legislation.gov.uk
1122
+ - HM Government (2023) *Working Together to Safeguard Children*. gov.uk
1123
+ - NMC (2018) *The Code*, clause 17.
1124
+ """,
1125
+ },
1126
+ },
1127
+ "log": [
1128
+ "## [2026-04-04] system | Nursing Knowledge Base initialised with 14 starter articles across 6 categories."
1129
+ ],
1130
+ "index_summary": """# Nursing Knowledge Base — Index
1131
+
1132
+ This wiki covers core nursing knowledge aligned with NMC Standards of Proficiency (2018).
1133
+
1134
+ ## Categories
1135
+
1136
+ ### standards
1137
+ - **[[The NMC Code]]** — Four themes: prioritise people, practise effectively, preserve safety, promote professionalism
1138
+ - **[[NMC Standards of Proficiency 2018]]** — Seven platforms + Annexes A and B; registration requirements
1139
+
1140
+ ### clinical
1141
+ - **[[ABCDE Assessment Framework]]** — Systematic approach: Airway, Breathing, Circulation, Disability, Exposure
1142
+ - **[[NEWS2 - National Early Warning Score]]** — Seven-parameter early warning score; escalation thresholds
1143
+ - **[[ADPIE - The Nursing Process]]** — Assessment, Diagnosis, Planning, Implementation, Evaluation
1144
+
1145
+ ### pharmacology
1146
+ - **[[The Nine Rights of Medication Administration]]** — Patient, Drug, Dose, Route, Time, Documentation, Reason, Response, Refusal
1147
+ - **[[Drug Calculations]]** — Tablets, liquids, IV rate, drip rate, weight-based, concentration formulae
1148
+
1149
+ ### evidence
1150
+ - **[[PICO Framework for Evidence-Based Practice]]** — Formulating clinical questions; Melnyk evidence hierarchy
1151
+ - **[[Evidence-Based Practice — The Five Steps]]** — Ask, Acquire, Appraise, Apply, Evaluate (Sackett)
1152
+
1153
+ ### frameworks
1154
+ - **[[Person-Centred Care]]** — McCormack & McCance framework; Six Cs; MCA, Human Rights Act
1155
+
1156
+ ### safety
1157
+ - **[[Infection Prevention and Control]]** — Standard precautions, hand hygiene (5 moments), PPE, transmission routes
1158
+ - **[[Duty of Candour]]** — Professional and statutory duty; Francis Report; what to say and do
1159
+
1160
+ ### law
1161
+ - **[[Mental Capacity Act 2005]]** — Five principles, two-stage capacity test, best interests, DoLS/LPS
1162
+ - **[[Safeguarding Adults and Children]]** — Care Act 2014, Children Act 1989, types of abuse, referral processes
1163
+ """,
1164
+ "sources": {},
1165
+ "metadata": {
1166
+ "created": "2026-04-04",
1167
+ "version": "1.0",
1168
+ "article_count": 14,
1169
+ "organisation": "Nursing Citizen Development Organisation",
1170
+ },
1171
+ }
1172
+
1173
+
1174
+ def get_starter_wiki():
1175
+ """Return a deep copy of the starter wiki."""
1176
+ import copy
1177
+ return copy.deepcopy(STARTER_WIKI)