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 Aug 23, 2017 · 28 revisions

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 sample JSON

[
  '{{repeat(10, 10)}}',
  {
    id: '{{index(1000)}}',
    analysis_batch_description: '{{lorem(1, "sentences")}}',
    samples: [
      '{{repeat(3)}}',
      '{{integer(0, 14, "000")}}'
    ],
    peg_negs: [
      '{{repeat(1)}}',
      '{{integer(0,14, "000")}}'
    ],
    studies: [
      '{{repeat(2)}}',
      '{{integer(0, 14, "000")}}'
    ]
  }
]
Clone this wiki locally