Cuddly Fiesta is the web iframe for STAT prescription maker. The STAT prescription maker enables doctors to digital prescriptions, easily & fast.
To obtain the auth_key contact [email protected]
POST https://stat-api.link/register_user
body: {
"auth_key": String,
"profiles": {
"user_id": String,
"name": String,
"qualifications": String,
"medical_council":String,
"reg_no": String
}
}
This will return an internal reference id.
body: {
"stat_id": "4efbad10-d014-40b4-9d22-b06414044ef6"
}
OR an error.
NOTE:
ℹ️ for bulk createion of profiles contact [email protected]
Cuddly fiesta & STAT leaves the doctor authentication and verification to the website opening the iFrame. However each session is authenticated with a JWT token. To get the jwt token:
POST https://stat-api.link/token
body: {
"auth_key": String,
"user_id: String //use your org's user id
}
This will return a jwt token valid for 30min. If valid this will return
body: {
'jwt_token': String
}
NOTE:
Cuddly fiesta uses iFrame to embed the STAT webpage into the browser.
Create an iframe
<iframe id="cuddly-fiesta" frameBorder="0"> </iframe>
css
html, body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
iframe {
width: 100%;
height: 95vh;
}
*{
box-sizing: border-box;
}
javascript
Get the iframe refence and set the source
var iframe = document.getElementById('cuddly-fiesta');
iframe.src = 'https://stat-rx.netlify.app';
The iframes raises an event with status ready, on recieving this send the patient information and token. Once the doctor finishes writing the prescription the iframe raises an event with status done.
window.addEventListener("message", (event) => {
var status = event.data.status;
if (status == 'ready'){
contentWindow.postMessage({
"patientName": "String",
"patientAge": "String",
"patientSex": "String",
"token": "String"
}, '*')
}
if(status == 'done'){
let rx_url = event.data.prescription_url
let rx_password = event.data.prescription_password
//Store url and handle navigation
}
}, false);
All fields are required, any unfilled will be set to null.
POST https://stat-api.link/update_user
{
"auth_key": "{{auth_key}}",
"user_id": "2",
"user_name": "String",
"qualifications": "String",
"medical_council": "String",
"reg_no": "String"
}
POST https://stat-api.link/delete_user
{
"auth_key": "{{auth_key}}",
"user_id": "2"
}
Examples:
- Request for registering users & generating tokens:
- Web app with Iframe embedded: https://glitch.com/edit/#!/organic-honored-share?path=README.md%3A1%3A0