IntraNet VitalDB API

Introduction

Anyone can access and use the Vitalserver platform by application programming interface (API). All API’s can be called using the http standard protocol.

Endpoints

Endpoint

Method

Description

http://SERVER_IP:PORT/api/login

POST

Issue an access token which is required to access Vitalserver APIs.

http://SERVER_IP:PORT/api/bedlist

GET

Retrieve a bed list registered on Vitalserver.

http://SERVER_IP:PORT/api/receive

GET

Returns web monitoring data by bedname and dt

http://SERVER_IP:PORT/adt/yyyy/mm/dd

GET

Returns hid-filename list in csv file.

http://SERVER_IP:PORT/api/filelist

GET

Read file list of uploaded user files.

http://SERVER_IP:PORT/api/tracklist

GET

Get a tracklist of files.

http://SERVER_IP:PORT/api/download

GET

Download a vital file from the cloud.

Login API

Issue an access token which is required to access Vitalserver APIs.

Endpoint

http://SERVER_IP:PORT/api/login

Method

POST

Parameters

Please url-encode (RFC1738) the parameters if it has any special characters.

Field

Type

Required

Description

id

String

Required

Vitalserver user ID

pw

String

Required

Vitalserver user password

Return Value

Content-type: application/json

Field

Type

Description

access_token

String

An access token which is required to access Vitalserver APIs.

token_type

String

Always “bearer”, which is used for OAuth2.

expires_in

Number

Always 3600. The access token expires in an hour.

Sample Codes

curl -v -d “id=userid&pw=password” http://SERVER_IP:PORT/api/login

Bed list API

Retrieve a bed list registered on Vitalserver.

Endpoint

http://SERVER_IP:PORT/api/bedlist

Method

GET

Parameters

Please url-encode (RFC1738) the parameters if it has any special characters.

Field

Type

Required

Description

access_token

String

Required

An access token which is required to access Vitalserver APIs.

Return Value

Content-Type: application/json; charset=utf-8

Array of bed list

Sample Codes

curl -v -d “access_token=xxxxxxxxx” http://SERVER_IP:PORT/api/bedlist

Real-time API

Receive

Returns vital sign data of input bed name, start time, and end time as long as the account has permission.

Endpoint

http://SERVER_IP:PORT/api/receive

Method

GET

Parameter

Field

Type

Required

Description

access_token

String

Required

An Access token which is required to access Vitalserver APIs.

bedname

String

Required

Bedname

  • case-sensitive
  • comma-separation available for multiple bed request

dtstart

Unix Timestamp

Optional

Start time in Unix Timestamp format

  • Default: current time - 10 in second.

dtend

Unix Timestamp

Optional

End time in Unix Timestamp format.

  • Default: dtstart + 60, which is a minute after from dtstart
  • Max value: dtstart + 3600, must be within an hour from dtstart.

Return Value

Content-Type: application/json; charset=utf-8

Content-Encoding: gzip

Gzipped JSON encoded data

Sample Codes

Sample code below downloads real-time data from the bed whose vrcode is ‘sample’.

Please use “pip install vitaldb” before running our sample code.

import vitaldb

import json

if vitaldb.login('ID', 'PASSWORD', 'SERVER_IP', 'SERVER_PORT'):

    res = vitaldb.receive(bedname='TEST1, TEST2')

    for key in res:

        res[key] = res[key]

        print(res[key].keys())

    with open('result.json', 'w', encoding='utf-8') as f:

        json.dump(res, f, ensure_ascii=False, indent=4)

Myfiles API

ADT

returns .csv file of adt list (filename - hid matching list)

* might not be applicable to some hospitals for the security issue

Endpoint

http://SERVER_IP:PORT/adt/yyyy/mm/dd

Method

GET

Parameters

Field

Type

Required

Description

yyyy

string

Required

4-digit year

mm

string

Optional

2-digit month

dd

string

Optional

2-digit day

Return Value

  • Content-Disposition: attachment;filename=yyyymmdd.csv;
  • Content-Type:text/csv

Field

Type

Description

hid1

String

Patient ID

hid2

String

Patient ID

filename

String

Vital Filename (bedname_yymmdd_hhmmss.vital)

File List

Read file list of uploaded user files.

Endpoint

http://SERVER_IP:PORT/api/filelist

Method

GET

Parameters

Please url-encode (RFC1738) the parameters if it has any special characters.

Field

Type

Required

Description

access_token

String

Required

An Access token which is required to access Vitalserver APIs.

bedname

String

Optional

Filter file list by bedname

  • case-sensitive
  • comma separation available
  • filename LIKE %bedname%

dtstart

Unix timestamp

Optional

Filter file list by unix timestamp (file start time >= dtstart)

dtend

Unix timestamp

Optional

Filter file list by unix timestamp (file start time <= dtend)

dtuploadstart

Unix

timestamp

Optional

Filter file list by upload date in unix timestamp (file upload time >= dtuploadstart)

dtuploadend

Unix

timestamp

Optional

Filter file list by upload date in unix timestamp (file upload time >= dtuploadend)

hid

String

Optional

if set to “1”, return result includes hid

Return Value

  • Content-Disposition: attachment;filename=json.gz;
  • Content-Type: application/x-gzip

Field

Type

Description

json.gz

File

A gzip compressed file that contains a list of file information in JSON format

    filename

String

File name (ex) DEMO_210415_091812.vital

    filesize

Number

File size in bytes

    dtstart

Datetime

Recording start time

    dtend

Datetime

Recording end time

    dtupload

Datetime

Uploaded or lastly modified datetime

Sample Codes

curl -i http://SERVER_IP:PORT/api/filelist?access_token=xxxxxxxx --output json.gz

Please use “pip install vitaldb” before running our sample code.

import vitaldb

import os

import datetime

DOWNLOAD_DIR = "path/to/folder"

if not os.path.exists(DOWNLOAD_DIR):

    os.mkdir(DOWNLOAD_DIR)

if vitaldb.login('ID', 'PASSWORD', 'SERVER_IP', 'SERVER_PORT'):

    for f in vitaldb.filelist(bedname="D1", dtstart="2010-10-01", dtend="2010-10-02")

        opath = DOWNLOAD_DIR + "/" + f['filename']

        if os.path.exists(opath):

            continue

        vitaldb.download(f['filename'], opath)

Track List

Get a tracklist of files

Endpoint

http://SERVER_IP:PORT/api/tracklist

Method

GET

Parameters

Please url-encode (RFC1738) the parameters if it has any special characters.

Field

Type

Required

Description

access_token

String

Required

An Access token which is required to access Vitalserver APIs.

bedname

String

Optional

Filter file list by bedname (filename LIKE %bedname%)

dtstart

Unix timestamp

Optional

Filter file list by unix timestamp (file start time >= dtstart)

dtend

Unix timestamp

Optional

Filter file list by unix timestamp (file start time <= dtend)

dtuploadstart

Unix

timestamp

Optional

Filter file list by upload date in unix timestamp (file upload time >= dtuploadstart)

dtuploadend

Unix

timestamp

Optional

Filter file list by upload date in unix timestamp (file upload time >= dtuploadend)

Return Value

  • Content-Disposition: attachment;filename=json.gz;
  • Content-Type: application/x-gzip

Field

Type

Description

json.gz

File

A gzip compressed file that contains a list of file information in JSON format

    filename

String

File name (ex) DEMO_210415_091812.vital

    trks

Array/List

Track list (ex) [‘SNUH/SNUADC’,...]

Sample Codes

Please use “pip install vitaldb” before running our sample code.

import vitaldb

if vitaldb.login('ID', 'PASSWORD', 'SERVER_IP', 'SERVER_PORT'):

    res = vitaldb.tracklist(bedname='SICU2_12', dtstart="2023-07-10", dtend="2023-07-10")

    print(res)

    # Result Example: [{'filename': 'SICU2_12_230710_000010.vital', 'trks': ['Intellivue/FLOW_WAV', 'Intellivue/AWP_WAV', 'Intellivue/ECG_II_WAV']}, ...]

Download

Download a vital file from the cloud.

Endpoint

http://SERVER_IP:PORT/api/download

Method

GET

Parameters

Please url-encode (RFC1738) the parameters if it has any special characters.

Field

Type

Required

Description

access_token

String

Required

An Access token which is required to access Vitalserver APIs. Please read OAuth2 API Document for more information.

filename

String

Required

filename to download

asurl

Boolean

Optional

If asurl is 1, the download API will return a download url instead of .vital file.

Return Value

Field

Type

Description

Vital File

File

A vital file (if asurl is not 1)

URL for downloading vital file

String

If asurl is 1, the url for downloading the vital file will be sent.

Sample Codes

curl -i http://SERVER_IP:PORT/api/download?access_token=xxxxxxxx&filename=xxx.vital

Sample code below downloads a specific vital file from Vitalserver to a local PC and prints the track names.

Please use “pip install vitaldb” before running our sample code.

import vitaldb

if vitaldb.login('ID', 'PASSWORD', 'SERVER_IP', 'SERVER_PORT'):

    vf = vitaldb.VitalFile(vitaldb.download('TEST1_211020_142621.vital'))

    print(vf.get_track_names())

Sample code below reads filenames from an Excel file and downloads them to a local PC.

Please use “pip install vitaldb” before running our sample code.

import vitaldb

import os

import pandas as pd

DOWNLOAD_DIR = 'path/to/folder'

if not os.path.exists(DOWNLOAD_DIR):

    os.mkdir(DOWNLOAD_DIR)

df = pd.read_excel('list.xlsx')

if vitaldb.login('ID', 'PASSWORD', 'SERVER_IP', 'SERVER_PORT'):

    for idx, row in df.iterrows():

        filename = row['filename']

        opath = DOWNLOAD_DIR + '/' + filename

        if os.path.exists(opath):

            continue

        vitaldb.download(filename, DOWNLOAD_DIR)