Skip to content

Translating prior auth forms with ChatGPT4

1anja1 edited this page Feb 29, 2024 · 1 revision

Getting Started

To translate a prior auth pdf form to a FHIR Shorthand Questionnaire follow the steps below:

  1. Upload the following files and paste the following prompt into ChatGPT4: example prior auth form pdf (MBODA) example fsh result (MBODA) Prompt:
First I will explain the goal and give you some manually created examples. The goal is to translate pdf prior auth forms to FSH files that can be used to generate a FHIR Questionnaire resource that represents all the questions and information contained in the pdf forms. Analyze the given pdf and FSH file. Pay close attention to sections/groups, items, conditionals - hiding/showing of items, structure, etc.

Later on, I will ask you to apply the knowledge you gained from inspecting the examples to new prior auth forms. You will be asked to translate the new pdf into a FSH file just like it was done in the example.

Note: Better results if pasting the content of the FSH file after the prompt - often fails to read .fsh files. If reading the .fsh file fails instead of uploading it, copy the content of the file into the prompt.

  1. Upload the pdf of the new form that should be translated and enter the following prompt:
Use the previously provided translated FSH file as a template and perform the translation on the given prior auth form. Adhere to the following principles:

Identifying Sections and Items: Break down the form into sections (e.g., Patient Information, Provider Information, Medication Information) and items within those sections (e.g., Patient Name, DOB, Medication Name).

Creating Questionnaire Items: For each form item, create corresponding Questionnaire items in FSH, specifying the item type (e.g., string, choice, date), linkId, and text (question). Make sure to remember to include groups for the sections and to include * item[+] before each new item. Include a "*  insert QuestionnaireItemInitialExpression("")" for each item so that it can later be prefilled automatically.

Conditional Items: Pay close attention to complex sections or where conditional logic might be required (e.g., showing/hiding fields based on previous answers).

Give the full FSH file including all items from the prior auth form - don't leave out any sections. 

For rather complex forms with conditional fields, single choices, open choices, etc. - point these out and specify how they should be translated at the end of the given prompt. This will lead to more accurate initial results and less need to give additional prompts for improvement.

Important: If the results are not as expected refer to the Notes and Troubleshooting sections of this guide.

Note: If the result does not include the RuleSets from the example FSH File copy these to the beginning of the new FSH Questionnaire.

Several prior auth forms by the same provider

The best results can be achieved if several forms are from the same provider and have a similar structure. Then simply paste the new form into the same chat with the following prompt:

Thank you for creating and updating the .fsh file for my prior auth form. Please repeat the same process and create the fsh file for this new form with a similar layout. 

Note: For even better results if manual changes were made before pasting the new form paste the final version of the fsh with the following prompt:

I have made some manual adaptations to the .fsh file. This is the final version. Review the changes that were made and remember them for application in future questionnaires.

Creating Template Definitions of the Initial Expressions

To ease the process of quickly creating the CQL initial expressions to populate the questionnaire, this command can be used to quickly and effectively generate the definitions of the necessary CQL expressions:

[Paste the final version of the FHS here]

Create a list of all initial expressions from the created Questionnaire in the following format:

define "[replace this with the initial expression1]":
define "[replace this with the initial expression2]":
...

These definitions can then easily be filled with the actual logic for each expression while reducing errors from mismatches between the name of the initial expression in the questionnaire vs. in the CQL.

Troubleshooting:

If the QuestionnaireItemInitialExpressions are missing:

Add "QuestionnaireItemInitialExpression" to each item that is not a group as shown in this short example:
* item[+]
	*  insert  QuestionnaireItem(#group, "patient-info", "Patient  Information")
	* item[+]
		*  insert  QuestionnaireItemInitialExpression("Patient  Name")
		*  insert  QuestionnaireItem(#string, "patient-info|name", "Patient  name")
	* item[+]
		*  insert  QuestionnaireItemInitialExpression("Date  of  Birth")
		*  insert  QuestionnaireItem(#date, "patient-info|dob", "DOB")

If the * item[+] are missing:

Include * item[+] for each item as shown in this example:
* item[+]
	*  insert  QuestionnaireItem(#group, "patient-info", "Patient  Information")
	* item[+]
		*  insert  QuestionnaireItemInitialExpression("Patient  Name")
		*  insert  QuestionnaireItem(#string, "patient-info|name", "Patient  name")
	* item[+]
		*  insert  QuestionnaireItemInitialExpression("Date  of  Birth")
		*  insert  QuestionnaireItem(#date, "patient-info|dob", "DOB")

If #boolean is used instead of a choice type:

Please update any boolean items with a choice with the options yes and no. Use valueCoding.code and valueCoding.display for each answerOption.

If choices don't have codings:

Please give me an updated version of my fsh that includes valueCoding.code and valueCoding.display for each answerOption:

If conditional fields weren't translated correctly:

Incorporate conditional fields using "QuestionnaireEnableWhen" for [conditional items] that depend on [item name] to be [value] .

If choices/open choices aren't translated properly:

Turn item [item name] into a choice type with the options that are given in the pdf. 

or specify the options in the prompt to be more precise.

If parts are omitted with comments such as "//Additional items go here":

Please provide a FSH script with all items specified in full detail. Do not omit any.

Note:

  • ChatGPT4 is only available in the premium version. ChatGPT3 is not able to process images or files so ChatGPT4 is necessary to translate the prior auth forms.
  • Especially data types need to be double-checked since they are often not adapted to the actual value for the field (e.g. string for everything)
  • Sometimes the required answers would be too long (this can be identified by responses that end in the middle of a line/sentence). In this case, it is easier to specify which part of the form to translate first. This also makes it easier to improve these sections until the desired result is achieved. - Here it can also be useful to take screenshots of part of the form and have it only translate that specific part of the form, especially if a part is very complicated.
  • In most cases, the result won't be one perfect answer - the best approach is to copy the parts of the answer that have already been done correctly and iteratively prompt the AI to improve upon certain areas that have errors while saving the correct parts from each iteration in a separate file containing the pieces for the final version. Often while prompted to improve on one area other parts that were previously done correctly can contain errors again so this iterative copy approach is the easiest way to get results for longer, more complex problems.
  • If the results are consistently bad or a mistake is not corrected even after specifying what exactly should be changed in several messages, it can help to take a small part, make the correct adaptations manually and then feed it back to the AI as an example that can be applied to the rest of the result.
  • If no improvement can be achieved it can be a good idea to start over with a new chat.
  • If there are errors when trying to translate the resulting FSH script they can simply be copied and used as a next prompt to have the AI try and fix the errors if they are not obvious or tedious to fix.
  • A common mistake made by ChatGPT4 is to include special characters in the strings which causes errors to be thrown when translating the FSH to a FHIR Resource for example when () or ' , ' are used within the name.

Tools to use:

Disclaimer:

All AI generated content needs to be checked for correctness and accuracy.

Example chat history:

To get a better idea of the requests and responses in a real translation scenario, the ChatGPT4 conversations for 2 prior auth forms can be viewed by clicking the links below. (To view the chats a ChatGPT account is required - no premium version necessary for viewing the chats.)

OpdivoQuestionnaire: https://chat.openai.com/share/4f673ad9-a444-448b-89df-edb379c4cbef

CornealCrossslinkQuestionnaire: https://chat.openai.com/share/84baf34a-568c-4649-92f8-99b0e3793550