2 Replies Latest reply: Jun 1, 2012 5:58 AM by 837876 RSS

    Issue with inferred relationships

    837876
      Hi all,

      I have an issue with inferred relationships. It's not working out the way I want it to. So here's the thing:

      What I want to establish:
      I want to determine an entitlement for child benefit on several qualifying dates.

      The context of my rulebase:
      I am exploring multiple options (TBR as one on them) but the issue occurs with the following option.

      We want to define the OPA call as generic as possible since we want to implement multiple regulations in one system. That is why we want to supply OPA with attibutes on a 'person' level plus the role of the person in the case. This way OPA can infer assessments such as 'the age of the person' on a generic level, and based on inferred relationships it can derive 'the age of the child' and whether the child meets the requirement for the age limit for a certain regulation.

      The rulebase I made:
      Datamodel
      I have one entity for 'the decision' (one to many from global) which holds the qualifying date and the several (intermediate) assessments such as "the child lives with the applicant". These assessments are inferred from atrributes at the level of 'the person', which is a one to many relationship from 'the decision'. Then, I defined two inferred relationships from 'the decision' to 'the person', being something like this (my rule are in Dutch so I loosely translated)

      IsMemberOf(the person, the applicant) if
      the role of the person = 'applicant'

      Rules
      I wrote rules where assessments are first made per person, and then the assessment per decision is done for the specific role. Example:

      the person lives in the Netherlands if
      the country of residence of the person = 'Netherlands'

      the applicant of the decision lives in the Netherlands if
      For(the applicants of the decision, the person lives in the Netherlands)

      Debugging
      Now, when I build and debug, the following problem arises: When I create 2 decisions with each 2 persons, one being an applicant and one being a child (which, in real life, are the same), the assessments in 'the decision' are almost always uncertain, because the following happens:

      decision 1 (qual date 2012-01-01)
      - person 1 (applicant)
      - person 2 (child)
      decision 2 (qual date 2012-04-01)
      - person 3 (applicant)
      - person 4 (child)

      Now, the assessment in decision 2 concerned with the child, will look to person 2 and person 4. This is not strange as the relationship is many to many. However, I only want it to look to person 4 since that is the child under that decision.

      The question I have:
      I tried inferred relationships from 'the person' to 'the person' as well, but the problem keeps coming up because an inferred relationship is many to many by default. I need a way to express in my rules, that THIS applicant belongs to THIS decision, the same way a person is linked to a decision.

      I would much appreciate any help with this issue.

      Cheers, Els
        • 1. Re: Issue with inferred relationships
          Ben Rogers
          Hi Els,

          We have built a slightly similar rulebase in Sweden, we use "beräkningen" (the calculation) which is linked to "person" and "barn" (child). This relationship presents multiple assessments on a range of different dates... such as the amount of benefit totalled up on a month-by-month basis, and the value of attributes on a range of dates.

          Although Inferred Relationships appear as many-to-many, they can be many-one or even one-one, depending on your rules. So you can have inferred relationships like "the youngest child", "the highest income record" which can be a useful shortcut in some circumstances. As long as your IsMemberOf() conclusion is correct, the inferred can be a "to-one", and I often prefer naming inferred relationships to reflect their definitions, such as "the person's youngest child"... instead of "the person's youngest children", if the inferred relationship is genuinely a to-one.

          Does your rulebase need to handle multiple decisions, for multiple people and children? Or is it multiple decisions for the same set of people & children?

          If your rulebase needs to check the values of decisions on a variety of dates, you could have another to-many entity "the assessment day" (maybe this is contained by "the decision"). From that, you can build a TBR-DATE attribute which is "the decision's assessment date". Then from that you can have one TBR attribute which will be your assessments.
          Here is a quick example rulebase. Build a rulebase with 2 entities, "the decision" (one to many, contained by global) and then "the assessment day" (one to many, contained by the decision) and add in the following rules:

          the decision’s person is eligible for benefits on the assessment date (temporal) if
          the decision’s assessment date (temporal) is certain and
          the decision’s person is over the age limit (temporal)

          the decision’s person is over the age limit (temporal) if
          TemporalOnOrAfter(2012-06-01)

          the decision’s assessment date (temporal) = InstanceValueIf(the assessment days, the assessment day’s date, TemporalOn(the assessment day’s date))


          Then debug the rulebase... add 1 instance of "the decision" and 2 instances of "the assessment day", with dates (2012-04-05) and (2012-07-06)

          What you will find is that "the decision’s person is eligible for benefits on the assessment date (temporal)" will be false, except for the one valid assessment day where the person is over the age limit, which is 2012-07-06.


          This may be something like what you are after?

          It's a bit tricky to explain all these suggestions on here without rulebases and pictures, but I think what you are suggesting is certainly doable! - it may be easier if you get in touch or email me some example rules, ben.rogers@monadsolutions.com, and I can send you some more info about what I mean, as we have implemented a similar solution with Temporal Dates before, and it works well (and fast!)



          Thanks,
          Ben
          • 2. Re: Issue with inferred relationships
            837876
            Hi Ben,

            Thanks for your reply. To answer your question, the rulebase needs to handle multiple decisions for the same set of people. However, the problem lies not so much in the decision entity, but in the separation of two persons (one for the 1st and one for the 2nd decision). We don't want to have a seperate entity for child, and that's what makes it difficult I think.

            I am curious to see your solution for this problem and I will send you an email with some more information.

            In the mean time, if anyone else has experience with this issue, please let me know if you might have a solution.

            Cheers, Els