About:Pharmacopedia.ext: Difference between revisions
From Pharmacopedia
More actions
| [checked revision] | [checked revision] |
MDElliottMD (talk | contribs) 0.9.8.7 Security section: correct live TLS config (HIGH:!aNULL, TLS1.0/1.1 allowed), fix LocalSettings.php owner (root:www-data), AbuseFilter 2/2 enabled, OATHAuth 5 recovery codes, HSTS preload pending |
MDElliottMD (talk | contribs) 0.9.8.7 close-out: hold-to-expand + vote removal + editor tools (boss-claude) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 6: | Line 6: | ||
* Structured medicine pages via the <code><nowiki>{{MedTemplate}}</nowiki></code> template | * Structured medicine pages via the <code><nowiki>{{MedTemplate}}</nowiki></code> template | ||
* Per-user rating on effects, problems, titration strategies, anecdotes, and drug-drug interactions (continuous 0–100 sliders, ±100 valence; no 0–5 likert anywhere) | * Per-user rating on effects, problems, titration strategies, anecdotes, and drug-drug interactions (continuous 0–100 sliders, ±100 valence; no 0–5 likert anywhere); ratings use a hold-to-expand star widget (300 ms press, spring animation, drag-commit with pixel-travel + value-delta guards); voters can remove their own committed rating | ||
* Binary AND choice/multi voting on arbitrary content (<code>type="single"</code> / <code>type="multi"</code> with 2-5 options, results-visibility policy per element) | * Binary AND choice/multi voting on arbitrary content (<code>type="single"</code> / <code>type="multi"</code> with 2-5 options, results-visibility policy per element) | ||
* Two-perspective data capture (personal vs. provider) wherever clinically meaningful | * Two-perspective data capture (personal vs. provider) wherever clinically meaningful | ||
| Line 39: | Line 39: | ||
* '''Backend (PHP):''' <code>includes/</code>, one class per parser tag, store, special page, or API module. Auto-loaded under <code>MediaWiki\Extension\Pharmacopedia\</code>. Assessment classes under <code>includes/Assessments/</code>. API modules under <code>includes/Api/</code>. | * '''Backend (PHP):''' <code>includes/</code>, one class per parser tag, store, special page, or API module. Auto-loaded under <code>MediaWiki\Extension\Pharmacopedia\</code>. Assessment classes under <code>includes/Assessments/</code>. API modules under <code>includes/Api/</code>. | ||
* '''Frontend (JS / CSS):''' multiple ResourceModules per surface area: | * '''Frontend (JS / CSS):''' multiple ResourceModules per surface area: | ||
** <code>ext.pharmacopedia</code>: main IIFE (chip-picker, dx autocomplete, BFI-10 compute, vote logic for both binary and choice/multi) | ** <code>ext.pharmacopedia</code>: main IIFE (chip-picker, dx autocomplete, BFI-10 compute, vote logic for both binary and choice/multi, hold-to-expand star rating model with spring animation and drag-commit, vote removal) | ||
** <code>ext.pharmacopedia.styles</code>: base extension stylesheet (self-hosted Geist / Newsreader / Source Serif fonts, core component styling) | ** <code>ext.pharmacopedia.styles</code>: base extension stylesheet (self-hosted Geist / Newsreader / Source Serif fonts, core component styling) | ||
** <code>ext.pharmacopedia.blocksave</code>: debounced autosave per block (race-safe) | ** <code>ext.pharmacopedia.blocksave</code>: debounced autosave per block (race-safe) | ||
| Line 49: | Line 49: | ||
** <code>ext.pharmacopedia.perspective</code>: observer-perspective form enhancement (slider readout, progress, consent/delete confirm) | ** <code>ext.pharmacopedia.perspective</code>: observer-perspective form enhancement (slider readout, progress, consent/delete confirm) | ||
** <code>ext.pharmacopedia.administer</code>: the administer-to-others surfaces (take-flow slider readout + "Not sure" toggling, owner-hub styling) | ** <code>ext.pharmacopedia.administer</code>: the administer-to-others surfaces (take-flow slider readout + "Not sure" toggling, owner-hub styling) | ||
** <code>ext.pharmacopedia.editor</code>: editor enhancements loaded on <code>action=edit/submit</code>; smart paste converts bare PMID or DOI from the clipboard into a formatted <code><ref></code> tag (PubMed eutils / CrossRef); house-rules linter flags banned terms and em-dashes on submit with a dismissable warning; quick-ref stub (Ctrl+Alt+R) inserts a journal-article <code><ref></code> skeleton | |||
** <code>ext.pharmacopedia.observation</code>: quick-add observation textarea + live preview | ** <code>ext.pharmacopedia.observation</code>: quick-add observation textarea + live preview | ||
** <code>ext.pharmacopedia.refupgrade</code>: bulk linker for free-text → structured refs | ** <code>ext.pharmacopedia.refupgrade</code>: bulk linker for free-text → structured refs | ||
| Line 377: | Line 378: | ||
Server-side aggregates: <code>n</code>, mean of the rating field, and (for interactions) <code>severe = (vmean ≤ −83.0)</code> (rescaled from the original ±3-scale −2.5). Aggregates are recomputed and returned by every report-submit API call so the row re-renders in place without a page reload. | Server-side aggregates: <code>n</code>, mean of the rating field, and (for interactions) <code>severe = (vmean ≤ −83.0)</code> (rescaled from the original ±3-scale −2.5). Aggregates are recomputed and returned by every report-submit API call so the row re-renders in place without a page reload. | ||
=== Hold-to-expand rating interaction === | |||
All <code>.pcp-rate</code> widgets (Common Uses stars, problem-tag stars, any future star widget) use a hold-to-expand pattern for precise rating. A 300ms press scales the widget toward a 483px target with a spring curve (<code>cubic-bezier(0.34, 1.56, 0.64, 1)</code>); drag while expanded commits on release when BOTH gates pass: pixel-travel >= 16px AND value-delta >= 0.2 on the 0-5 scale. A miss commits nothing; the widget springs back. Keyboard while expanded: arrow keys step +/- 0.2, Enter/Space commits, Escape cancels. | |||
Reduced-motion (<code>prefers-reduced-motion</code>) drops the spring scale; the hold-and-drag gesture is preserved. | |||
Vote-position marker: a third Unicode-star row clipped via <code>clip-path</code> inset, rendered in hot-pink (#ff2d78) stroke, shows the user's own committed vote distinct from the aggregate mean. Updates inline when the user re-rates. | |||
Drag-path performance: <code>requestAnimationFrame</code> throttle plus cached widget bounds eliminate per-pointermove layout reads. Mobile parity: touch events (<code>touchstart</code>/<code>touchmove</code>/<code>touchend</code>) wired alongside pointer events. Companion CSS in <code>resources/ext.pharmacopedia.css</code> (~159 lines). | |||
=== Vote removal === | |||
Voted state exposes a two-row layout via <code>.pcp-rate-row-top</code> (mean + n) and <code>.pcp-rate-row-bot</code> (voter's own value in hot-pink + 28px remove button). Row-bot hides cleanly when <code>data-voted</code> is absent so unvoted widgets render as a single line. | |||
Clicking remove fires <code>POST action=pharmacopedialikert</code> with <code>vote=remove</code>. On 200: <code>data-voted</code> clears, the clip-path vote-position marker resets, <code>data-agg-n</code> decrements, the <code>localStorage</code> cache key is removed, and an <code>aria-live</code> region announces Your rating has been removed. | |||
Two-row layout mirrors the PCPapp treatment for visual parity across web and mobile. | |||
== Effect bucketing == | == Effect bucketing == | ||
| Line 752: | Line 771: | ||
Scroll position is preserved across the rare reloads (delete operations on diagnoses / medicines / experience reports, and the auto-reload after a new diagnosis or medicine is added) via <code>sessionStorage</code> (the <code>ext.pharmacopedia.bounceback</code> module). | Scroll position is preserved across the rare reloads (delete operations on diagnoses / medicines / experience reports, and the auto-reload after a new diagnosis or medicine is added) via <code>sessionStorage</code> (the <code>ext.pharmacopedia.bounceback</code> module). | ||
== Editor tools == | |||
Three contributor-facing tools loaded as <code>ext.pharmacopedia.editor</code> on <code>action=edit</code> and <code>action=submit</code> via <code>Hooks::onBeforePageDisplay()</code>. | |||
=== Smart paste === | |||
When the clipboard contents on paste is a bare PMID (7-8 digits) or DOI (<code>10.xxxx/...</code>), the module intercepts and expands it to a formatted <code><ref></code> tag. PubMed eutils resolves PMIDs; CrossRef resolves DOIs. Expansion is structured (author, year, title, journal, vol/issue, pages, doi/pmid). A brief toast confirms the substitution; the original paste is preserved if either API call fails. | |||
=== House-rules linter === | |||
On form submit, the linter strips <code><ref></code> blocks and HTML comments to avoid false positives, then scans the remaining edit body for banned terms (<code>drug</code>, <code>medication</code>, <code>antipsychotic</code>, <code>stimulant</code>) and em-dashes. When matches surface, a non-modal warning panel highlights the offending lines and offers "Save anyway" or "Go back and edit." House rules are advisory, never blocking; the linter is a friction layer that nudges, not a gate. | |||
=== Quick-ref stub === | |||
<code>Ctrl+Alt+R</code> inserts a <code><ref name="...">{{cite journal | author= ... | year= ... | title= ... | journal= ... | volume= ... | pages= ... | pmid= ... | doi= ... }}</ref></code> skeleton at the cursor, with the cursor positioned at the <code>author=</code> field for direct typing. | |||
== Special pages == | == Special pages == | ||