Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

JSON Generator

Blake edited this page Sep 24, 2017 · 28 revisions

JSON generator code for JSON Generator found here: http://www.json-generator.com/

JSON generator code for Samples sample JSON

[
  '{{repeat(100, 100)}}',
  {
    id: '{{index()}}',
    sample_type: '{{random(1, 2, 3, 4, 5)}}',
    matrix_type: '{{random(1, 2, 3, 4, 5, 6)}}',
    filter_type: '{{random(1, 2, 3, 4, 5, 6, 7, 8)}}',
    study: '{{random(1, 2, 3, 4, 5, 6, 7)}}',
    study_site_name:'{{lorem(1, "words")}}',
    collaborator_sample_id: '{{integer(1000, 9000)}}',
    sampler_name:  '{{random(1,2,3)}}',
    sample_notes: '{{lorem(1, "sentences")}}',
    sample_description: '{{lorem(1, "sentences")}}',
    arrival_date:'{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-d")}}',
    arrival_notes:'{{lorem(1, "sentences")}}',
    collection_start_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
    collection_start_time: '{{date(new Date(2012, 0, 1), new Date(), "H:m:00 ")}}',
    collection_end_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
    collection_end_time: '{{date(new Date(2012, 0, 1), new Date(), "H:m:00")}}',
    meter_reading_initial:'{{floating(0, 230, 1)}}',
    meter_reading_final:'{{floating(1, 800, 1)}}',
    meter_reading_unit:'{{random(1,2,3)}}',
    total_volume_sampled_initial: '{{floating(0, 1005, 4)}}',
    total_volume_sampled_unit_initial:'{{random(1,2,3)}}',
    total_volume_sampled:'{{floating(600, 825, 4)}}',
    sample_volume_initial:'{{integer(200, 650)}}',
    sample_volume_filtered:'{{floating(0, 5, 2)}}',
    filter_born_on_date:'{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-d")}}',
    filter_flag: '{{bool()}}',
    secondary_concentration_flag: '{{bool()}}',
    elution_date:'{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-d")}}',
    elution_notes:'{{lorem(1, "sentences")}}',
    technician_initials:'{{random("sks", "js", "AF")}}',
    air_subsample_volume:'{{floating(0, 1000, 2)}}',
    post_dilution_volume:'{{floating(0, 1000, 2)}}',
    pump_flow_rate: '{{floating(0, 1000, 2)}}',
    insert_date:'{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
    insert_user:'{{random("afirnstahl", "jpstokdyk", "sspencer", "legacy data upload")}}',
    update_date:'{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
    update_user:'{{random("afirnstahl", "jpstokdyk", "sspencer")}}'
    
  }

]


JSON generator code for Analysis Batches Detail sample JSON

[
  '{{repeat(10, 10)}}',
  {
    id: '{{index(1000)}}',
    analysis_batch_description: '{{lorem(1, "sentences")}}',
    analysis_batch_notes: '{{lorem(1, "sentences")}}',
    samples: [
      '{{repeat(4)}}',
      {
        id: '{{integer(1000, 1500, "0000")}}',
        sample_type: '{{random(1, 2, 3, 4, 5)}}',
        sample_description: '{{lorem(1, "sentences")}}'
      }
    ],
    studies: [
      '{{repeat(2)}}',
      {
        id: '{{random(3, 4, 5, 7, 8, 10, 13, 14)}}',
        name: '{{random("Iowa DNR Beach Study 2016", "Kewuanee County Study", "Iowa Well Monitoring Study 2016", "MDH Storm Water Irrigation")}}',
        description: '{{lorem(1, "sentences")}}'
      }
    ],
    extractions: [
      '{{repeat(2)}}',
      {
        id: '{{integer(1000, 1100, "00000")}}',
        extraction_no: '{{index(1)}}',
        extraction_volume: '{{floating(0, 1.5, 2)}}',
        elution_volume: '{{floating(0, 3, 2)}}',
        extraction_method: '{{integer(1, 2, "0")}}',
        extraction_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
        inhibitions: [
          '{{repeat(2)}}',
          {
            id: '{{integer(1000, 1100, "00000")}}',
            inhibition_no: '{{index(1)}}',
            dilution: '{{floating(5, 50, 0, "00")}}',
            type: '{{random("RNA", "DNA",)}}',
            inhibition_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
            insert_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
            insert_user: '{{random("afirnstahl", "jpstokdyk", "sspencer", "legacy data upload")}}',
            update_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
            update_user: '{{random("afirnstahl", "jpstokdyk", "sspencer")}}'
          }
        ],
        reverse_transcriptions: [
          '{{repeat(2)}}',
          {
            id: '{{integer(1000, 1100, "00000")}}',
            rt_no: '{{index(1)}}',
            extraction_id: '{{integer(1000, 2000, "00000")}}',
            vol_in: '{{floating(0, 1.5, 2)}}',
            vol_out: '{{floating(0, 3, 2)}}',
            rt_cq: '{{floating(0, 3, 2)}}',
            rt_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
            insert_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
            insert_user: '{{random("afirnstahl", "jpstokdyk", "sspencer", "legacy data upload")}}',
            update_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
            update_user: '{{random("afirnstahl", "jpstokdyk", "sspencer")}}'
          }

        ],
        targets: [
          '{{repeat(2)}}',
          {
            id: '{{integer(1000, 2000, "00000")}}',
            name: '{{random("E.Coli", "Salmonella", "Bovine Flu", "Crazy Cow-itis")}}',
            abbreviation: '{{random("SS", "E", "GB", "F")}}',
            type: '{{random("RNA", "DNA",)}}',
            replicates: '{{integer(2, 8, "0")}}'
          }
        ]

      }
    ],
    insert_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
    insert_user: '{{random("afirnstahl", "jpstokdyk", "sspencer", "legacy data upload")}}',
    update_date: '{{date(new Date(2012, 0, 1), new Date(), "YYYY-MM-dd")}}',
    update_user: '{{random("afirnstahl", "jpstokdyk", "sspencer")}}'
  }
]

JSON generator code for Targets sample JSON

[
  '{{repeat(8, 8)}}',
  {
     id: '{{index()}}',
    name:  '{{lorem(1, "words")}}',
    code: '{{lorem(1, "words")}}',
    medium: '{{random("Bovine", "Human")}}',
    type: '{{random("DNA", "RNA")}}'
  }
]