Description
Greenrain Drug Database implements its login in classes and API in the library with the following properties:
Namespace: Greenrain.Drugdb.
Executable Name: Greenrain.Drugdb.dll
Gender Assumptions
If the patient gender is unknown, then Greenrain Drug Database does not run gender-specific checks.
Enum ErrorTypeEnum
Enum name: ErrorTypeEnum
Namespace: Greenrain.Connect
Access modifier: Public
Description: This enum describes the error type:
None = Error type is not defined.
Error = Type is the Error.
Warning = Type is the Warning.
Class DdbSettings
Class name: DdbSettings
Access modifier: Public
Description: This class is used to manage Greenrain Drug Database settings. It can be used to change global Greenrain Drug Database settings, as well as to override settings for a particular run of Drug Database checks.
Public members: refer to the table below.
Member Name | Data Type | Default Value | Description |
---|---|---|---|
AtcLevel | integer | 3 | The setting is used to specify the level of ATC code that is used for therapy duplicate checks. This value may have values between 1 to 5. |
Public methods: refer to the table below.
Method Name | Return Data Type | Description |
---|---|---|
Save() | void | The method saves the settings. Do not call this method if you use non-default settings only for the particular run of Drug Database checks. |
Class ValidationResult
Class name: ValidationResult
Namespace: Greenrain.Connect
Access modifier: Public
Description:
This class represents error messages returned by the Greenrain Drug Database API.
Greenrain Drug Database API may return two types of data:
Alerts are generated from the Drugs Database.
Exceptions are described in the section Exceptions.
Public members: refer to the table below.
Member Name | Data Type | Default Value | Description |
---|---|---|---|
Code | int | 0 | The validation result code. A negative value means there are errors found. Zero or positive value means Greenrain Drugs Database found no errors. |
Description | string | null | Description of the result. |
ErrorCollection | null | Collection of error messages. |
Public methods: refer to the table below.
Method Name | Return Data Type | Description |
---|---|---|
IsSuccess() | bool | The method returns true if Greenrain Drug Database returned no errors. Otherwise, the method returns false. |
Class ValidationErrorsCollection
Class name: ValidationErrorsCollection
Namespace: Greenrain.Connect
Access modifier: Public
Description: This class contains a collection of validation errors.
Public members: refer to the table below.
Member Name | Data Type | Default Value | Description |
---|---|---|---|
ValidationErrors | IList<ValidationErrorMessage> | null | List of error messages. |
Public methods: refer to the table below.
Method Name | Return Data Type | Description |
---|---|---|
HasError() | bool | The method checks if the error collection contains at least one error. It returns true if Greenrain Drug Database has generated at least one error. Otherwise, the method returns false. |
HasWarning() | bool | The method checks if the error collection contains at least one warning. It returns true if Greenrain Drug Database has generated at least one warning. Otherwise, the method returns false. |
Class ValidationErrorMessage
Class name: ValidationErrorMessage
Namespace: Greenrain.Connect
Access modifier: Public
Description: This class contains error message details.
Public members: refer to the table below.
Member Name | Data Type | Default Value | Description |
---|---|---|---|
Title | string | null | Title of the error message. For example, it can be a transaction name that can be later shown in the errors report. |
FileName | string | null | E-claim transaction file name, if available. |
ErrorType | ErrorTypeEnum.None | Error type. | |
ErrorDescription | string | null | Error message. |
ValidationRuleId | string | null | Validation rule ID that has failed and returned an error. |
OwnerObjectName | string | null | E-claim object that generated the error, e.g. Activity, Claim, Observation, etc. |
OwnerObjectPropertyName | string | null | Name of the property in the owner object that caused the error. For example, if Activity.Net contains no value, then: OwnerObjectName = string 'Activity'. OwnerObjectPropertyName = string 'Net'. |
OwnerObjectPropertyValue | object | null | Value of the property in the owner object that caused the error. For example, if Activity.Start contains invalid date value '01/30/2012': OwnerObjectName = string 'Activity'. OwnerObjectPropertyName = string 'Start'. OwnerObjectPropertyValue = value '01/30/2012'. |
ReferenceObjectName | string | null | Reference object that is related to the error. It can be a parent object. Refer to an example below. |
ReferenceObjectPropertyName | string | null | Name of the property of the reference object. It can be a parent object. Refer to an example below. |
ReferenceObjectPropertyValue | object | null | Value of the reference properly. For example, there is an error with an invalid diagnosis code: ReferenceObjectName = string 'Claim'. ReferenceObjectPropertyName = string 'ID'. ReferenceObjectPropertyValue = Value of Claim.ID. |
AdditionalReference | string | null | Additional reference about the error, if available. |
Class GreenrainDdb
Class name: GreenrainDbc
Access modifier: Public
Description: This is the main class to run all available Drugs Database Checks.
Performance consideration: The class uses Drugs Database Checks edits that may consume a significant amount of memory (refer to Memory Consumption). Also, it might take a few seconds longer for the very first Drug Database check as the class loads all the edits to the memory during the first call. Therefore, it is important to consider the following to avoid a performance downgrade:
Create an instance of GreenrainDdb class only once when your application starts.
As one of the options, you might consider using singleton in your application.
Methods of the GreenrainDdb class may be called by different threads within the same process.
If you will create the instance of GreenrainDbc class just before you run the Drug Database check, this might slow down your application because it will load all the edits into the memory every time.
For example: if you get 1,000 claims to validate, you can use the following logic:
Create the instance of GreenrainDdb class when your app starts.
Create 10 threads to process 100 claims each.
Every thread can safely access the instance of GreenrainDdb class and validate their claims.
Public members: None.
Public methods: refer to the sections below.
Constructor
Access modifier: Public
Description: This is the class constructor.
Syntax
public GreenrainDbc(ILicenseManager licenseManager = null, IDdbSettings DdbSettings = null)
Parameters
Parameter | Data Type | Default Value | Description |
---|---|---|---|
licenseManager | ILicenseManager | null | LicenseManager class. If the parameter is null, the class will use license key found in the Settings. |
DdbSettings | IDdbSettings | null | If this parameter is null, then the constructor uses the current Greenrain Drugs Database settings saved on the system. Otherwise, API uses the settings specified in the passed in DdbSettings class. Therefore, the constructor can be called with any settings combination required by the caller, even if it is different from the current system settings. |
Return Value
None.
Exceptions
None.
RunDdb Method
Access modifier: Public
Description
The method is a single API that runs all checks supported by Greenrain Drug Database.
Syntax
public ValidationResult GreenrainDdb.RunDdb(string claimId, int? patientAge, int? patientGender, IList<string> drugCodes, string principalDiagnosisCode, IList<string> secondaryDiagnosisCodes); public ValidationResult GreenrainDdb.RunDdb(string claimId, DateTime? patientBirthDate, int? patientGender, IList<string> drugCodes, string principalDiagnosisCode, IList<string> secondaryDiagnosisCodes);
Parameters
Parameter | Data Type | Default Value | Description |
---|---|---|---|
claimId | string | null | Claim ID to be used as a reference. |
patientAge | int? | null | Patient age. |
patientBirthDate | DateTime? | null | Patient Birth Date |
patientGender | int? | null | Patient gender that can accept the following values: null = Gender is unknown, this will raise an exception. 0 = Female. 1 = Male. |
drugCodes | IList<string> | null | List of drug codes. |
principalDiagnosisCode | string | null | Principal ICD-10-CM codes. |
secondaryDiagnosisCodes | IList<string> | null | List of secondary ICD-10-CM codes. |
Return Value
The method returns a list of all found errors.
Exceptions
Possible exceptions are described in the Exceptions section.
RunClaimSubmissionChecks Method
NOTE: this method is re-design at the moment. It will be released in one of the nearest updates during the summer 2022.
Access modifier: Public
Description
The method performs the following logic:
Parse the passed in Claim.Submission XML transaction.
Calculate patient age using Emirates ID Number. The assumption is made that patient's birth date is January 1.
If Emirates ID Number has the default value, then the patient's age is set to unknown. In this case, all age-related checks are disabled.
Patient gender is not available in Claim.Submission transactions, therefore, gender-related checks are disabled.
Call RunDdb Method if the claim has at least one drug code.
Only principal and secondary diagnoses are used for every claim. Other diagnosis types are ignored.
Syntax
public ValidationResult GreenrainDdb.RunClaimSubmissionChecks(byte[] xmlClaimSubmissionTransaction, string fileName);
Parameters
Parameter | Data Type | Default Value | Description |
---|---|---|---|
xmlClaimSubmissionTransaction | byte[] | null | Content of XML file with Claim.Submission transaction. |
Return Value
The method returns a list of all found errors. A null value is returned if no alert is found.
Exceptions
Possible exceptions are described in the Exceptions section.
Exceptions
All API methods may raise exceptions described in the table below. The following rules are applied:
An exception is returned as Class ValidationResult.
ValidationResult.Code = value of the exception code.
ValidationResult.Description = value of the error message.
ID | Error Message Example | Description |
---|---|---|
-1000 | An unexpected error occurred. | This exception is raised if anything goes wrong that we do not cover with exceptions in this table. |
-1001 | Greenrain Drug Database API requires a valid license. You can use Greenrain Drug Database Settings to enter the license key. | This exception may be raised in the following scenarios:
|
-1002 | Claim ID must have value. | This exception is raised when the Claim ID is empty. |
-1003 | At least one drug code must be provided. | This exception is raised when no drug code is found. |
-1004 | At least one ICD-10-CM must be provided, either principal or secondary diagnosis. | This exception is raised when no ICD-10-CM is found. |
-1005 | Data Source is not found. | This exception is raised when Data Source does not exist or cannot be accessed for any reason. |
-1006 | At least two drug codes must be provided. | This exception is raised when less than two drug codes are found. |
-1007 | The patient's age is negative. | This exception is raised when the patient's age is a negative number. |
-1008 | Patient age is undefined or negative, and patient gender is not equal to 0 or 1. | This exception is raised when any of the below conditions is met:
|
-1009 | The content of the XML file may not be null. | This exception is raised when the XML file has no content. |
-1010 | The XML file must contain Claim.Submission xml transaction. | This exception is raised when the XML file does not contain Claim.Submission transaction. |
-1011 | The XML file must contain at least one claim. | This exception is raised when the XML file contains no claim. |