A line containing calculation descriptions
Extends React.PureComponent
Detects if we're on a device where the primary input method is through a touchscreen.
This uses CSS media queries to check if we have an accurate pointing device, if we don't that means that the user does not have a mouse, and we thus assume that the user is on a touch screen (even though it could mean that the user is on some device where the input method is not as accurate as a mouse, but still isn't touch, like for instance when using a nintendo wii controller as input).
This function falls on the side of caution, so for instance on IE11 it will always return false because the media query is unavailable,
boolean
A collection of helper functions that can be used to identify the device or mode that we're running in
Detects if we're on a device where the primary input method is through a touchscreen.
This uses CSS media queries to check if we have an accurate pointing device, if we don't that means that the user does not have a mouse, and we thus assume that the user is on a touch screen (even though it could mean that the user is on some device where the input method is not as accurate as a mouse, but still isn't touch, like for instance when using a nintendo wii controller as input).
This function falls on the side of caution, so for instance on IE11 it will always return false because the media query is unavailable,
boolean
The medSynonyms redux state
(string)
The dictionary redux state
(string)
The global search redux state
(string)
The global pleiar redux state
The external resources redux state
This is a union type that accepts either a string or an event.
Type: (string | SyntheticEvent<HTMLInputElement>)
This is an object that is used to build the union in BPValuesType. It is also used to build BPValues, which is probably what you're after.
Shared nutricalc redux state
((number | ""))
This performs feature detection on an element. It checks if a "token list" (like the a element's rel= attribute) supports a specific value, for instance if it supports rel="noopener".
(DOMTokenList)
(string)
boolean
Performs rel="" feature detection on the anchor element
(string)
boolean
Age groups for nutricalcreq
Type:
("18-30" | "31-69" | "70+")
The nutricalc bmi redux state
((number | ""))
Redux action. Sets the search string for searching the medSynonyms
(string)
medSynonymsAction
Redux action. Sets the search string for searching the dictionary
(string)
dictionaryAction
Removes all markdown formatting from a string
(string)
string
This is used to define elements for SimpleAccordion
Type: Array<{header: string, render: (React.Node | string)}>
The medcalc redux infusion state
Applies workarounds for Microsoft browsers. Sets the ms-workarounds and
either ms-edge or ms-ie classes on the body (for applying CSS
workarounds) and polyfills a missing Number.parseFloat in IE.
Redux action that sets the value of one of the input fields in the nutricalc-req calculator
"ageGroup" | "patientState" | "temp"), value: (number | "" | nutriCalcReqAgeGroup | nutriCalcReqPatientState)): nutriCalcReqAction(("ageGroup" | "patientState" | "temp"))
((number | "" | nutriCalcReqAgeGroup | nutriCalcReqPatientState))
nutriCalcReqAction
Redux action that toggles display of the food list in the nutricalc
nutriCalcDayAction
Redux action. Sets the BP value for the NEWS calculator
(string)
newsAction
Redux action that sets the search string for searches using the global search function
(string)
globalSearchAction
Redux action that toggles rounding of numbers
globalAction
Redux action that sets the content (in ml) of the infusion
((number | ""))
medCalcInfusionAction
Redux action that sets the weight of a patient
((number | ""))
nutriCalcSharedAction
Redux action that sets the height of a person
((number | ""))
nutriCalcBMIAction
Helper function that retrieves a string value, given either a string, or a SyntheticEvent. Used to be able to treat an event or a string interchangably, so that for instance a function can accept both an event (ie. be triggered by a input field) and a string (value provided by us by manually calling it).
((string | SyntheticEvent<HTMLInputElement>))
string
T he nutricalc-day redux state
Redux action that sets the search string for searches through the external resources list.
(string)
externalResourcesAction
This provides some static helper functions for formatting and parsing numbers.
This parses a ReduxEventOrString and then hands it off to
numbers.parseFloatish.
(ReduxEventOrString)
("" | number)
This parses a ReduxEventOrString, hands it off to numbers.parseFloatish
and then ensures that it is within the range supplied. If it is below the range,
it sets it to min, if it is above the range it sets it to max.
If it's an empty string, that's just returned directly.
"" | number)("" | number)
This does basically the same thing as parseFloatishFromThing, but it guarantees that it will return a number (or NaN).
((number | ReduxEventOrString))
number
A third variant of parseFloatishFromThing. This one will return zero if it ends up with a string
((number | string | SyntheticEvent<HTMLInputElement>))
number
A signle dictionary entry
Renders a single entry in the dictionary
Props:
Extends React.PureComponent
Metadata returned from a lunr search
Medcalc redux state
(medCalcInfusionState)
Signature/type for the generic redux callbacks that accept either an event object or a string
Type: function (ReduxEventOrString): void
The type for the LabValueGenericNotices object
({})
The Pleiar.no free software infromation page
Extends React.PureComponent
Patient states for nutricalcreq
Type:
("bed" | "up" | "building")
Actions accepted by the medSynonyms reducer
("MEDSYNONYMS_SET_SEARCH_STRING")
(string)
Actions accepted by the dictionary reducer
("DICT_SET_SEARCH_STRING")
(string)
The actions accepted by the global search redux reducer
("GLOBAL_SEARCH_SET_SEARCH_STRING")
(string)
This is a global helper object that can be used to generate slugs. Uses
github-slugger to generate the slugs.
Caveat: You must make sure that no code that you are calling is also
generating slugs at the same time, since you then may end up with
inconsistent slugs (see the docs for reset().
A single entry used for OptionSelector. (this is explicitly not exact, so that any of our users can use a datastructure that they already have other items in)
Type: string
Actions accepted by the nutriCalcShared redux reducer
("NUTRICALC_SHARED_SET_WEIGHT")
((number | ""))
Actions accepted by the external resources reducer
Type:
({type: "EXT_RES_SET_SEARCH_STRING", search: string} | {type: "EXT_RES_TOGGLE_ONLYNORWEGIAN"})
Base class for Handbook* objects. Provides shared methods for looking up objects.
Retrieves the root datastructure for this Handbook class. You can override this in a subclass to override the datastructure that is being used.
HandbookDataStructure
Retrives the HandbookIndex variant for this Handbook variant. You can override this in a subclass to override which object gets created.
(HandbookPath)
HandbookIndex
Retrives the HandbookEntry variant for this Handbook variant. You can override this in a subclass to override which object gets created.
(HandbookPath)
HandbookEntry
Looks up a single entry from the handbook based upon a path. Will always either return the entry or null, it will not return an index entry (use _lookupIndex for that)
(HandbookPath)
(HandbookDataEntry | null)
Looks up a single index entry from the handbook based upon a path. Will always either return the entry or null, it will not return an actual entry (use _lookupEntry for that)
(HandbookPath)
(HandbookDataStructure | null)
The method that powers the other _lookup* methods. Will iterate through the datastructure to find 'path' and return it. It is up to the caller to determine if the path is a HandbookDataEntry or a HandbookDataStructure.
This method should not be called by any subclasses directly.
(HandbookPath)
(HandbookDataEntry | HandbookDataStructure | null)
Locates the toplevel parent of this entry. Toplevel parent is the highest entry in the tree except the root element.
Returns this if it is the toplevel parent.
Type: HandbookIndex
HandbookIndex
Stubbed path
Type: HandbookPath
HandbookPath
This is the end result that we return (in the form of an array of searchSnippetComponents)
Type:
({type: "normal", str: string} | {type: "highlight", str: string} | {type: "delimiter"})
The informational message displayed in the home page
Extends React.PureComponent
Actions accepted by the global state reducer
(("TOGGLE_FORMULA_VISIBILITY" | "TOGGLE_ROUNDING"))
Actions accepted by the nutriCalcBMI reducer
("NUTRICALC_BMI_SET_HEIGHT")
((number | ""))
Represents a single "index" entry in the quickref. That is, an entry that contains other entries. The quickref only contains one level, so this should always be the root of the tree.
Extends HandbookIndex
Retrieves the root datastructure for QuickRef entries
HandbookDataStructure
Retrives the HandbookIndex variant for this Handbook variant: QuickRefIndex
(HandbookPath)
QuickRefIndex
Retrives the HandbookEntry variant for this Handbook variant: QuickRefEntry
(HandbookPath)
QuickRefEntry
Renders the front page info text
Extends React.PureComponent
({})
A helper component that updates the title of the page. Accepts an optional title parameter. If this is provided then the title will be set to "Pleiar.no - TITLE". Otherwise it will be set to "Pleiar.no".
({title: string?})
null
Fields for nutricalcreq that accepts non-boolean values
Type:
("ageGroup" | "patientState" | "temp")
Props for SimpleAccordion
(AccordionElements)
(boolean?)
Root of the nutricalc component.
Extends React.PureComponent
Props for the NEWS class
(function (string): void)
(function (string): void)
(function (string): void)
(function (string): void)
(function (string): void)
(function (string): void)
(function (): void)
(function (): void)
Props for StructuredData when type="auto"
(boolean)
("auto")
The component that renders our 404 message.
Extends React.PureComponent
(NotFoundProps)
Type for BP values
Type: $Keys<any>
nutricalc redux state
(nutriCalcDayState)
(nutriCalcReqState)
(nutriCalcBMIState)
(nutriCalcSharedState)
A calculator result that returns a result property and a <CalcExplanation>
(number)
(React.Element<any>?)
Displays an "authentication failed" message
Extends React.PureComponent
Actions accepted by the nutriCalcDay redux reducer
Type:
({type: "NUTRICALC_DAY_TOGGLE_FOODLIST"} | {type: "NUTRICALC_DAY_SET_ENTRY_VALUE", entryNo: number, key: string, val: string} | {type: "NUTRICALC_DAY_SET_MINIMUM", minimum: (number | "")} | {type: "NUTRICALC_DAY_REMOVE_ENTRY", entryNo: number} | {type: "NUTRICALC_DAY_RESET"})
Redux action that sets the value of a line in the nutrition calculator
nutriCalcDayAction
Redux action that toggles the visibility of formulas
globalAction
Redux action that sets the number of minutes the infusion is to be given over
((number | ""))
medCalcInfusionAction
The stored datatype for a singe line in the nutricalc-day calculator
Fields for nutricalcreq that accepts boolean values
Type:
("febrile" | "skinny")
Actions accepted by the medcalc infusion reducer
Type:
({type: "MEDCALC_INFUSION_SET_CONTENT", content: (number | "")} | {type: "MEDCALC_INFUSION_SET_HOURS", hours: (number | "")} | {type: "MEDCALC_INFUSION_SET_MINUTES", minutes: (number | "")} | {type: "MEDCALC_INFUSION_SET_MODE", mode: ("ml/t" | "dråpar/sek")} | {type: "MEDCALC_INFUSION_TOGGLE_ADDITIONAL_CALCULATIONS"})
A normal header generator that also adds a slug (id) if it can
Extends React.PureComponent
Displays the score of a completed quiz
Extends React.Component
Redux action that sets the value of one of the boolean fields in the nutricalc-req calculator
(("febrile" | "skinny"))
nutriCalcReqToggleAction
Redux action that toggles display of only Norwegian entries in the external resources list
externalResourcesAction
This is the index used to indicate the location of a string that should be highlighted
Datastructure returned from lunr for a single search, and therefore also
from PleiarSearcher
(string)
({metadata: lunrMetadata})
The quickref search result renderer
Extends React.PureComponent
Render an accordion, which is a set of Collapse elements that are managed together so that only one is open.
Extends React.PureComponent
(SimpleAccordionProps)
The list of OptionSelectorEntry items that is used by @{link OptionSelector}.
Type: (Array<OptionSelectorEntry> | NEWSOptionList)
A single entry in the search index
A single entry in the search index
The data structure used to store DictionaryEntry items
Type: Array<DictionaryEntry>
A constant list of generic notices that apply to specific groups of lab values. This is used both when rendering a single cleartext element and when rendering tables.
Type: LabValueNoticeType
A rendering component that can render a HandbookEntry with a
searchSnippet, which is an array of searchSnippetComponents that
helper.lunrSnippet has built.
Extends React.PureComponent
nutriCalcReq redux state
(nutriCalcReqAgeGroup)
(nutriCalcReqPatientState)
(boolean)
(boolean)
(number)
Props for StructuredData when type="article"
Displays a line containing the language of an ExternalResourcesEntry, if
that language is not Norsk.
Extends React.PureComponent
Global pleiar redux state
(nutriCalcState)
(medCalcState)
(externalResourcesState)
(dictionaryState)
(globalSearchState)
(newsState)
(medSynonymsState)
(globalState)
A calculator result that returns a result property and a description array
of <CalcExplanationLine>s
(number)
(CalcExplanationLineArray)
This is the container each tool should wrap itself in. It functions like
<MainContainer>, but this expects a <MainContainer> to exist as its
parent already, so it won't do much other than return a div with a class set
and a navigation link. It will also wrap it in <RequiresAuth> unless
you pass requiresAuth={false}.
Extends React.PureComponent
The required props to render any subcomponent of OptionSelector (and thus also OptionSelector)
Redux action. Sets the BP value for the NEWS calculator
(string)
newsAction
Renders a single ATC code
Extends React.PureComponent
Lowest level of a CalcExplanationLine, outputs the column if needed
Extends React.PureComponent
This is a more complete replacement for <abbr>, providing the same
functionality through a reactstrap <Tooltip>, which also permits things
like embedding react elements within the definition.
Props:
Extends React.PureComponent
Redux action that sets the number of hours the infusion is to be given over
((number | ""))
medCalcInfusionAction
A <Link> wrapper that returns links relative to /ordliste/
Extends React.PureComponent
The signature for the callback called when a line is updated
This is the list of all apps that should be displayed in the menu
The name is the label, id is the path, route is the route if it can not be inferred and exact is a boolean specifying if the exact prop needs to be supplied to react-router
Type: appList
Redux action that removes a line from the nutrition calculator
(number)
nutriCalcDayAction
This is a "base" object that you can add to another object to add functionality to that object to asynchronously load some data.
It expects the following methods, with these exact signatures, to be present in any object that consumes it:
_performAsyncImport() - This should return the promise from the import call, like: import(/* webpackChunkName: "search-index", webpackPreload: true * / '../data/search-index.json').
_loadedData(data) - this gets the data structure once it has been loaded.
Type: asyncLoaderRoleType
Must be overridden by consumer
Must be overridden by consumer
Subscribes to an "on-initialize" event. Each callback will be called when the initialize() promise resolves (but it won't trigger an initialize() call). If we have already been initialized, the function is executed immediately.
(function (): any)
This is a class that wraps anchor-elements that link to external websites.
The default is to open those in a new tab. This exposes us to security risks because of window.opener (see https://mathiasbynens.github.io/rel-noopener/). The workaround for this is to add rel="noopener" to anchor elements. However, this is not supported in all browsers, so we need to add rel="noreferrer" as well, which isn't actually what we want to do. Thus this wrapper element will detect if noopener is supported, and if it is we will use noopener without noreferrer. Otherwise we will use both noopener and noreferrer.
If you don't want to open in a new tab, specify sameWindow={true}, this reverts ExternalLink to work just like a regular anchor.
basicStyle makes the generated -element not have the class "external-link". This is useful when the child is an image, or when you just want to style some link like any other. Note that sameWindow={true} implicitly enables basicStyle.
In addition to the props it directly supports, namely href, and the internal
"sameWindow", and child elements, it will also pass on arbitrary props to
the a-element.
Extends React.PureComponent
This is the main container for the app. All toplevel components must use this to ensure that the design is correct and that the page title gets updated
Extends React.Component
This is an object that is used to build the union in pulseValuesType. It is also used to build pulseValues, which is probably what you're after.
This is a container used to indicate a single sentence of text that should be highlighted.
The root component for the medcalc page.
This handles rendering the base UI, setting the page title correctly and passing control off to the actual calculator components
Extends React.PureComponent
A single external resource entry
Renders a single entry in the external resources list
Extends React.PureComponent
Type for the react-select options object
MedSearcher is the search wrapper for the medication synonyms data. This is different from PleiarSearcher. PleiarSearcher uses lunr to index everything on the site, except for medications. This class uses a fairly dumb method of searching through the medication list.
Type: QuizDataManagerType
The data structure, a QuizDataContainer
Retrieve the quiz data
QuizDataContainer
_performAsyncImport method for asyncLoaderRole
Promise<null>
_loadedData method for asyncLoaderRole
(QuizDataContainer)
A single result from getResultFromRef
Type:
({type: "dictionary", dictionary: DictionaryEntry} | {type: "externalResources", externalResources: ExternalResourcesEntry} | {type: "labValue", labValues: LabValueEntry} | {type: "handbook", handbook: HandbookEntry} | {type: "tool", tool: ToolListEntry} | {type: "nutrition", nutrition: NutritionInfoEntry} | {type: "external", external: ExternallyIndexedItem} | {type: "quickref", quickref: QuickRefEntry} | {type: "quiz", quiz: SearchMetadataEntry})
Props for StructuredData
Type: (StructuredDataAutoProps | StructuredDataArticleProps)
nutriCalcReq actions that toggle boolean fields
Type:
({type: "NUTRICALC_REQ_TOGGLE", field: "febrile"} | {type: "NUTRICALC_REQ_TOGGLE", field: "skinny"})
The Pleiar.no quickref index/list renderer
Extends React.PureComponent
State for the NEWS class
(boolean)
Props for NutriCalcBMI
(any)
(any)
A constant list of "material shorthand" to "material full name" values. This is used both when rendering a single cleartext element and when rendering tables.
Method that performs the actual indexing. This has no data import of its own, so you have to supply all of the datastructures yourself.
(ExternalResourcesDataStructure)
(DictionaryDataStructure)
(LabValueDataStructure)
(HandbookDataStructure)
(ToolsListDataStructure)
(NutritionDataStructure)
(ExternallyIndexedList)
(HandbookDataStructure)
(QuizDataContainer)
LunrObject
This constructs the actual index, providing data and title maps
to indexFromSource.
({external: ExternalResourcesDataStructure, dict: DictionaryDataStructure, labValues: Array<LabValueEntry>, handbook: HandbookDataStructure, tools: ToolsListDataStructure, nutrition: NutritionDataStructure, externallyIndexed: ExternallyIndexedList, quickref: HandbookDataStructure, indexer: LunrObject, quizData: QuizDataContainer})
Adds tools to the index
(LunrObject)
(ToolsListDataStructure)
Adds externally indexed items to the index
(LunrObject)
(ExternallyIndexedList)
Adds nutrition data to the index
(LunrObject)
(NutritionDataStructure)
Recursively indexes the handbook datastructure
"handbook" | "quickref"))(LunrObject)
((HandbookDataEntry | HandbookDataStructure))
(("handbook" | "quickref"))
Adds a single data source to the index, based upon the fields provided.
({source: (Array<ExternalResourcesEntry> | Array<DictionaryEntry> | Array<LabValueEntry>), indexer: LunrObject, titleField: string, descriptionField: string?, descriptionMarkdown: boolean?, keywordField: string?, urlField: string?, sourceName: string, alternateKeywords: string?})
Adds tools to the index
(LunrObject)
(QuizDataContainer)
Redux action that changes the mode of the calculator
(("ml/t" | "dråpar/sek"))
medCalcInfusionAction
This renders structured data for this entry.
Extends React.PureComponent
Component used to render results from the nutrition database in search results
Extends React.PureComponent
Props for Pleiar
(ReduxStore<pleiarReduxState, {}>)
(pleiarReduxState?)
Renders a list of suggested search phrases
Extends React.PureComponent
Actions accepted by the nutriCalcReq redux reducer
Type:
(nutriCalcReqToggleAction | {type: "NUTRICALC_REQ_SET", field: "ageGroup", value: nutriCalcReqAgeGroup} | {type: "NUTRICALC_REQ_SET", field: "patientState", value: nutriCalcReqPatientState} | {type: "NUTRICALC_REQ_SET", field: "temp", value: number})
A basic authentication helper. It stores authentication state between sessions, and performs validation of authentication (JWT) tokens. It can then be queried at any point for the actual authentication state (by calling isAuthenticated).
TODO: Verify JWT TODO: Store authentication state TODO: Whitelist bots
Type: AuthObjType
This method initializes an auth object. It will load auth state (if any).
Invalidates the current login, regardless of current state
Returns the error that caused authenticate() not to succeed, or null if 1) the user is authenticated, or 2) we don't have an error.
The error is of the type AuthError (or null)
(AuthError | null)
Redux action that changes the minimum kcal required in the nutrition calculator
((number | ""))
nutriCalcDayAction
A lunrResultSnippet object represents a single search result
(string)
(lunrMetadata)
This returns a "generic" text snippet from the body that we were provided. This is used in cases where none of the hits were in the body (but in other fields), so that we return something in those cases as well.
Array<searchSnippetComponent>
Locates a single highlight snippet in the body, then expands from there to find the start and end of the sentence of said snippet, finally it returns a singleSnippetContainer. If the snippet provided is already within anoter, previously found snippet (in the alreadyFound array), then it will latch on to that singleSnippetContainer by appending to its highlight array instead and will then return null.
(singleSnippetContainer | null)
This builds a single array of searchSnippetComponents from an array of singleSnippetContainers.
It splits up all strings into "normal" (non-higlighted) text components, "highlight" (highlighted, ie. render in bold) text components, and "delimiter" indicators (which is where something like "(…)" should appear).
(Array<singleSnippetContainer>)
Array<searchSnippetComponent>
Retrieves a snippet tree for this lunrResultSnippet instance
Array<searchSnippetComponent>
This provides various system information, useful for debugging
Extends React.PureComponent
This component is used by OptionSelector to render a set of options as a select-element. This is considered an implementation detail of OptionSelector, and you should only use OptionSelector directly, never OptionSelectorRadioButtons. You can tell OptionSelector that you only want select-element.
Extends React.Component
Render the component
React.Node
Type for pulse values
Type: $Keys<any>
The external resources data structure
Type: Array<ExternalResourcesEntry>
Object that handles platform detection, support for and triggering of app installation events.
App installation, or "add to homescreen" functionality is not in any way
standardized. As such it differs from browser to browser. Chrome exposes an
API for triggering it, while Firefox on Android as well as Safari require the
user to do so themselves. Therefore, on those browsers, the user has to be
presented with installation instructions. See the docs for trigger.
Type: appInstallMembers
Adds a listening callback that gets called if the canInstall() status changes. This is a no-op in anything but Chrome.
(function (): void)
Returns the installation mode, that is how an app will be installed.
null means that we think it can't be installed, "chrome" uses the
Chrome API, while firefox-android and safari-ios respectively refer
to the browsers' manual installation method
appInstallModes
Initializes event handlers. Should only ever be called once, and should be called as early as possible in the app lifetime so that no events are missed. This is a no-op on anything but Chrome.
Returns a boolean. true if we can be installed as an app (and we're
not already running in app mode), false otherwise. Note that in
Chrome this can change if Chrome is still installing event handlers.
Thus you should .listen() as well, to ensure you pick up any changes.
boolean
Triggers installation of an app. It returns true if the installation was successfully triggered. If it returns false, then this is a browser that can't do native installation, and you should redirect the user to browser-specific instructions for installing as an app.
The flow should be:
.mode()boolean
A