aiza-rrg-integration-ts
v2.3.0
Published
Made with create-react-library
Downloads
10
Readme
aiza-rrg-integration-ts
Overview
The AizaRRGIntegration
library facilitates the integration of a radiology report generation service into your React application. It requires an API key for authentication and a response function to handle the generated report data.
Install
npm install aiza-rrg-integration-ts
or
yarn add aiza-rrg-integration-ts
Usage
Below is an example of how to use the AizaRRGIntegration component in a React application:
import { AizaRRGIntegration } from 'aiza-rrg-integration';
function App() {
// Define the response function to handle the results from AizaRRGIntegration
const handleResponse = (
radiology_report: string,
report_title: string,
audio: object,
error: boolean,
is_invalid: boolean
) => {
if (error) {
console.error("An error occurred while processing the report.");
} else if (is_invalid) {
console.warn("The generated report is invalid.");
} else {
console.log("Radiology Report:", radiology_report);
console.log("Report Title:", report_title);
// You can also handle the audio object if needed
console.log("Audio Object:", audio);
}
};
// Define the response function to handle the ICD and CPT codes
const responseCodeFunction = (icd_code: any, cpt_code: any): void => {
console.log("ICD Code:", icd_code);
console.log("CPT Code:", cpt_code);
};
return (
<>
<AizaRRGIntegration
xapi='your xpai key' // Replace with your actual x-api key
responseFunction={handleResponse}
responseCodeFunction={responseCodeFunction}
modality='CT'
bodypart='Abdomen'
protocol='No Contrast'
platform={1} // Set platform type (1 for web, 0 for mobile)
age='30' // Optional patient's age
gender='male' // Optional patient's gender
/>
</>
);
}
export default App;
Prop Details
xapi
- Type: string
- Description: The API key used to authenticate your application with the radiology report generation service.
- Example:
'your-xapi-key'
responseFunction
- Type: function
- Description: A callback function that handles the response from the service. It receives five parameters:
radiology_report
,report_title
,audio
,error
, andis_invalid
.
const handleResponse = (
radiology_report: string,
report_title: string,
audio: object,
error: boolean,
is_invalid: boolean
) => {
if (error) {
console.error("An error occurred while processing the report.");
} else if (is_invalid) {
console.warn("The generated report is invalid.");
} else {
console.log("Radiology Report:", radiology_report);
console.log("Report Title:", report_title);
console.log("Audio:", audio);
}
};
responseCodeFunction
Type: function
Description: A callback function that handles the response for ICD and CPT codes. It receives two parameters: icd_code and cpt_code.
const responseCodeFunction = (icd_code: any, cpt_code: any): void => {
console.log("ICD Code:", icd_code);
console.log("CPT Code:", cpt_code);
};
Integration
To integrate the AizaRRGIntegration
component into your application:
- Import the
AizaRRGIntegration
component from theaiza-rrg-integration-ts
package. - Provide the required
xapi
prop with your API key. - Define a response handling function to process the data returned by the service.
- Include the
AizaRRGIntegration
component in your component tree.
By following these steps, you can easily generate and handle radiology reports within your React application.
By following these steps, you can easily generate and handle radiology reports and corresponding ICD and CPT codes within your React application.