Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New version of STS Score #1

Open
farvater2 opened this issue Nov 17, 2023 · 0 comments
Open

New version of STS Score #1

farvater2 opened this issue Nov 17, 2023 · 0 comments

Comments

@farvater2
Copy link

Now STS Score use WebSocket to transfer data.
JS Example:


let requests = [
  {"method":"init","data":{"prcvint":[],"Proc":[],"incidenc":[],"status":[],"gender":[],"racemulti":[],"payordata":[],"diabetes":[],"endocarditis":[],"ivdrugab":[],"alcohol":[],"tobaccouse":[],"chrlungd":[],"cvd":[],"heartfailtmg":[],"classnyh":[],"mcs":[],"cardsymptimeofadm":[],"miwhen":[],"numdisv":[],"vdinsufa":[],"vdinsufm":[],"vdinsuft":[],"arrhythatrfib":[],"arrhythafib":[],"arrhythaflutter":[],"arrhythvv":[],"arrhythsss":[],"arrhythsecond":[],"arrhyththird":[],"prvalveproc":[],"pocpci":[],"pocint":[],"tab":"Clinical Summary","decline:shiny.action":0,"reset:shiny.action":0,"copybuttonestimates:shiny.action":0,"copybuttonsummary:shiny.action":0,"vstrpr":false,"medacei48":false,"medgp":false,"medinotr":false,"medster":false,"medadp5days":false,"fhcad":false,"hypertn":false,"liverdis":false,"mediastrad":false,"unrespstat":false,"dialysis":false,"cancer":false,"syncope":false,"immsupp":false,"pneumonia":false,"slpapn":false,"hmo2":false,"pvd":false,"cvdstenrt":false,"cvdpcarsurg":false,"cvdstenlft":false,"carshock":false,"resusc":false,"stenleftmain":false,"laddiststenpercent":false,"vdstena":false,"vdstenm":false,"vdaoprimet":false,"ageN:shiny.number":null,"heightN:shiny.number":null,"weightN:shiny.number":null,"BMI:shiny.number":null,"creatlstN:shiny.number":null,"hctN:shiny.number":null,"wbcN:shiny.number":null,"plateletsN:shiny.number":null,"medadpidis:shiny.number":null,"hdef:shiny.number":null,".clientdata_output_errorMessage_hidden":false,".clientdata_output_text2_hidden":false,".clientdata_output_summary_hidden":false,".clientdata_pixelratio":1,".clientdata_url_protocol":"https:",".clientdata_url_hostname":"acsdriskcalc.research.sts.org",".clientdata_url_port":"",".clientdata_url_pathname":"/",".clientdata_url_search":"",".clientdata_url_hash_initial":"",".clientdata_url_hash":"",".clientdata_singletons":"add739c82ab207ed2c80be4b7e4b181525eb7a75"}},
  {"method":"update","data":{"Proc":["AVR + CABG"], "ageN":55}}
];

let socket = new WebSocket("wss://acsdriskcalc.research.sts.org/websocket/");
socket.onopen = function (e) {
  console.log("onopen", e);
  for (let req of requests) {
    socket.send(JSON.stringify(req));
  }
};
socket.onmessage = function (e) {
  console.log("onmessage", e);
    const data = JSON.parse(e.data || {});
    let values = data.values;
    if (values?.text2?.html) {
      console.log("onmessage values", values);
      const regex = /<tr><td.*>(.*)<\/td>\s*<td.*>(.*)<\/td><\/tr>/gm;
      let matches = [...values.text2.html.matchAll(regex)];
      matches = matches.map((x) => { return [x[1], x[2]]; });
      console.log("matches",matches);
    }
};
socket.onerror = function (e) { 
  console.log("onerror", e);
  console.log("Error conection!");
};
socket.onclose = function () {
  console.log("close!");
  socket.close();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant