# Accessing clinical records using almirah

```python
from almirah import Database
```

```python
db = Database(name="calm-brain", host="https://www.calm-brain.ncbs.res.in/db-request/" , backend="request")
db
```

    <Database url: 'request:calm-brain@https://www.calm-brain.ncbs.res.in/db-request/'>

```python
db.connect("username", "password")
df = db.query(table="presenting_disorders")
df[["subject", "session", "addiction"]].head()
```

<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>subject</th>
      <th>session</th>
      <th>addiction</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>D0019</td>
      <td>101</td>
      <td>0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>D0019</td>
      <td>111</td>
      <td>0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>D0020</td>
      <td>101</td>
      <td>0</td>
    </tr>
    <tr>
      <th>3</th>
      <td>D0020</td>
      <td>111</td>
      <td>&lt;NA&gt;</td>
    </tr>
    <tr>
      <th>4</th>
      <td>D0021</td>
      <td>101</td>
      <td>0</td>
    </tr>
  </tbody>
</table>
</div>

```python
len(df)
```

    2561

```python
len(df[df["addiction"] == 1])
```

    522


