Code Monkey home page Code Monkey logo

microbiome-api's Introduction

microbiome API :atom:

LinkedIn MIT License

Human microbiome API 🦠 🧬

About The Project

API is implemented with django and mongodb to make various operations on Human Microbiome Dataset.

1 - 🔓 Collect dataset from HMP Kaggle
2 - 🔧 Re-format the data dividing it into collections that make it more compatible to MongoDB structure

autodraw 5_22_2023


disease-2023-05-17_21.01.02.mp4

3 - ⚒️ make all the queries that satisfy all the important information about this dataset
4 - ⚖️ use django to handle frontend requests

Project Goals :

  • 💊 Data Accessibility : provide a standardized and easily accessible interface for researchers, scientists, and other stakeholders to interact with the Human Microbiome Data. They can access the data remotely, integrate it into their own workflows,without needing to understand the underlying data storage or processing mechanisms.
  • 🩺 Advanced Querying and Analysis : Researchers can perform complex queries to extract specific subsets of data based on various criteria, such as body sites, sequencing methods, or disease statuses using one API endpoint.
  • 🔭 Documentation and Standardization : provide comprehensive documentation and standardization for the Human Microbiome Data. includes describing the data structure,explaining the API endpoints and usage.

but why MongoDB not SQL(Postgres,MySQL,....) :

  • 🔨 Scalability : MongoDB is a NoSQL database that suitable for handling large volumes of data. The Human Microbiome Data dataset is extensive, involving samples from 18 different body sites and potentially thousands of individuals.
  • 🔨 Flexibility : The Human Microbiome Data encompasses various data types, such as 16S bacterial marker gene sequencing, whole metagenome shotgun sequencing, and whole genome sequencing. With MongoDB, we can store and retrieve these diverse data types without the need for extensive schema modifications.
  • 🔨 Querying and Aggregation : MongoDB provides a powerful querying and aggregation framework, which is particularly advantageous when working with large datasets so we can perform complex queries and aggregations on the Human Microbiome Data to extract specific information or derive meaningful insights.
  • ⚠️ used redis to :
    • 🔨 Performance Improvement: The Human Microbiome Data is a large dataset resulting from a collaborative effort involving thousands of Biological Informations. By caching the results of Django views with Redis ,significantly improved the performance of application.
    • 🔨 Reduced Database Load: Caching the results of Django views with Redis helps reduce the load on the primary database. Instead of querying the database for every request, we can serve cached results directly from Redis.

Built With

  • Python
  • Django
  • MongoDB
  • Redis

Getting started

  • Python <= 3.10.6
  • Pip <= 22.0.2
  • Python virtual environment
  1. Clone the repo
    git clone https://github.com/mohmmedfathi/Microbiome-API.git && cd Microbiome-API
  2. Create virtual environment
    python3 -m venv venv
  3. Activate virtual environment
    source venv/bin/activate
  4. Install requirements
    pip install -r requirements.txt
  5. Migrate models
    python manage.py migrate
  6. Run server
    python manage.py runserver 

Project Layout

├── microbiome
|   ├── settings.py
|   ├── urls.py
|
├── human_info
|   ├── urls.py
│   ├── views.py
│   ├── pymongo.py
|
│── project_info
|   ├── urls.py
|   ├── views.py
│   ├── pymongo.py
|
|── disease_info
|   ├── urls.py
|   ├── views.py
│   ├── pymongo.py

A brief description project:


the project is consist of 3 apps (each one of them represent collection in MongoDB) : human_info attribute :

carbon


  • project_info attribute :

carbon (1)

  • disease_info attribute :

carbon (2)

human_info app endpoints

endpoints of human

1 - list all disease_info data

    GET /human_info/list/

sample output :

[
    {
        "_id": 15,
        "HMP_ID": "23",
        "GOLD_ID": "Gi02599",
        "Organism_Name": "Acinetobacter sp. ATCC 27244",
        "Domain": "BACTERIAL",
        "NCBI_Superkingdom": "Bacteria Asd",
        "HMP_Isolation_Body_Site": "skin"
    },
    {
        "_id": 16,
        "HMP_ID": "26",
        "GOLD_ID": "Gi03419",
        "Organism_Name": "Acinetobacter junii SH205",
        "Domain": "BACTERIAL",
        "NCBI_Superkingdom": "Bacteria",
        "HMP_Isolation_Body_Site": "gastrointestinal_tract"
    }
  ]

2 - show specific record

    GET /human_info/human_id
    

note : human_id is Integer sample output :

{
    "_id": 16,
    "HMP_ID": "26",
    "GOLD_ID": "Gi03419",
    "Organism_Name": "Acinetobacter junii SH205",
    "Domain": "BACTERIAL",
    "NCBI_Superkingdom": "Bacteria",
    "HMP_Isolation_Body_Site": "gastrointestinal_tract"
}

3 - Create one disease_info

POST /human_info/create_one/

sample input :

{
"_id":99999,
"HMP_ID":"26",
"GOLD_ID":"GOPP",
"Organism_Name":"Acinetobacter junii SH205",
"Domain":"BACTERIAL",
"NCBI_Superkingdom":"Bacteria",
"HMP_Isolation_Body_Site":"gastrointestinal_tract"
}

sample output :

{
    "message": "human_info added",
    "human_info_id": "99999"
}

4 - Create bulk human_info

POST /human_info/create_many/

sample input :

[
    {
        "_id": 9955,
        "HMP_ID": "26",
        "GOLD_ID": "oppo",
        "Organism_Name": "Acinetobacter junii SH205",
        "Domain": "BACTERIAL",
        "NCBI_Superkingdom": "Bacteria",
        "HMP_Isolation_Body_Site": "gastrointestinal_tract"
    },
    {
        "_id": 6655,
        "HMP_ID": "26",
        "GOLD_ID": "oppo",
        "Organism_Name": "Acinetobacter junii SH205",
        "Domain": "BACTERIAL",
        "NCBI_Superkingdom": "Bacteria",
        "HMP_Isolation_Body_Site": "gastrointestinal_tract"
    }
]

sample output :

{
    "message": "2 documents inserted"
}

5 - create MongoDB index

example :

    GET /human_info/create_index?field=HMP_ID&order=1

sample output :

Index created on field "HMP_ID" with name "HMP_ID_1" 
 current indexes = "{'_id_': {'v': 2, 'key': [('_id', 1)]}, 'HMP_ID_1': {'v': 2, 'key': [('HMP_ID', 1)]}}"

6 - show all indexes

    GET /disease_info/show_indexes/

sample output :

{
    "_id_": {
        "v": 2,
        "key": [
            [
                "_id",
                1
            ]
        ]
    },
    "HMP_ID_1": {
        "v": 2,
        "key": [
            [
                "HMP_ID",
                1
            ]
        ]
    }
}

project_info app endpoints

endpoints of project

1 - list all project_info data

⚠️ ❌ 🥱 without redis

Screenshot from 2023-05-22 22-57-13

✔️ 🔱 with redis

Screenshot from 2023-05-22 22-58-13

    GET /project_info/list/

sample output :

[
  {
    "_id": {
      "$oid": "646511d204a42e20e5795a0b"
    },
    "Human_id": 0,
    "Project_Status": "Complete",
    "NCBI Current_Finishing_Level": "Level 3: Improved-High-Quality Draft",
    "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
    "NCBI Project ID": "33011",
    "Genbank ID": "ACIN00000000",
    "Gene Count": "1950",
    "IMG": "643886181",
    "HOMD ID": "HOMD: tax_389",
    "Sequencing Center": "Washington University Genome Sequencing Center",
    "Funding Source": "NIH-HMP Jumpstart Supplement",
    "Strain Repository ID": "ATCC 49176, CIP 103242"
  },

  {
    "_id": {
      "$oid": "646511db04a42e20e5795a1c"
    },
    "Human_id": 17,
    "Project_Status": "Complete",
    "NCBI Current_Finishing_Level": "Level 2: High-Quality Draft",
    "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
    "NCBI Project ID": "52977",
    "Genbank ID": "AEVG00000000",
    "Gene Count": "2475",
    "IMG": "649989900",
    "HOMD ID": "",
    "Sequencing Center": "Baylor College of Medicine",
    "Funding Source": "NIH-HMP Jumpstart Supplement",
    "Strain Repository ID": "ATCC 25976, NCTC 10219"
  },
  {
    "_id": {
      "$oid": "646511dc04a42e20e5795a1d"
    },
    "Human_id": 18,
    "Project_Status": "Complete",
    "NCBI Current_Finishing_Level": "Level 2: High-Quality Draft",
    "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
    "NCBI Project ID": "173932",
    "Genbank ID": "AWSB00000000",
    "Gene Count": "2320",
    "IMG": "0",
    "HOMD ID": "",
    "Sequencing Center": "Washington University Genome Sequencing Center",
    "Funding Source": "NIH-HMP Sequencing Center",
    "Strain Repository ID": "BEI HM-1065"
  }
  ]

2 - show specific record

    GET /project_info/Human_id
    

note : Human_id is Integer sample output :

{
    "_id": {
        "$oid": "646511d204a42e20e5795a0c"
    },
    "Human_id": 1,
    "Project_Status": "Complete",
    "NCBI Current_Finishing_Level": "Level 2: High-Quality Draft",
    "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
    "NCBI Project ID": "46343",
    "Genbank ID": "ADMS00000000",
    "Gene Count": "5755",
    "IMG": "647000200",
    "HOMD ID": "",
    "Sequencing Center": "Baylor College of Medicine",
    "Funding Source": "NIH-HMP Jumpstart Supplement",
    "Strain Repository ID": "ATCC 43553, CIP 55774, LMG 6100"
}

3 - Create one project_info

POST /project_info/create_one/

sample input :

{
  "Human_id": 1111,
  "Project_Status": "inprogress",
  "NCBI Current_Finishing_Level": "Level 2",
  "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
  "NCBI Project ID": "38761",
  "Genbank ID": "ACRN00000000",
  "Gene Count": "1853",
  "IMG": "2513237375",
  "HOMD ID": "",
  "Sequencing Center": "Broad Institute",
  "Funding Source": "NIH-HMP Jumpstart Supplement",
  "Strain Repository ID": "BEI HM-236"
}

note : Human_id is unique

sample output :

{
    "message": "project_info added",
    "project_info_id": "6465700e1be9f8a7d146e228"
}

4 - Create bulk project_info

POST /project_info/create_many/

sample input :

[
    {
  "Human_id": 1112,
  "Project_Status": "complte",
  "NCBI Current_Finishing_Level": "Level 90",
  "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
  "NCBI Project ID": "38761",
  "Genbank ID": "ACRN00000000",
  "Gene Count": "1853",
  "IMG": "2513237375",
  "HOMD ID": "",
  "Sequencing Center": "Broad Institute",
  "Funding Source": "NIH-HMP Jumpstart Supplement",
  "Strain Repository ID": "BEI HM-236"
},
    {
  "Human_id": 1113,
  "Project_Status": "inprogress",
  "NCBI Current_Finishing_Level": "Level 1",
  "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
  "NCBI Project ID": "38761",
  "Genbank ID": "ACRN00000000",
  "Gene Count": "1853",
  "IMG": "2513237375",
  "HOMD ID": "",
  "Sequencing Center": "Broad Institute",
  "Funding Source": "NIH-HMP Jumpstart Supplement",
  "Strain Repository ID": "BEI HM-236"
}
]

note : Human_id is unique

sample output :

{
    "message": "2 documents inserted"
}

5 - MongoDB aggregatation Endpoint

Aggregate all project_info objects with optional filtering by domain, sorting, and grouping.

Query parameters:

  • domain: filter by domain (optional)
  • sort_by: sort by field (optional)
  • group_by: group by field (optional)

how to use the endpoit :

carbon

example :

 GET  /project_info/aggregate_project_info?
  Project_Status=Complete&
  sort_by=31019&
  group_by=Gene Count

sample output :

carbon


  [
  {
    "data": {
      "_id": {
        "$oid": "646511d204a42e20e5795a0b"
      },
      "Human_id": 0,
      "Project_Status": "Complete",
      "NCBI Current_Finishing_Level": "Level 3: Improved-High-Quality Draft",
      "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
      "NCBI Project ID": "33011",
      "Genbank ID": "ACIN00000000",
      "Gene Count": "1950",
      "IMG": "643886181",
      "HOMD ID": "HOMD: tax_389",
      "Sequencing Center": "Washington University Genome Sequencing Center",
      "Funding Source": "NIH-HMP Jumpstart Supplement",
      "Strain Repository ID": "ATCC 49176, CIP 103242"
    }
  },
  {
    "data": {
      "_id": {
        "$oid": "646511d204a42e20e5795a0c"
      },
      "Human_id": 1,
      "Project_Status": "Complete",
      "NCBI Current_Finishing_Level": "Level 2: High-Quality Draft",
      "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
      "NCBI Project ID": "46343",
      "Genbank ID": "ADMS00000000",
      "Gene Count": "5755",
      "IMG": "647000200",
      "HOMD ID": "",
      "Sequencing Center": "Baylor College of Medicine",
      "Funding Source": "NIH-HMP Jumpstart Supplement",
      "Strain Repository ID": "ATCC 43553, CIP 55774, LMG 6100"
    }
  },
  {
    "data": {
      "_id": {
        "$oid": "646511d304a42e20e5795a0d"
      },
      "Human_id": 2,
      "Project_Status": "Complete",
      "NCBI Current_Finishing_Level": "Level 5: Non-contiguous Finished",
      "NCBI_Submission_Status": "6. annotation (and sequence) public on NCBI site",
      "NCBI Project ID": "38739",
      "Genbank ID": "ACRC00000000",
      "Gene Count": "6010",
      "IMG": "0",
      "HOMD ID": "HOMD: tax_343",
      "Sequencing Center": "Broad Institute",
      "Funding Source": "NIH-HMP Jumpstart Supplement",
      "Strain Repository ID": "BEI HM-235"
    }
  }
]

6 - create MongoDB index

carbon (1)

example :

    GET /human_info/create_index?field=HMP_ID&order=1

sample output :

Index created on field "HMP_ID" with name "HMP_ID_1" 
 current indexes = "{'_id_': {'v': 2, 'key': [('_id', 1)]}, 'HMP_ID_1': {'v': 2, 'key': [('HMP_ID', 1)]}}"

7 - show all indexes

    GET /project_info/show_indexes/

sample output :

{
    "_id_": {
        "v": 2,
        "key": [
            [
                "_id",
                1
            ]
        ]
    },
    "HMP_ID_1": {
        "v": 2,
        "key": [
            [
                "HMP_ID",
                1
            ]
        ]
    }
}

disease_info app endpoints

endpoints of disease

1 - list all disease_info data

    GET /disease_info/list/

sample output :

[
  {
    "_id": 1,
    "disease": "MED.DISEASES.Blood.Anemia",
    "MED.DISEASES.Blood.Anemia": "1",
    "MED.DISEASES.Blood.Thrombosis": "0.030155518",
    "MED.DISEASES.Cancer.Any": "0.023660698",
    "MED.DISEASES.Cardiovascular.Arrythmia.MedDiagnosed": "0.034828556",
    "MED.DISEASES.Cardiovascular.Colesterol.high": "-0.013506254",
    "MED.DISEASES.Cardiovascular.Heart.Attack": "-0.026579618",
    "MED.DISEASES.Cardiovascular.Heart.Failure.Disorder": "-0.005956634",
    "MED.DISEASES.Cardiovascular.Heartrate.complains": "0.092097199",
    "MED.DISEASES.Cardiovascular.Hypertension": "0.032507649",
    "MED.DISEASES.Endocrine.DiabetesT2": "0.001839968",
    "MED.DISEASES.Gastrointestinal.Stomach.Ulcer": "0.024063959",
    "MED.DISEASES.Hepatologic.Gallstones": "0.064607811",
    "MED.DISEASES.Mental.Any": "0.109039221",
    "MED.DISEASES.Mental.Burn.Out": "0.039675773",
    "MED.DISEASES.Mental.Depression": "0.048660138",
    "MED.DISEASES.Mental.Other.anxiety": "0.051273785",
    "MED.DISEASES.Mental.Panic.disorder": "0.054330785",
    "MED.DISEASES.Neurological.Dizziness.Falling": "0.013315382",
    "MED.DISEASES.Neurological.Mental.Fibromyalgia": "0.068923906",
    "MED.DISEASES.Neurological.Migraine": "0.138918931",
    "MED.DISEASES.Other.Autoimmune.Rheumatoid.Artritis": "0.033217646",
    "MED.DISEASES.Skin.Autoimmune.Atopic.dermatitis": "0.103226315",
    "MED.DISEASES.Skin.Autoimmune.Psoriasis": "0.009517194",
    "MED.DISEASES.Skin.Autoimmune.Severe.acne": "0.060007583",
    "MED.DISEASES.Gastrointestinal.Rome3_IBS.Any": "0.04954944",
    "MED.DISEASES.None.No.Diseases": "-0.220571981"
  },
  {
    "_id": 2,
    "disease": "MED.DISEASES.Blood.Thrombosis",
    "MED.DISEASES.Blood.Anemia": "0.131026313",
    "MED.DISEASES.Blood.Thrombosis": "1",
    "MED.DISEASES.Cancer.Any": "0.023773871",
    "MED.DISEASES.Cardiovascular.Arrythmia.MedDiagnosed": "0.03904039",
    "MED.DISEASES.Cardiovascular.Colesterol.high": "0.04208665",
    "MED.DISEASES.Cardiovascular.Heart.Attack": "-0.013205939",
    "MED.DISEASES.Cardiovascular.Heart.Failure.Disorder": "-0.005303241",
    "MED.DISEASES.Cardiovascular.Heartrate.complains": "0.030620218",
    "MED.DISEASES.Cardiovascular.Hypertension": "0.03232672",
    "MED.DISEASES.Endocrine.DiabetesT2": "0.019818901",
    "MED.DISEASES.Gastrointestinal.Stomach.Ulcer": "0.006462143",
    "MED.DISEASES.Hepatologic.Gallstones": "0.039995356",
    "MED.DISEASES.Mental.Any": "0.007361899",
    "MED.DISEASES.Mental.Burn.Out": "0.012085357",
    "MED.DISEASES.Mental.Depression": "-0.00757754",
    "MED.DISEASES.Other.Osteoarthritis": "0.035991451",
    "MED.DISEASES.Other.Osteoporosis": "0.031793733",
    "MED.DISEASES.Other.RSI": "0.017164426",
    "MED.DISEASES.Pulmonary.Autoimmune.Asthma": "0.000583128",
    "MED.DISEASES.Pulmonary.COPD": "0.022380562",
    "MED.DISEASES.Skin.Autoimmune.Atopic.dermatitis": "0.001593836",
    "MED.DISEASES.Skin.Autoimmune.Psoriasis": "-0.005318063",
    "MED.DISEASES.Skin.Autoimmune.Severe.acne": "0.002060624",
    "MED.DISEASES.Gastrointestinal.Rome3_IBS.Any": "0.01101488",
    "MED.DISEASES.None.No.Diseases": "-0.080449008"
  }
  ]

2 - show specific record

    GET /disease_info/disease_id
    

note : disease_id is Integer sample output :

{
  "_id": 1,
  "disease": "MED.DISEASES.Blood.Anemia",
  "MED.DISEASES.Blood.Anemia": "1",
  "MED.DISEASES.Blood.Thrombosis": "0.030155518",
  "MED.DISEASES.Cancer.Any": "0.023660698",
  "MED.DISEASES.Cardiovascular.Arrythmia.MedDiagnosed": "0.034828556",
  "MED.DISEASES.Cardiovascular.Colesterol.high": "-0.013506254",
  "MED.DISEASES.Cardiovascular.Heart.Attack": "-0.026579618",
  "MED.DISEASES.Cardiovascular.Heart.Failure.Disorder": "-0.005956634",
  "MED.DISEASES.Cardiovascular.Heartrate.complains": "0.092097199",
  "MED.DISEASES.Cardiovascular.Hypertension": "0.032507649",
  "MED.DISEASES.Endocrine.DiabetesT2": "0.001839968",
  "MED.DISEASES.Gastrointestinal.Stomach.Ulcer": "0.024063959",
  "MED.DISEASES.Hepatologic.Gallstones": "0.064607811",
  "MED.DISEASES.Mental.Any": "0.109039221"
}

3 - Create one disease_info

POST /disease_info/create_one/

sample input :

{
  "_id": 100,
  "disease": "MED.DISEASES.Autism",
  "MED.DISEASES.Blood.Anemia": "2",
  "MED.DISEASES.Blood.Thrombosis": "0",
  "MED.DISEASES.Cancer.Any": "0",
  "MED.DISEASES.Cardiovascular.Arrythmia.MedDiagnosed": "0.034828556",
  "MED.DISEASES.Cardiovascular.Colesterol.high": "-0.013506254",
  "MED.DISEASES.Cardiovascular.Heart.Attack": "-0.026579618",
  "MED.DISEASES.Cardiovascular.Heart.Failure.Disorder": "-0.005956634",
  "MED.DISEASES.Cardiovascular.Heartrate.complains": "0.092097199",
  "MED.DISEASES.Cardiovascular.Hypertension": "0.032507649",
  "MED.DISEASES.Endocrine.DiabetesT2": "0.001839968",
  "MED.DISEASES.Gastrointestinal.Stomach.Ulcer": "0.024063959",
  "MED.DISEASES.Hepatologic.Gallstones": "0.064607811",
  "MED.DISEASES.Mental.Any": "0.109039221",
  "MED.DISEASES.Mental.Burn.Out": "0.039675773",
  "MED.DISEASES.Mental.Depression": "0.048660138",
  "MED.DISEASES.Mental.Other.anxiety": "0.051273785",
  "MED.DISEASES.Mental.Panic.disorder": "0.054330785",
  "MED.DISEASES.Neurological.Dizziness.Falling": "0.013315382",
  "MED.DISEASES.Neurological.Mental.Fibromyalgia": "0.068923906",
  "MED.DISEASES.Neurological.Migraine": "0.138918931",
  "MED.DISEASES.Other.Autoimmune.Rheumatoid.Artritis": "0.033217646",
  "MED.DISEASES.Other.Chronic.cystitis": "0.086287333",
  "MED.DISEASES.Other.Chronic.Inflammation.Throatnose": "0.051093201",
  "MED.DISEASES.Other.Chronic.Muscle.Weakness": "0.070110742",
  "MED.DISEASES.Other.Fractures.Other": "0.000555412",
  "MED.DISEASES.Other.Incontinence": "0.067330315",
  "MED.DISEASES.Other.Kidney.Stones": "-0.011400175",
  "MED.DISEASES.Other.Osteoarthritis": "0.055869733",
  "MED.DISEASES.Other.Osteoporosis": "0.039045686",
  "MED.DISEASES.Other.RSI": "0.011864857",
  "MED.DISEASES.Pulmonary.Autoimmune.Asthma": "0.019167002",
  "MED.DISEASES.Pulmonary.COPD": "0.009635455",
  "MED.DISEASES.Skin.Autoimmune.Atopic.dermatitis": "0.103226315",
  "MED.DISEASES.Skin.Autoimmune.Psoriasis": "0.009517194",
  "MED.DISEASES.Skin.Autoimmune.Severe.acne": "0.060007583",
  "MED.DISEASES.Gastrointestinal.Rome3_IBS.Any": "0.04954944",
  "MED.DISEASES.None.No.Diseases": "-0.220571981"
}

note : Human_id is unique

sample output :

{
    "message": "disease_info added",
    "disease_info_id": "100"
}

4 - Create bulk disease_info

POST /disease_info/create_many/

sample input :

[
  {
    "_id": 101,
    "disease": "MED.DISEASES.cancer",
    "MED.DISEASES.Blood.Anemia": "0",
    "MED.DISEASES.Blood.Thrombosis": "0",
    "MED.DISEASES.Cancer.Any": "0",
    "MED.DISEASES.Cardiovascular.Arrythmia.MedDiagnosed": "0.034828556",
    "MED.DISEASES.Cardiovascular.Colesterol.high": "-0.013506254",
    "MED.DISEASES.Cardiovascular.Heart.Attack": "-0.026579618",
    "MED.DISEASES.Cardiovascular.Heart.Failure.Disorder": "-0.005956634",
    "MED.DISEASES.Cardiovascular.Heartrate.complains": "0.092097199",
    "MED.DISEASES.Cardiovascular.Hypertension": "0.032507649",
    "MED.DISEASES.Endocrine.DiabetesT2": "0.001839968",
    "MED.DISEASES.Gastrointestinal.Stomach.Ulcer": "0.024063959",
    "MED.DISEASES.Hepatologic.Gallstones": "0.064607811",
    "MED.DISEASES.Mental.Any": "0.109039221",
    "MED.DISEASES.Mental.Burn.Out": "0.039675773",
    "MED.DISEASES.Mental.Depression": "0.048660138",
    "MED.DISEASES.Mental.Other.anxiety": "0.051273785"
  },
  {
    "_id": 102,
    "disease": "MED.DISEASES.Autism",
    "MED.DISEASES.Blood.Anemia": "2",
    "MED.DISEASES.Blood.Thrombosis": "0",
    "MED.DISEASES.Cancer.Any": "0",
    "MED.DISEASES.Cardiovascular.Arrythmia.MedDiagnosed": "0.034828556",
    "MED.DISEASES.Cardiovascular.Colesterol.high": "-0.013506254",
    "MED.DISEASES.Cardiovascular.Heart.Attack": "-0.026579618",
    "MED.DISEASES.Cardiovascular.Heart.Failure.Disorder": "-0.005956634",
    "MED.DISEASES.Cardiovascular.Heartrate.complains": "0.092097199",
    "MED.DISEASES.Cardiovascular.Hypertension": "0.032507649",
    "MED.DISEASES.Endocrine.DiabetesT2": "0.001839968",
    "MED.DISEASES.Gastrointestinal.Stomach.Ulcer": "0.024063959",
    "MED.DISEASES.Hepatologic.Gallstones": "0.064607811",
    "MED.DISEASES.Mental.Any": "0.109039221",
    "MED.DISEASES.Mental.Burn.Out": "0.039675773",
    "MED.DISEASES.Mental.Depression": "0.048660138",
    "MED.DISEASES.Mental.Other.anxiety": "0.051273785",
    "MED.DISEASES.Mental.Panic.disorder": "0.054330785",
    "MED.DISEASES.Neurological.Dizziness.Falling": "0.013315382",
    "MED.DISEASES.Neurological.Mental.Fibromyalgia": "0.068923906"   
  }
]

note : disease_id is unique

sample output :

{
    "message": "2 documents inserted"
}

6 - create MongoDB index

carbon (1)

example :

    GET /disease_info/create_index?field=MED.DISEASES.Cardiovascular.Colesterol.high&order=-1/

sample output :

Index created on field "MED.DISEASES.Cardiovascular.Colesterol.high" with name "MED.DISEASES.Cardiovascular.Colesterol.high_-1" 
 current indexes = "{'_id_': {'v': 2, 'key': [('_id', 1)]}, 'MED.DISEASES.Cardiovascular.Colesterol.high_-1': {'v': 2, 'key': [('MED.DISEASES.Cardiovascular.Colesterol.high', -1)]}}"

7 - show all indexes

    GET /disease_info/show_indexes/

sample output :

{
    "_id_": {
        "v": 2,
        "key": [
            [
                "_id",
                1
            ]
        ]
    },
    "MED.DISEASES.Cardiovascular.Colesterol.high_-1": {
        "v": 2,
        "key": [
            [
                "MED.DISEASES.Cardiovascular.Colesterol.high",
                -1
            ]
        ]
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.