Adding Security Policy based on Occupation

In this recipe, we're going to leverage the SanteDB privacy subsystem to flag any patient whose occupation indicates they are a politician with a VIP code and a sensitive information policy. This will allow SanteMPI to hide our politician's information from those users who do not have access to view their sensitive records.

Dataset

First, we create a dataset which establishes our occupation code for a politician, our security policy for "VIP Data Access Policy".

<dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="Demo Dataset" xmlns="http://santedb.org/data">
  <update skipIfError="true" insertIfNotExists="true">
    <Concept xmlns="http://santedb.org/model">
      <id>ff4fb688-5a91-11eb-ae93-0242ac130002</id>
      <isReadonly>false</isReadonly>
      <mnemonic>OccupationType-ElboniaParliamentarian</mnemonic>
      <statusConcept>c8064cbd-fa06-4530-b430-1a52f1530c27</statusConcept>
      <conceptClass>0d6b3439-c9be-4480-af39-eeb457c052d0</conceptClass>
      <name>
        <language>en</language>
        <value>Parliamentarian of Elbonia</value>
      </name>
      <conceptSet>f76f4eac-487c-11eb-b378-0242ac130002</conceptSet>
    </Concept>
  </update>
  <update insertIfNotExists="true">
    <SecurityPolicy xmlns="http://santedb.org/model">
      <id>e347d512-5f3c-11eb-bec6-00155d640b23</id>
      <name>Health Record of Politician</name>
      <oid>2.25.143743319928604103332532813070351420225</oid>
      <isPublic>true</isPublic>
      <canOverride>false</canOverride>
    </SecurityPolicy>
  </update>
</dataset>

Create a new Business Rules File

Create a new JavaScript file in the rules/ folder of your applet / plugin for SanteMPI. The basic structure of this file should be:

Write Rule Code

Next, you'll want to write some code that flags our parliamentarian .

Attach the Business Rule

Finally, add the business rule to the BeforeInsert and BeforeUpdate method on an incoming patient whose occupation code matches our occupation listed above.

Last updated

Was this helpful?