Coder Social home page Coder Social logo

Comments (1)

witzatom avatar witzatom commented on June 4, 2024

Some additional info on how the generator was made.

I wrote this script to generate the scenarios.json file that we have in our repository.

import {scenarioNames, getScenario} from "../src/components/Main/state/getScenario"
import {ageDistributionNames, getAgeDistribution} from "../src/components/Main/state/getAgeDistribution"
import {scenarioNames as severityNames, getSeverityDistribution} from "../src/components/Main/state/getSeverityDistribution"
import {serialize} from "../src/components/Main/state/serialization/serialize"
import fs from 'fs';

let ageDistributionNamesSet: Set<string> = new Set(ageDistributionNames);
let commonNames = scenarioNames.filter(x => ageDistributionNamesSet.has(x));
let severityDefault = severityNames[0];

let supportedPresets: { [id: string]: any } = {};

commonNames.forEach((countryName) => {
    let countryData = {
      scenario: getScenario(countryName),
      scenarioName: countryName,
      ageDistribution: getAgeDistribution(countryName),
      ageDistributionName: countryName,
      severity: getSeverityDistribution(severityDefault),
      severityName: severityDefault,
    };
    //delete all interventions
    countryData.scenario.mitigation.mitigationIntervals = [];
    const serialized = serialize(countryData);
    supportedPresets[countryName] = JSON.parse(serialized);
  }
);

fs.writeFile('scenarios.json', JSON.stringify(supportedPresets), function (err) {
  if (err) return console.log(err);
  console.log('Scenario configs written to scenarios.json');
});

It is entirely possible all that has to be done to fix the incompatibility is to regenerate the scenarios.json. Its possible neherlabs added some parameter here or there.

It looks like the imports moved into the io folder: https://github.com/neherlab/covid19_scenarios/tree/b27f596dd26f3d4666718cbfa430db4007d8f88a/src/io so its possible that just by fixing that it might work. At a glance the actual serialization did not change.

from covid.

Related Issues (20)

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.