npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vironix-schema

v1.1.0

Published

A kit for creating web and mobile app surveys based on FHIR questionnaires

Downloads

1

Readme

Vironix FHIR Schema

A kit for creating web and mobile app surveys based on FHIR questionnaires.

How it works

The FormHandler handles the interaction with the with an FHIR questionnaire. It has minimal exposed methods to allow for simple integration. It will store the answers submitted to the FormHandler and return the next question calculated based on the enableWhen defined in each question.

API

The following methods are exposed:

  • hasStarted(): Boolean. Returns true if the questionnaire has been started, otherwise false.
  • start(): GetQuestionResult. Starts the questionnaire and returns the next question (Item) and a value indicating whether there are any more questions.
  • getNextQuestion(): GetQuestionResult. Saves the answer to the current question and returns the next question (if there are questions left) and a value indicating whether there are any more questions.
  • getPreviousQuestion(): GetQuestionResult. Navigates backwards to the previous question and returns the question and a value indicating whether there are any more questions.
  • getAnswers(): QuestionnaireAnswers. Returns the currently answered questions and status.

Conditional Questions

Questions will be returned in the same order they have been defined in the questionnaire, unless the question is only enabled based on previously answered questions. Conditional questions are defined using a list of enableWhen conditions inside of the form. The enableWhen is defined using the following schema:

export type EnableWhen = {
  question: string;
  operator: "exists" | "=" | "!=" | ">" | "<" | ">=" | "<=" | "in" | "notin";
  answer: any;
};

Properties:

  • question. This is the Id of the question on which to apply the condition.
  • operator. The type of condition to apply.
    • exists. This will return true if the specified question has been answered.
    • =. Compares the answer specified in this enableWhen to the answer supplied in the specified question.
    • !". Checks to see if the answer specified in this enableWhen does not equal the answer supplied in the specified question.
    • >. Checks to see if the answer specified in this enableWhen is greater than the answer supplied in the specified question.
    • <. Checks to see if the answer specified in this enableWhen is smaller than the answer supplied in the specified question.
    • >=. Checks to see if the answer specified in this enableWhen is greater or equal to the answer supplied in the specified question.
    • <=. Checks to see if the answer specified in this enableWhen is smaller or equal to the answer supplied in the specified question.
    • in. Checks to see if the answer specified in this enableWhen is in the choices in the supplied answer. Note: This condition can only be used when the question type of the specified question is choice and the uiType is checkbox.
    • notin. Checks to see if the answer specified in this enableWhen is not in the choices in the supplied answer. Note: This condition can only be used when the question type of the specified question is choice and the uiType is checkbox.
  • answer. The supplied answer that will be the source of comparison.

Questionnaire Schema

Here is the schema definition for a Questionnaire / Form. This is the schema you expect to be returned by the Vironix API when you request a questionnaire.

Form

export type Form = {
  id: string;
  version: string;
  name: string;
  title: string;
  status: "draft" | "active" | "retired" | "unknown";
  date: Date;
  description: string;
  items: [Item];
};

Item

export type Item = ItemBase & {
  subItems?: SubItem[];
};

ItemBase

export type ItemBase = {
  linkId: string;
  text: string;
  type:
    | "group"
    | "boolean"
    | "decimal"
    | "integer"
    | "date"
    | "datetime"
    | "time"
    | "string"
    | "text"
    | "url"
    | "choice";
  uiType: "slider" | "radio" | "checkbox" | "input" | "select";
  enableWhens?: EnableWhen[];
  enableWhenBehavior?: "all" | "any";
  uiOptions?: UiOptions;
  answerOptions?: AnswerOption[];
  units?: Units[];
  code?: Code | Code[] | null;
  required?: Boolean;
  skipLogic?: SkipLogic[];
};

SubItem

export type SubItem = ItemBase;

EnableWhen

Conditions that if met, the question item is displayed. Otherwise, it is skipped and we move onto the next question.

The "in", ">", "<=" operators are commonly used.

export type EnableWhen = {
  question: string;
  operator: "exists" | "=" | "!=" | ">" | "<" | ">=" | "<=" | "in" | "notin";
  answer: any;
};

UiOptions

export type UiOptions = {
  min?: number;
  max?: number;
  interval?: number;
  length?: number;
};

AnswerOption

export type AnswerOption = {
  text: string; // Display text
  code: Code | null; // code to send back
  value: any | null; // value associated with choice; not always present
};

Units

export type Units = {
  name: string;
  text: string;
  uiOptions?: UiOptions | null;
  code: Code | null;
};

Code

export type Code = {
  code: string;
  codeSystem: string;
};

SkipLogic

Conditions that if met, will result in terminating the questionnaire early and sending back responses up to this point.

export type SkipLogic = {
  operator: "exists" | "=" | "!=" | ">" | "<" | ">=" | "<=" | "in" | "notin";
  answer: any;
  skipTo: "end";
  unitName?: string;
};

Questionnaire Response Schema

This is the schema that is produced by the SDK, and is sent back to the Vironix API for processing

QuestionnaireAnswers

export declare class QuestionnaireAnswers {
  questionnaireId: Number; // Obtained from Form.id
  questionnaire_name: string; // Obtained from Form.name
  questionnaire_version: string; // obtained from Form.version
  authored: Date; // Timestamp when submitted
  status: QuestionnaireStatus;
  items: Answer[]; // answers of the questionnaire, structured like how it is  presented within the Form
}

QuestionnaireStatus

For most use-cases, please set to completed when sending back to the API.

export declare type QuestionnaireStatus =
  | "in-progress"
  | "completed"
  | "amended"
  | "stopped"
  | "entered-in-error";

Answer

export declare class Answer {
  question: string; // from Item.linkId
  value: any;
  type: string; // from Item.type
  uiType: string | undefined; // from Item.uiType
  code?: Code | Code[] | undefined | null; // from Item.code
}