diff --git a/easydistill/mmkd/create_question_answering_pairs.py b/easydistill/mmkd/create_question_answering_pairs.py index c788aa3..ac7c1a1 100644 --- a/easydistill/mmkd/create_question_answering_pairs.py +++ b/easydistill/mmkd/create_question_answering_pairs.py @@ -1,12 +1,14 @@ import json -import re +import numpy as np +import argparse +import os def load_prompt_templates(filepath): """Loads the prompt templates from a JSON file.""" try: with open(filepath, "r", encoding="utf-8") as f: - return json.load(f) + return json.load(f)["templates"] except FileNotFoundError: print(f"Error: The file {filepath} was not found.") return None @@ -78,44 +80,131 @@ def get_label_from_prompt(question, data, templates): return {"error": "No matching prompt found."} +def match_question_to_template( + templates: str, + language: str, + system_prompt: str, + json_schema: dict, + label: dict, + media_dir: str, +): + # Preparing system prompt + conversations = [{"role": "system", "content": system_prompt}] + + # Preparing user prompt + # Select randomly from the template list + template = np.random.choice(templates) + + selected_field_list = template["target_keys"] + # select field from json_schema + prompt_object = {} + for field in selected_field_list: + prompt_object[field] = json_schema["properties"][field] + prompt_object_string = json.dumps(prompt_object, indent=4) + + user_question = f"""Extract the following structured information from the provided invoice. Fill in only existing values. +Strictly return a valid JSON following this schema: + +**Json schema** +{prompt_object_string} +""" + fns = os.listdir(media_dir) + image_paths = [] + if "image" in label: + image_substring = label["image"] + for fn in fns: + if image_substring in fn: + image_paths.append(media_dir + fn) + elif "image_files" in label: + for image_path in label["image_files"]: + if os.path.exists(media_dir + image_path): + image_paths.append(media_dir + image_path) + else: + return None + else: + return None + + image_contents = [ + {"type": "image", "image": image_path} for image_path in image_paths + ] + user_contents = image_contents + [ + {"type": "text", "text": "" * len(image_contents) + user_question}, + ] + user_object = {"role": "user", "content": user_contents} + conversations.append(user_object) + + # Preparing assistant output + object_label = {} + for field in selected_field_list: + if field in label["label"]: + object_label[field] = label["label"][field] + else: + object_label[field] = None + assistant_object = { + "role": "assistant_gt", + "content": [ + { + "type": "text", + "text": json.dumps(object_label, indent=4), + } + ], + } + conversations.append(assistant_object) + + return conversations + + +def prepare_vqa( + label_json_path: str, + prompt_template_path: str, + system_prompt_path: str, + json_schema_path: str, + media_dir: str, + output_vqa_json_path: str, +): + try: + label_data = json.load(open(label_json_path)) + + prompt_templates = load_prompt_templates(prompt_template_path) + with open(system_prompt_path) as system_prompt_file: + system_prompt = system_prompt_file.read() + + with open(json_schema_path) as json_schema_file: + json_schema = json.load(json_schema_file) + except Exception as e: + print(f"Error: {e}") + return + + vqa = [] + for label in label_data: + # random select 5 question answer pairs from the templates in english + for _ in range(10): + vqa_object = match_question_to_template( + prompt_templates, "en", system_prompt, json_schema, label, media_dir + ) + if vqa_object is not None: + vqa.append(vqa_object) + + with open(output_vqa_json_path, "w") as output_file: + output_file.write(json.dumps(vqa, indent=4)) + + # --- Main execution --- if __name__ == "__main__": - label_data = json.load( - open( - "/home/nguyendc/model-factory/Finetuning-Automation/etc/data/media/docai_mgp_facture_v2_1/label_data.json" - ) + argparser = argparse.ArgumentParser() + argparser.add_argument("--label_json_path", type=str) + argparser.add_argument("--prompt_template_path", type=str) + argparser.add_argument("--system_prompt_path", type=str) + argparser.add_argument("--json_schema_path", type=str) + argparser.add_argument("--media_dir", type=str) + argparser.add_argument("--output_vqa_json_path", type=str) + args = argparser.parse_args() + + prepare_vqa( + args.label_json_path, + args.prompt_template_path, + args.system_prompt_path, + args.json_schema_path, + args.media_dir, + args.output_vqa_json_path, ) - # 1. Load the templates - prompt_templates = load_prompt_templates("prompt_templates.json") - - # 2. Define questions to ask in both English and French - user_question_en = "Who is the doctor?" - user_question_fr = "Aperçu de la facturation" - user_question_invalid = "What is the weather?" - - # 3. Get the label (sub-object) from the prompts - if prompt_templates: - answer_en = get_label_from_prompt( - user_question_en, label_data, prompt_templates - ) - answer_fr = get_label_from_prompt( - user_question_fr, label_data, prompt_templates - ) - answer_invalid = get_label_from_prompt( - user_question_invalid, label_data, prompt_templates - ) - - print(f"Question (EN): '{user_question_en}'") - print("Answer (JSON Object):") - print(json.dumps(answer_en, indent=2, ensure_ascii=False)) - print("-" * 20) - - print(f"Question (FR): '{user_question_fr}'") - print("Answer (JSON Object):") - print(json.dumps(answer_fr, indent=2, ensure_ascii=False)) - print("-" * 20) - - print(f"Question (Invalid): '{user_question_invalid}'") - print("Answer (JSON Object):") - print(json.dumps(answer_invalid, indent=2, ensure_ascii=False)) - print("-" * 20) diff --git a/easydistill/mmkd/prompt_templates.json b/easydistill/mmkd/prompt_templates.json index 583c8a8..f208012 100644 --- a/easydistill/mmkd/prompt_templates.json +++ b/easydistill/mmkd/prompt_templates.json @@ -3,17 +3,17 @@ { "prompts": { "en": [ - "Get doctor information", - "Who is the doctor?", - "Provide doctor details" + "Get provider information", + "Who is the psychologist?", + "Provide practitioner details" ], "fr": [ - "Obtenir les informations du médecin", - "Qui est le médecin ?", - "Fournir les détails du médecin" + "Obtenir les informations du prestataire", + "Qui est le psychologue ?", + "Fournir les détails du praticien" ] }, - "group_name": "doctor_info", + "group_name": "provider_info", "target_keys": [ "doctor_name", "profession", @@ -24,32 +24,31 @@ { "prompts": { "en": [ - "Who is the patient?", - "Get patient info", - "Show insured person's details" + "Who is the beneficiary?", + "Get beneficiary details", + "Who received the service?" ], "fr": [ - "Qui est le patient ?", - "Obtenir les infos du patient", - "Afficher les détails de l'assuré" + "Qui est le bénéficiaire ?", + "Obtenir les détails du bénéficiaire", + "Qui a reçu le service ?" ] }, - "group_name": "patient_info", + "group_name": "beneficiary_info", "target_keys": [ - "insured_name", "beneficiary_name", - "security_number" + "beneficiary_dob" ] }, { "prompts": { "en": [ - "Give me the billing summary", - "Show the bill summary", + "Get billing summary", + "Show the invoice summary", "Billing overview" ], "fr": [ - "Donnez-moi le résumé de la facturation", + "Obtenir le résumé de facturation", "Afficher le résumé de la facture", "Aperçu de la facturation" ] @@ -66,17 +65,17 @@ { "prompts": { "en": [ - "What services were provided?", - "List the services", - "Show service details" + "Show the full service list", + "What services were performed?", + "List all service items" ], "fr": [ - "Quels services ont été fournis ?", - "Lister les services", - "Afficher le détail des services" + "Afficher la liste complète des services", + "Quels services ont été effectués ?", + "Lister tous les actes" ] }, - "group_name": "service_details", + "group_name": "service_items_block", "target_keys": [ "items" ] @@ -85,13 +84,13 @@ "prompts": { "en": [ "What is the payment status?", - "Was the bill paid?", - "Show payment details" + "Has the bill been paid?", + "Show payment info" ], "fr": [ "Quel est le statut du paiement ?", - "La facture a-t-elle été payée ?", - "Afficher les détails du paiement" + "La facture a-t-elle été réglée ?", + "Afficher les informations de paiement" ] }, "group_name": "payment_status", @@ -105,12 +104,12 @@ { "prompts": { "en": [ - "List the doctor's professional numbers", - "Get professional IDs" + "List all professional numbers", + "Get provider IDs" ], "fr": [ - "Lister les numéros professionnels du médecin", - "Obtenir les identifiants professionnels" + "Lister tous les numéros professionnels", + "Obtenir les identifiants du prestataire" ] }, "group_name": "professional_ids", @@ -123,176 +122,52 @@ { "prompts": { "en": [ - "What was the period of care?", - "Show care dates" + "What was the date of care?", + "Show care period" ], "fr": [ - "Quelle était la période de soins ?", - "Afficher les dates de soins" + "Quelle était la date des soins ?", + "Afficher la période de soins" ] }, "group_name": "care_period", "target_keys": [ "care_start_date", - "care_end_date", - "items" + "care_end_date" ] }, { "prompts": { "en": [ - "Show coverage and out-of-pocket costs", - "Financial coverage details" + "Show all coverage details", + "What was the coverage split?", + "Client and complementary coverage" ], "fr": [ - "Afficher la couverture et le reste à charge", - "Détails de la couverture financière" + "Afficher les détails de la couverture", + "Quelle était la répartition de la couverture ?", + "Couverture complémentaire et part client" ] }, - "group_name": "financial_coverage", + "group_name": "coverage_details", "target_keys": [ "mandatory_coverage", - "out_of_pocket" + "complementary_coverage", + "client_part" ] }, { "prompts": { "en": [ - "Show all details from the invoice", - "Full invoice data" + "Who issued the invoice?", + "Get issuer details" ], "fr": [ - "Afficher tous les détails de la facture", - "Données complètes de la facture" + "Qui a émis la facture ?", + "Obtenir les détails de l'émetteur" ] }, - "group_name": "invoice_details", - "target_keys": [ - "invoice_date", - "invoice_issuer", - "total_billed", - "items" - ] - }, - { - "prompts": { - "en": [ - "Who was the beneficiary of the service?", - "Get beneficiary info" - ], - "fr": [ - "Qui était le bénéficiaire du service ?", - "Obtenir les informations du bénéficiaire" - ] - }, - "group_name": "beneficiary_info", - "target_keys": [ - "beneficiary_name", - "beneficiary_dob" - ] - }, - { - "prompts": { - "en": [ - "Get all financial fields", - "Show all money fields" - ], - "fr": [ - "Obtenir tous les champs financiers", - "Afficher tous les champs monétaires" - ] - }, - "group_name": "full_financials", - "target_keys": [ - "total_billed", - "amount_paid", - "mandatory_coverage", - "out_of_pocket", - "remaining_payment", - "currency" - ] - }, - { - "prompts": { - "en": [ - "Who is the provider?", - "Who provided the service?" - ], - "fr": [ - "Qui est le prestataire ?", - "Qui a fourni le service ?" - ] - }, - "group_name": "provider_identity", - "target_keys": [ - "doctor_name", - "profession" - ] - }, - { - "prompts": { - "en": [ - "Show patient identification details", - "Patient ID info" - ], - "fr": [ - "Afficher les détails d'identification du patient", - "Infos d'identification du patient" - ] - }, - "group_name": "patient_identity", - "target_keys": [ - "insured_name", - "security_number", - "insured_dob" - ] - }, - { - "prompts": { - "en": [ - "How uch did the service item cost?", - "Item cost" - ], - "fr": [ - "Combien a coûté l'acte ?", - "Comût de l'acte" - ] - }, - "group_name": "service_item_cost", - "target_keys": [ - "items.amount", - "items.description" - ] - }, - { - "prompts": { - "en": [ - "When was the specific service rendered?", - "Date of service item" - ], - "fr": [ - "Quand le service spécifique a-t-il été rendu ?", - "Date de l'acte" - ] - }, - "group_name": "service_item_date", - "target_keys": [ - "items.date_of_service", - "items.description" - ] - }, - { - "prompts": { - "en": [ - "Who created the bill?", - "Who is the issuer?" - ], - "fr": [ - "Qui a créé la facture ?", - "Qui est l'émetteur ?" - ] - }, - "group_name": "invoice_issuer_details", + "group_name": "issuer_info", "target_keys": [ "invoice_issuer", "invoice_date" @@ -301,12 +176,106 @@ { "prompts": { "en": [ - "Is this a bill?", - "What is the document type?" + "Get all financial information", + "Show all monetary fields" ], "fr": [ - "Est-ce une facture ?", - "Quel est le type de document ?" + "Obtenir toutes les informations financières", + "Afficher tous les champs monétaires" + ] + }, + "group_name": "full_financials", + "target_keys": [ + "total_billed", + "amount_paid", + "remaining_payment", + "currency", + "mandatory_coverage", + "complementary_coverage", + "client_part" + ] + }, + { + "prompts": { + "en": [ + "What is the practitioner's profession?", + "Provider's specialty" + ], + "fr": [ + "Quelle est la profession du praticien ?", + "Spécialité du prestataire" + ] + }, + "group_name": "provider_profession", + "target_keys": [ + "profession" + ] + }, + { + "prompts": { + "en": [ + "Show all identification numbers", + "Patient and provider IDs" + ], + "fr": [ + "Afficher tous les numéros d'identification", + "Identifiants du patient et du prestataire" + ] + }, + "group_name": "all_identifiers", + "target_keys": [ + "security_number", + "adeli_number", + "rpps_number", + "finess_number" + ] + }, + { + "prompts": { + "en": [ + "List all people and entities", + "Show all names on document" + ], + "fr": [ + "Lister toutes les personnes et entités", + "Afficher tous les noms sur le document" + ] + }, + "group_name": "all_names", + "target_keys": [ + "doctor_name", + "beneficiary_name", + "invoice_issuer" + ] + }, + { + "prompts": { + "en": [ + "List all dates", + "Show every date on the document" + ], + "fr": [ + "Lister toutes les dates", + "Afficher chaque date sur le document" + ] + }, + "group_name": "all_dates", + "target_keys": [ + "care_start_date", + "care_end_date", + "invoice_date", + "beneficiary_dob" + ] + }, + { + "prompts": { + "en": [ + "Is this document a bill?", + "Get document type" + ], + "fr": [ + "Ce document est-il une facture ?", + "Obtenir le type de document" ] }, "group_name": "document_type", @@ -317,89 +286,45 @@ { "prompts": { "en": [ - "Show all money-related fields", - "List all monetary values" + "Show beneficiary and provider", + "Who saw whom?" ], "fr": [ - "Afficher tous les champs liés à l'argent", - "Lister toutes les valeurs monétaires" + "Afficher le bénéficiaire et le prestataire", + "Qui a consulté qui ?" ] }, - "group_name": "monetary_details", + "group_name": "patient_provider_pair", "target_keys": [ - "total_billed", - "amount_paid", - "out_of_pocket", - "remaining_payment", - "currency" - ] - }, - { - "prompts": { - "en": [ - "List all dates on the document", - "Show all dates" - ], - "fr": [ - "Lister toutes les dates sur le document", - "Afficher toutes les dates" - ] - }, - "group_name": "all_dates", - "target_keys": [ - "care_start_date", - "care_end_date", - "invoice_date", - "insured_dob", - "beneficiary_dob" - ] - }, - { - "prompts": { - "en": [ - "List all people mentioned", - "Show all names" - ], - "fr": [ - "Lister toutes les personnes mentionnées", - "Afficher tous les noms" - ] - }, - "group_name": "all_names", - "target_keys": [ - "doctor_name", - "insured_name", "beneficiary_name", - "invoice_issuer" + "doctor_name" ] }, { "prompts": { "en": [ - "Get only the insured person's info", - "Insured person details" + "What was the total amount billed?", + "Total cost of service" ], "fr": [ - "Obtenir uniquement les informations de l'assuré", - "Détails de la personne assurée" + "Quel était le montant total facturé ?", + "Coût total du service" ] }, - "group_name": "insured_only", + "group_name": "total_billed_info", "target_keys": [ - "insured_name", - "insured_dob", - "security_number" + "total_billed" ] }, { "prompts": { "en": [ - "What is the ADELI number?", - "Show me the ADELI" + "Show me the ADELI number", + "What is the ADELI?" ], "fr": [ - "Quel est le numéro ADELI ?", - "Montrez-moi le numéro ADELI" + "Montrez-moi le numéro ADELI", + "Quel est le numéro ADELI ?" ] }, "group_name": "adeli_number", @@ -410,259 +335,33 @@ { "prompts": { "en": [ - "What is the currency used?", - "Show the currency" + "What was the client's part?", + "Show client payment portion" ], "fr": [ - "Quelle est la devise utilisée ?", - "Afficher la devise" + "Quelle était la part du client ?", + "Afficher la part de paiement du client" ] }, - "group_name": "currency_info", + "group_name": "client_part_info", "target_keys": [ - "currency" + "client_part" ] }, { "prompts": { "en": [ - "Show service quantity and description", - "What was the quantity of services?" + "Was there complementary coverage?", + "Check for complementary insurance" ], "fr": [ - "Afficher la quantité et la description du service", - "Quelle était la quantité de services ?" + "Y avait-il une couverture complémentaire ?", + "Vérifier l'assurance complémentaire" ] }, - "group_name": "service_quantity", + "group_name": "complementary_coverage_info", "target_keys": [ - "items.quantity", - "items.description" - ] - }, - { - "prompts": { - "en": [ - "Financial reconciliation", - "Show billed vs paid" - ], - "fr": [ - "Rapprochement financier", - "Afficher le facturé par rapport au payé" - ] - }, - "group_name": "financial_reconciliation", - "target_keys": [ - "total_billed", - "amount_paid", - "remaining_payment" - ] - }, - { - "prompts": { - "en": [ - "Is the doctor the same as the issuer?", - "Compare doctor and issuer" - ], - "fr": [ - "Le médecin est-il le même que l'émetteur ?", - "Comparer le médecin et l'émetteur" - ] - }, - "group_name": "doctor_vs_issuer", - "target_keys": [ - "doctor_name", - "invoice_issuer" - ] - }, - { - "prompts": { - "en": [ - "Are there any missing professional numbers?", - "Check for null IDs" - ], - "fr": [ - "Y a-t-il des numéros professionnels manquants ?", - "Vérifier les identifiants nuls" - ] - }, - "group_name": "missing_ids", - "target_keys": [ - "adeli_number", - "rpps_number", - "finess_number" - ] - }, - { - "prompts": { - "en": [ - "Show patient and service date", - "Who received care and when?" - ], - "fr": [ - "Afficher le patient et la date du service", - "Qui a reçu les soins et quand ?" - ] - }, - "group_name": "patient_and_service_date", - "target_keys": [ - "beneficiary_name", - "items.date_of_service" - ] - }, - { - "prompts": { - "en": [ - "Give me the total amount due", - "What was the total cost?" - ], - "fr": [ - "Donnez-moi le montant total dû", - "Quel était le coût total ?" - ] - }, - "group_name": "total_cost", - "target_keys": [ - "total_billed" - ] - }, - { - "prompts": { - "en": [ - "Provide the social security number", - "What is the security number?" - ], - "fr": [ - "Fournir le numéro de sécurité sociale", - "Quel est le numéro de sécurité sociale ?" - ] - }, - "group_name": "security_number_info", - "target_keys": [ - "security_number" - ] - }, - { - "prompts": { - "en": [ - "Dump all data", - "Show me everything" - ], - "fr": [ - "Extraire toutes les données", - "Montre-moi tout" - ] - }, - "group_name": "full_dump", - "target_keys": [ - "is_bill", - "profession", - "adeli_number", - "rpps_number", - "finess_number", - "doctor_name", - "total_billed", - "bill_paid", - "amount_paid", - "mandatory_coverage", - "out_of_pocket", - "remaining_payment", - "insured_name", - "insured_dob", - "beneficiary_name", - "beneficiary_dob", - "care_start_date", - "care_end_date", - "invoice_date", - "security_number", - "invoice_issuer", - "currency", - "items" - ] - }, - { - "prompts": { - "en": [ - "What is the doctor's specialty?", - "Doctor's profession" - ], - "fr": [ - "Quelle est la spécialité du médecin ?", - "Profession du médecin" - ] - }, - "group_name": "doctor_profession", - "target_keys": [ - "profession" - ] - }, - { - "prompts": { - "en": [ - "Show invoice date and due amount", - "When was the bill issued and for how much?" - ], - "fr": [ - "Afficher la date de la facture et le montant dû", - "Quand la facture a-t-elle été émise et pour quel montant ?" - ] - }, - "group_name": "invoice_date_and_amount", - "target_keys": [ - "invoice_date", - "total_billed" - ] - }, - { - "prompts": { - "en": [ - "Are there any remaining payments?", - "Is there a balance due?" - ], - "fr": [ - "Y a-t-il des paiements restants ?", - "Y a-t-il un solde dû ?" - ] - }, - "group_name": "remaining_balance_check", - "target_keys": [ - "remaining_payment", - "bill_paid" - ] - }, - { - "prompts": { - "en": [ - "Show all patient-related dates", - "What are the patient's dates?" - ], - "fr": [ - "Afficher toutes les dates relatives au patient", - "Quelles sont les dates du patient ?" - ] - }, - "group_name": "patient_dates", - "target_keys": [ - "insured_dob", - "beneficiary_dob" - ] - }, - { - "prompts": { - "en": [ - "List service, date, and amount", - "Give me a line item breakdown" - ], - "fr": [ - "Lister le service, la date et le montant", - "Donnez-moi une ventilation par poste" - ] - }, - "group_name": "line_item_summary", - "target_keys": [ - "items.description", - "items.date_of_service", - "items.amount" + "complementary_coverage" ] }, { @@ -679,211 +378,168 @@ "group_name": "insured_person_details", "target_keys": [ "insured_name", - "insured_dob" + "insured_dob", + "security_number" ] }, { "prompts": { "en": [ - "What was the amount paid?", - "How much has been paid?" + "Is there a remaining balance?", + "How much is left to pay?" ], "fr": [ - "Quel était le montant payé ?", - "Combien a été payé ?" + "Reste-t-il un solde ?", + "Combien reste-t-il à payer ?" ] }, - "group_name": "amount_paid_info", + "group_name": "remaining_balance_info", "target_keys": [ - "amount_paid" + "remaining_payment", + "bill_paid" ] }, { "prompts": { "en": [ - "Check for RPPS number", - "Is there an RPPS number?" + "Compare issuer and provider", + "Is the issuer the same as the practitioner?" ], "fr": [ - "Vérifier le numéro RPPS", - "Y a-t-il un numéro RPPS ?" + "Comparer l'émetteur et le prestataire", + "L'émetteur est-il le même que le praticien ?" ] }, - "group_name": "rpps_check", + "group_name": "issuer_vs_provider", "target_keys": [ - "rpps_number" - ] - }, - { - "prompts": { - "en": [ - "Check for FINESS number", - "Is there a FINESS number?" - ], - "fr": [ - "Vérifier le numéro FINESS", - "Y a-t-il un numéro FINESS ?" - ] - }, - "group_name": "finess_check", - "target_keys": [ - "finess_number" - ] - }, - { - "prompts": { - "en": [ - "Show all billing identifiers", - "List all bill IDs" - ], - "fr": [ - "Afficher tous les identifiants de facturation", - "Lister tous les ID de facture" - ] - }, - "group_name": "billing_identifiers", - "target_keys": [ - "invoice_date", - "security_number", - "adeli_number" - ] - }, - { - "prompts": { - "en": [ - "Was there mandatory coverage applied?", - "Check mandatory coverage" - ], - "fr": [ - "Une couverture obligatoire a-t-elle été appliquée ?", - "Vérifier la couverture obligatoire" - ] - }, - "group_name": "mandatory_coverage_check", - "target_keys": [ - "mandatory_coverage" - ] - }, - { - "prompts": { - "en": [ - "How much was out of pocket?", - "Check out-of-pocket expense" - ], - "fr": [ - "Combien était le reste à charge ?", - "Vérifier le reste à charge" - ] - }, - "group_name": "out_of_pocket_check", - "target_keys": [ - "out_of_pocket" - ] - }, - { - "prompts": { - "en": [ - "Show patient name and doctor name", - "Who saw whom?" - ], - "fr": [ - "Afficher le nom du patient et le nom du médecin", - "Qui a vu qui ?" - ] - }, - "group_name": "patient_doctor_pair", - "target_keys": [ - "beneficiary_name", + "invoice_issuer", "doctor_name" ] }, { "prompts": { "en": [ - "Get service item coverage", - "Was the line item covered?" + "Show care dates and provider", + "Who provided care and when?" ], "fr": [ - "Obtenir la couverture de l'acte", - "L'acte était-il couvert ?" + "Afficher les dates de soins et le prestataire", + "Qui a fourni les soins et quand ?" ] }, - "group_name": "service_item_coverage", + "group_name": "care_dates_and_provider", "target_keys": [ - "items.mandatory_coverage", - "items.description" + "care_start_date", + "care_end_date", + "doctor_name" ] }, { "prompts": { "en": [ - "Show full patient and beneficiary info", - "Compare insured vs beneficiary" + "Get beneficiary and security number", + "Beneficiary's social security number" ], "fr": [ - "Afficher les informations complètes du patient et du bénéficiaire", - "Comparer l'assuré et le bénéficiaire" + "Obtenir le bénéficiaire et le numéro de sécurité sociale", + "Numéro de sécurité sociale du bénéficiaire" ] }, - "group_name": "insured_vs_beneficiary", + "group_name": "beneficiary_and_ssn", "target_keys": [ - "insured_name", - "insured_dob", "beneficiary_name", - "beneficiary_dob" + "security_number" ] }, { "prompts": { "en": [ - "What is the invoice date?", - "When was the bill created?" + "Show full financial breakdown", + "Complete cost and coverage details" ], "fr": [ - "Quelle est la date de la facture ?", - "Quand la facture a-t-elle été créée ?" + "Afficher la ventilation financière complète", + "Détails complets des coûts et de la couverture" ] }, - "group_name": "invoice_date_info", + "group_name": "full_financial_breakdown", "target_keys": [ - "invoice_date" + "total_billed", + "amount_paid", + "mandatory_coverage", + "complementary_coverage", + "client_part", + "remaining_payment" ] }, { "prompts": { "en": [ - "Get all provider information", - "Show all details for the doctor" + "What is the currency?", + "Show payment currency" ], "fr": [ - "Obtenir toutes les informations sur le prestataire", - "Afficher tous les détails pour le médecin" + "Quelle est la devise ?", + "Afficher la devise de paiement" ] }, - "group_name": "full_provider_info", + "group_name": "currency_info", + "target_keys": [ + "currency" + ] + }, + { + "prompts": { + "en": [ + "What is the patient's financial responsibility?", + "How much does the patient owe?" + ], + "fr": [ + "Quelle est la responsabilité financière du patient ?", + "Combien le patient doit-il ?" + ] + }, + "group_name": "patient_financial_responsibility", + "target_keys": [ + "client_part", + "remaining_payment" + ] + }, + { + "prompts": { + "en": [ + "Get provider's full identification", + "All professional numbers for the provider" + ], + "fr": [ + "Obtenir l'identification complète du prestataire", + "Tous les numéros professionnels du prestataire" + ] + }, + "group_name": "provider_full_identification", "target_keys": [ "doctor_name", - "profession", "adeli_number", "rpps_number", - "finess_number", - "invoice_issuer" + "finess_number" ] }, { "prompts": { "en": [ - "Show me the service description only", - "What was the service?" + "Show billing and care timeline", + "What are the billing and service dates?" ], "fr": [ - "Montrez-moi uniquement la description du service", - "Quel était le service ?" + "Afficher la chronologie de facturation et de soins", + "Quelles sont les dates de facturation et de service ?" ] }, - "group_name": "service_description_only", + "group_name": "billing_and_care_timeline", "target_keys": [ - "items.description" + "invoice_date", + "care_start_date", + "care_end_date" ] } ]