04. Virtual Population
How to create a Virtual Population (VPOP)
A Virtual Population (VPOP) is a cohort of virtual patients created based on statistical distributions or predefined datasets. This section explains how to upload and manage VPOPs using the Jinko API.
Posting a VPOP
You can upload a VPOP in either JSON or CSV format. The two requests below create a virtual population of 2 patients with 2 descriptors.
In JSON Format
import jinko_helpers as jinko
json_vpop = {
"patients": [
{
"patientAttributes": [
{"id": "age", "val": 45},
{"id": "weight", "val": 70},
],
"patientIndex": "1",
},
{
"patientAttributes": [
{"id": "age", "val": 50},
{"id": "weight", "val": 80},
],
"patientIndex": "2",
},
]
}
jinko.make_request(
path='/core/v2/vpop_manager/vpop',
method='POST',
json=json_vpop,
options={
"name": "Example VPOP",
"input_format": "application/json",
"folder_id": "folder-id-123"
}
)
In CSV Format
import jinko_helpers as jinko
csv_vpop = """patientIndex,age,weight
1,45,70
2,50,80"""
jinko.make_request(
path='/core/v2/vpop_manager/vpop',
method='POST',
data=csv_vpop,
options={
"name": "Example VPOP",
"input_format": "text/csv",
"folder_id": "folder-id-123"
}
)
Additional Resources
For more information about the VPOP format and requirements, check out the VPOP creation guide.