rulesheetDefaultURI
   URI:
      https://rulesheetserver/gov/wisconsin/wijis/names/operators/DOC?rulesheetID=WisconsinPrisonerRulesheet

default-rule
   id:
      1
   apply-outcomes:
      redact

rule
   id:
      2
   # Disclose both prisoner name and prisoner DOB.
   apply-outcomes:
      disclose
   for-content:
      * exactly-one-true
         * present-item has-caption "Subject:SubjectLastName"
         * present-item has-caption "Subject:SubjectFirstName"
         * present-item has-caption "Subject:DOB"
   for-conditions:
      * all-users

rule
   id:
      3
   apply-outcomes:
      disclose
   for-content:
      * present-item has-caption "Corrections"
   for-conditions:
      * inherent-role-list contains-something-with-value "wisconsinCorrections"

rule
   id:
      4
   apply-outcomes:
      disclose
   for-content:
      * present-item has-caption "Sentence"
   for-conditions:
      * at-least-one-true
         * inherent-role-list contains-something-with-value "wisconsinCorrections"
         * inherent-role-list contains-something-with-value "wisconsinCourts"
         # or for anyone as long as the prisoner's entry date is more than 30 days ago
         * all-true
            * all-users
            * present-document contains-something-with-caption "IntakeDate"
            * whilst is-earlier-than 30-days-ago-from-now


#  Disclose prison for all, but redact dispensary for everyone other than 
#  corrections superintendents or corrections medical or epidemiologist.
#  This requirement is implemented in rules 5 and 6.

rule
   id:
      5
   # Disclose prison for all.
   apply-outcomes:
      disclose
   for-content:
      * present-item has-caption "Prison"
   for-conditions:
      * all-users
#  The for-content cited above in this rule (5) could have been placed in rule 2. But for clarity, it is defined in
#  its own rule here and is closely related to the rule 6 redaction below.

rule
   id:
      6
   # Redact dispensary for all, except disclose dispensary for corrections superintendents or
   # corrections medical or epidemiologist; dispensary - likely to be a prison component - would be disclosed as a result of rule 5.
   apply-outcomes:
      redact
   for-content:
      * present-item has-caption "DrugDispensary"
   for-conditions:
      * none-true
         * inherent-role-list contains-something-with-value "wisconsinCorrectionsSuperintendents"
         * inherent-role-list contains-something-with-value "wisconsinCorrectionsMedical"
         * inherent-role-list contains-something-with-value "wisconsinDhfsEpidemiology"

rule
   id:
      7
   apply-outcomes:
      disclose
   for-content:
      * present-item has-caption "MedicalHistory"
   for-conditions:
      * at-least-one-true
         * inherent-role-list contains-something-with-value "wisconsinCorrectionsSuperintendents"
         * inherent-role-list contains-something-with-value "wisconsinCorrectionsMedical"
         * inherent-role-list contains-something-with-value "wisconsinDhfsEpidemiology"