Lotus AI Logo 

Generate.ts

Forms API

Forms in Lotus are represented as Questionnaire FHIR objects. Our REST API for forms includes default options, checks for minimum requirements, and ensures that forms are securely attached to the correct users. This guarantees that all information remains private and secure.

Read more about the Forms API.

This endpoint contains a function createPDF that is used to generate a PDF document from a given questionnaire response. The function uses four parameters:

data, patient_id, form_id, and questionnaire.

data is of type RequestData and represents the response to the questionnaire.

patient_id is a string representing the ID of the patient.

form_id is a string representing the ID of the form.

questionnaire is an optional parameter of type Questionnaire.

The function uses the pdfMake library to create the PDF document. The structure of the document is defined in docDefinition, which includes the title of the questionnaire and the answers to the questionnaire items. The answers are obtained by calling the getAnswer function to parse the specific integration, for each item in data.item.

The createPDF function returns an object containing the created PDF and any potential error. If the environment is set to 'development', the function will return the PDF and null for the error.

In our production environment, the function will send the PDF to ClaimPower to make it available for the doctor and patient.

Workflow

Create Form: Use the POST /api/forms endpoint to create a new form.

Generate Link: Generate a unique link for the patient to fill out the form.

Submit Response: When the patient submits the form, the QuestionnaireResponse items are collected.

Generate PDF: The createPDF function is called to convert the QuestionnaireResponse items into a PDF.

Send to ClaimPower: The generated PDF is sent to ClaimPower for further processing.

Preview

Preview the PDF for a QuestionnaireResponse using this url:


https://dev.lotuscares.ai/api/claimpower/forms/pdf/{questionnaire_response.id}

CPT Codes

When a patient completes some screenings, it allows the doctor to bill the insurance company for the services provided. The CPT codes are used to identify the services provided to the patient.

The Questionnaire object can be configured to include the CPT codes, and the type of algorithm used to calculate which CPT codes are applicable to the operation.


  /** Using a single method we determine if the form is eligible to send a billing request, and perform it */
  SendCPTIfApplicable({ patient_id: claimpower_patient_id, claimpower_db_name, }, questionnaire);