-
Notifications
You must be signed in to change notification settings - Fork 5
rules
Rules are defined by hospital staff in the admin area.
class Rule {
Guid Id;
int ProviderId;
Guid RuleTemplateId;
RuleLogicTypeCode ConditionTypeId;
string Description;
string SatisfiedMessage;
string UnsatisfiedMessage;
string DetailsJson;
int StatusCode;
}
class SubjectAddressRule : Rule {
SubjectAddressRuleDetails Details; //DetailsJson Serialized and Deserialized
}
class SubjectAddressRuleDetails {
List<SubjectAddress> SubjectAddresses;
}
class SubjectAddress {
string Country;
string State;
string City;
string PostalCode;
}
Rule.RuleTemplateId identifies the RuleTemplate the rule belongs to. For example when using location to determine whether a patient is allowed to register:
- AddressRule uses the SubjectAddressRule class.
- DistanceRule checks the center and distance of a geo location.
- PatientOrganizationRule checks the organization and its location.
Rule.ConditionTypeId defines whether a condition follows a rule by determining if it is In or NotIn the acceptable group. For example:
- In US California: Patient is allowed to register if the address is in US California.
- NotIn Organization X: Patient is allowed to register if he / she does not belong to Organization X.
RuleTemplates are defined by SnapMD staff in the admin area.
class RuleTemplate {
Guid Id;
Guid RuleSetId;
RuleTypeCode RuleTypeId;
string ImagePath;
string Description;
string SatisfiedMessage;
string UnsatisfiedMessage;
int StatusCode;
}
RuleTemplate.RuleSetId identifies the RuleSet the ruleTemplate belongs to, which defines a collections of rules.
OR conditions are applied to the rules, while AND conditions are applied to the rule sets. For example:
- Address Rule Set: Contains AddressRule and DistanceRule. If any of the rules within the set evaluated to true, the set is evaluated to true.
- Patient Organization Rule Set: Contains PatientOrganizationRule, which contains rules of its own. If any of the rules within the set evaluated to true, the set is evaluated to true.
- If a provider defines both sets, a patient must satisfy both sets in order to register with this provider.
RuleTemplate.RuleTypeId defines the class code which will be used to handle the rules. For example:
- AddressRule: SubjectAddressRule
- DistanceRule: SubjectDistanceRule
- PatientOrganizationRule: PatientOrganizationRule
RuleSets are defined by SnapMD staff in the admin area.
class RuleSet {
Guid Id;
RuleCategoryCode RuleCategoryId;
string Description;
string SatisfiedMessage;
string UnsatisfiedMessage;
int StatusCode;
}
RuleSet.RuleCategoryId defines the category of the RuleSet. For example:
- RegistrationAvailability: "Allow patients to register if they meet certain criteria."
- PatientVisibility: "Patient can see providers if/where/when they meet certain criteria."
- ProviderVisibility: "Provider can see patients if/where/when they meet certain criteria."