curaflow/backend/agents/BillingAgent.js

39 lines
1.6 KiB
JavaScript

const BaseAgent = require('./BaseAgent');
class BillingAgent extends BaseAgent {
constructor() {
super('BillingAgent');
this.responseMocks = {
'headache': JSON.stringify([{ code: 'R51.9', desc: 'Headache, unspecified', type: 'ICD-10' }, { code: '99213', desc: 'Office Visit (Level 3)', type: 'CPT' }]),
'fever': JSON.stringify([{ code: 'R50.9', desc: 'Fever, unspecified', type: 'ICD-10' }, { code: '99214', desc: 'Office Visit (Level 4)', type: 'CPT' }]),
'default': JSON.stringify([{ code: 'Z00.00', desc: 'Encounter for general adult medical examination without abnormal findings', type: 'ICD-10' }, { code: '99212', desc: 'Office Visit (Level 2)', type: 'CPT' }])
};
}
async execute(config, payload) {
const { clinicalSummary } = payload;
console.log(`[BillingAgent] Analyzing clinical summary for ICD-10/CPT codes...`);
const prompt = `
Extract the most likely ICD-10 diagnosis codes and CPT procedure codes from this summary:
${clinicalSummary}
Return ONLY a JSON array of objects with { code, desc, type }.
`;
const llmResponse = await this.mockLLMCall(prompt, this.responseMocks);
try {
const codes = JSON.parse(llmResponse);
console.log(`[BillingAgent] Suggested Codes: `, codes);
return codes;
} catch (e) {
console.error('[BillingAgent] Failed to parse LLM response', e);
return [];
}
}
}
module.exports = new BillingAgent();