IntraNet 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

EndpointMethodDescription
http://SERVER_IP:PORT/api/loginPOSTIssue an access token which is required to access Vitalserver APIs.
http://SERVER_IP:PORT/api/bedlistGETRetrieve a bed list registered on Vitalserver.
http://SERVER_IP:PORT/api/receiveGETReturns web monitoring data by bedname and dt
http://SERVER_IP:PORT/adt/yyyy/mm/ddGETReturns hid-filename list in csv file.
http://SERVER_IP:PORT/api/filelistGETRead file list of uploaded user files.
http://SERVER_IP:PORT/api/tracklistGETGet a tracklist of files.
http://SERVER_IP:PORT/api/downloadGETDownload 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.

FieldType
idString
pwString

Return Value

Content-type: application/json

FieldTypeDescription
access_tokenStringAn access token which is required to access Vitalserver APIs.
token_typeStringAlways “bearer”, which is used for OAuth2.
expires_inNumberAlways 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.

FieldType
access_tokenString

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', 'SERVERIP', 'SERVERPORT'):

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

FieldTypeRequired
yyyystringRequired
mmstringOptional
ddstringOptional

Return Value

  • Content-Disposition: attachment;filename=yyyymmdd.csv;
  • Content-Type:text/csv
FieldTypeDescription
hid1StringPatient ID
hid2StringPatient ID
filenameStringVital Filename (bednameyymmddhhmmss.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
access_token String Required
bedname String Optional
dtstart Unix timestamp Optional
dtend Unix timestamp Optional
dtuploadstart

Unix

timestamp

Optional
dtuploadend

Unix

timestamp

Optional
hid String Optional

Return Value

  • Content-Disposition: attachment;filename=json.gz;
  • Content-Type: application/x-gzip
FieldTypeDescription
json.gzFileA gzip compressed file that contains a list of file information in JSON format
filenameStringFile name (ex) DEMO210415091812.vital
filesizeNumberFile size in bytes
dtstartDatetimeRecording start time
dtendDatetimeRecording end time
dtuploadDatetimeUploaded 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', 'SERVERIP', 'SERVERPORT'):

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
access_token String Required
bedname String Optional
dtstart Unix timestamp Optional
dtend Unix timestamp Optional
dtuploadstart

Unix

timestamp

Optional
dtuploadend

Unix

timestamp

Optional

Return Value

  • Content-Disposition: attachment;filename=json.gz;
  • Content-Type: application/x-gzip
FieldTypeDescription
json.gzFileA gzip compressed file that contains a list of file information in JSON format
filenameStringFile name (ex) DEMO210415091812.vital
trksArray/ListTrack list (ex) [‘SNUH/SNUADC’,...]

Sample Codes

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

import vitaldb

if vitaldb.login('ID', 'PASSWORD', 'SERVERIP', 'SERVERPORT'):

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

print(res)

\# Result Example: [{'filename': 'SICU212230710000010.vital', 'trks': ['Intellivue/FLOWWAV', 'Intellivue/AWPWAV', 'Intellivue/ECGII_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.

FieldType
access_tokenString
filenameString
asurlBoolean

Return Value

FieldTypeDescription
Vital FileFileA vital file (if asurl is not 1)
URL for downloading vital fileStringIf 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', 'SERVERIP', 'SERVERPORT'):

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

print(vf.gettracknames())

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', 'SERVERIP', 'SERVERPORT'):

for idx, row in df.iterrows():

filename = row['filename']

opath = DOWNLOAD_DIR + '/' + filename

if os.path.exists(opath):

continue

vitaldb.download(filename, DOWNLOAD_DIR)