Plug and play DATASETS with ObjectScript Package Manager (ZPM)
Tags: csp, javascript, programming, zpm
Published: 2022-07-24 21:39:07

With the release of [InterSystems IRIS 2021.2 Preview](https://community.intersystems.com/post/intersystems-iris-and-iris-health-20212-preview-published) and all-new [LOAD DATA](http://irisdocs.intersystems.com/iris20212/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_loaddata) functionality dataset can by added with [Objectscript Package Manager (ZPM)](https://github.com/intersystems-community/zpm/wiki) 

[Medical Datasets](https://openexchange.intersystems.com/package/Medical-Datasets-1) contains following 12 datasets. For dataset tables and data details please visit [ONLINE DEMO](https://medicaldatasets.demo.community.intersystems.com/csp/datasets/index.csp) by using SuperUser | SYS 

<table>
  <tr>
    <th>
      ID
    </th>
    
    <th>
      Dataset Name
    </th>
    
    <th>
      Tables
    </th>
    
    <th>
      Licence
    </th>
  </tr>
  
  <tr>
    <td>
      1
    </td>
    
    <td>
      Synthetic Medical Data
    </td>
    
    <td>
      11
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      2
    </td>
    
    <td>
      Health Care Analytics - 1
    </td>
    
    <td>
      8
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      3
    </td>
    
    <td>
      Global Suicide Data
    </td>
    
    <td>
      7
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      4
    </td>
    
    <td>
      COVID-19 Polls1
    </td>
    
    <td>
      7
    </td>
    
    <td>
      CC-BY
    </td>
  </tr>
  
  <tr>
    <td>
      5
    </td>
    
    <td>
      Cancer Rates by U.S. State
    </td>
    
    <td>
      2
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      6
    </td>
    
    <td>
      Opioid Overdose Deaths
    </td>
    
    <td>
      2
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      7
    </td>
    
    <td>
      Heart Disease Prediction
    </td>
    
    <td>
      1
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      8
    </td>
    
    <td>
      Yellowpages medical services dataset
    </td>
    
    <td>
      1
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      9
    </td>
    
    <td>
      Hospital ratings
    </td>
    
    <td>
      1
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      10
    </td>
    
    <td>
      Heart Failure Prediction
    </td>
    
    <td>
      1
    </td>
    
    <td>
      (CC BY 4.0)
    </td>
  </tr>
  
  <tr>
    <td>
      11
    </td>
    
    <td>
      Diabetes Dataset
    </td>
    
    <td>
      1
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
  
  <tr>
    <td>
      12
    </td>
    
    <td>
      Chronic Kidney Disease
    </td>
    
    <td>
      1
    </td>
    
    <td>
      Public Domain
    </td>
  </tr>
</table>

<!--break-->

  
In order to use any of the above listed dataset we can add in our namespace by using dataset ID, So Let's add Synthetic medical dataset 

### First of all we need to install dataset-medical package which can be done by using below command:

    zpm "install dataset-medical


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdpkzrtpem8xe8oh5zgz.png)

Now we are ready to import dataset. Dataset can be added or removed either by Terminal or by Web Application 

##  
ADDING DATASET FROM TERMINAL

### We can add dataset by calling ImportDS function of dc.data.medical.utility class by passing dataset ID from terminal:

    do ##class(dc.data.medical.utility).ImportDS(1)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7v0i2nq8u4i5rxcdsh0b.png) 

### That's it, Our first dataset is created. 

 

### Dataset "synthetic" is created with 11 Tables and 83,341 records, which can be confirm by Management Portal


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5xuqitcwxjp0byoept29.png) 

### <u>Removing Dataset</u>

Use below command to remove particular dataset by passing it's ID 

    do ##class(dc.data.medical.utility).RemoveDS(1)

### <!--break-->

<u>Adding ALL datasets</u>

To install all the datasets pass 999 to ImportDS function

    do ##class(dc.data.medical.utility).ImportDS(999)

### <u>Removing ALL datasets</u>

 And to remove all the datasets pass 999 to RemoveDS function

    do ##class(dc.data.medical.utility).RemoveDS(999)

<!--break-->

##  
ADDING DATASET FROM TERMINAL

Navigate to <a href="http://localhost:52773/csp/datasets/index.csp" rel="nofollow">http://localhost:52773/csp/datasets/index.csp</a> and press Install DataSet button <a href="https://user-images.githubusercontent.com/18219467/148712707-f4dc38ec-d86b-4df2-8b8c-2ea2235a57c7.png" rel="nofollow"><img alt="image" src="https://user-images.githubusercontent.com/18219467/148712707-f4dc38ec-d86b-4df2-8b8c-2ea2235a57c7.png" /></a> <a href="https://user-images.githubusercontent.com/18219467/148711619-c01c3207-b30f-45c9-9c42-a861ea008062.png" rel="nofollow"><img alt="image" src="https://user-images.githubusercontent.com/18219467/148711619-c01c3207-b30f-45c9-9c42-a861ea008062.png" /></a>

######  

## <u>View Data from Web Application</u>

###### Navigate to <a href="http://localhost:52773/csp/datasets/index.csp" rel="nofollow">http://localhost:52773/csp/datasets/index.csp</a> and click any table from sidebar<a href="https://user-images.githubusercontent.com/18219467/148712249-b6b2fbd9-2170-467a-8388-3e3e6eba5bfa.png" rel="nofollow"><img alt="image" src="https://user-images.githubusercontent.com/18219467/148712249-b6b2fbd9-2170-467a-8388-3e3e6eba5bfa.png" /></a>

## Removing DataSet from Web Application

###### Navigate to <a href="http://localhost:52773/csp/datasets/index.csp" rel="nofollow">http://localhost:52773/csp/datasets/index.csp</a> and press Remove DataSet button

<a href="https://user-images.githubusercontent.com/18219467/148713154-009dac5d-3f7d-4e57-bbc2-72ba7f1589ba.png" rel="nofollow"><img alt="image" src="https://user-images.githubusercontent.com/18219467/148713154-009dac5d-3f7d-4e57-bbc2-72ba7f1589ba.png" /></a>

###### Dataset is removed successfully

<a href="https://user-images.githubusercontent.com/18219467/148713212-d094cf64-7b8e-4879-aaf8-30cb65ce49d0.png" rel="nofollow"><img alt="image" src="https://user-images.githubusercontent.com/18219467/148713212-d094cf64-7b8e-4879-aaf8-30cb65ce49d0.png" /></a>

<h2 data-id="voting" data-original-id="false" id="voting">
   
</h2>

Thanks