Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

About:Pharmacopedia.ext: Difference between revisions

From Pharmacopedia
[checked revision][checked revision]
Terminology sweep (site-wide): drug/medication → medicine
Terminology: medicine → med (shorter form per user preference)
Line 6: Line 6:
'''Source:''' <code>/var/www/mediawiki/extensions/Pharmacopedia/</code>
'''Source:''' <code>/var/www/mediawiki/extensions/Pharmacopedia/</code>


The Pharmacopedia extension turns a MediaWiki install into a structured, community-edited medicine reference. It adds parser tags, special pages, API modules, and a database schema that together support:
The Pharmacopedia extension turns a MediaWiki install into a structured, community-edited med reference. It adds parser tags, special pages, API modules, and a database schema that together support:


* Structured medicine pages via the <code>{{tlx|MedTemplate}}</code> template
* Structured med pages via the <code>{{tlx|MedTemplate}}</code> template
* Per-user rating, voting, and reporting on effects, indications, titration strategies, anecdotes, and interactions
* Per-user rating, voting, and reporting on effects, indications, titration strategies, anecdotes, and interactions
* Two-perspective data capture (personal vs. provider) wherever clinically meaningful
* Two-perspective data capture (personal vs. provider) wherever clinically meaningful
* Curated medicine-class categories used as interaction endpoints
* Curated med-class categories used as interaction endpoints
* A verified-provider role with document-based verification
* A verified-provider role with document-based verification


Line 40: Line 40:
| <code>&lt;anecdote&gt;</code> || Personal or provider story with up/down vote || <code>AnecdoteTag</code>
| <code>&lt;anecdote&gt;</code> || Personal or provider story with up/down vote || <code>AnecdoteTag</code>
|-
|-
| <code>&lt;indication&gt;</code> || Condition the medicine is used for, 0–5 likert rating || <code>IndicationTag</code>
| <code>&lt;indication&gt;</code> || Condition the med is used for, 0–5 likert rating || <code>IndicationTag</code>
|-
|-
| <code>&lt;pharmaInteractions/&gt;</code> || Self-closing; renders the Interactions section for the current page || <code>InteractionTag</code>
| <code>&lt;pharmaInteractions/&gt;</code> || Self-closing; renders the Interactions section for the current page || <code>InteractionTag</code>
Line 138: Line 138:
== Interactions feature ==
== Interactions feature ==


The Interactions section is rendered by placing <code>&lt;pharmaInteractions/&gt;</code> anywhere in the wikitext of a medicine article ('''NS_MAIN''') or a Category page ('''NS_CATEGORY''').
The Interactions section is rendered by placing <code>&lt;pharmaInteractions/&gt;</code> anywhere in the wikitext of a med article ('''NS_MAIN''') or a Category page ('''NS_CATEGORY''').


=== Entity model ===
=== Entity model ===


An interaction is an undirected edge between two endpoints. Each endpoint has a '''type''' (<code>medicine</code> or <code>category</code>) and a '''slug''' (DB-key form of the page title).
An interaction is an undirected edge between two endpoints. Each endpoint has a '''type''' (<code>med</code> or <code>category</code>) and a '''slug''' (DB-key form of the page title).


Pairs are stored in canonical order: smaller <code>(type, slug)</code> tuple on the left. This collapses A↔B and B↔A into a single row.
Pairs are stored in canonical order: smaller <code>(type, slug)</code> tuple on the left. This collapses A↔B and B↔A into a single row.
Line 152: Line 152:
   pi_id              auto-increment
   pi_id              auto-increment
   pi_element_id      FK -> pcp_votable_elements (reuse votes/comments infra)
   pi_element_id      FK -> pcp_votable_elements (reuse votes/comments infra)
   pi_left_type      'medicine' | 'category'
   pi_left_type      'med' | 'category'
   pi_left_slug      VARBINARY(255)
   pi_left_slug      VARBINARY(255)
   pi_right_type      'medicine' | 'category'
   pi_right_type      'med' | 'category'
   pi_right_slug      VARBINARY(255)
   pi_right_slug      VARBINARY(255)
   pi_created_user_id INT
   pi_created_user_id INT
Line 174: Line 174:
=== Rendering rules ===
=== Rendering rules ===


* On a '''medicine''' page M, list:
* On a '''med''' page M, list:
** Direct edges: rows where M is one side.
** Direct edges: rows where M is one side.
** Transitive edges: rows where one side is a category C that M is itself a member of (via MW's <code>categorylinks</code>).
** Transitive edges: rows where one side is a category C that M is itself a member of (via MW's <code>categorylinks</code>).
Line 186: Line 186:
Triggered by the <code>+ Add interaction</code> button at the bottom of the section. Two-stage UX:
Triggered by the <code>+ Add interaction</code> button at the bottom of the section. Two-stage UX:


# Search input → results split into '''Medicines''' (teal chip) and '''Categories''' (amber chip).
# Search input → results split into '''Meds''' (teal chip) and '''Categories''' (amber chip).
# Click <code>Use</code> → confirm via <code>Add interaction</code> button → POST to <code>pharmacopediainteractionadd</code>.
# Click <code>Use</code> → confirm via <code>Add interaction</code> button → POST to <code>pharmacopediainteractionadd</code>.