doceree_ads 0.0.3-dev.2 doceree_ads: ^0.0.3-dev.2 copied to clipboard
A Doceree flutter package for web, ios and android is meant for developers so that they can use and implement it as a third-party library.
A Doceree flutter package for web, ios and android is meant for developers so that they can use and implement it as a third-party library.
Features #
The Doceree Flutter library is meant for developers so that they can use and implement it as a third-party library. This enables developers to integrate their respective platforms with the Doceree environment whereby Doceree ads can be served accordingly.
Getting started #
To initialize Doceree library write following code:
DocereeAds.initialize();
Send HCP Data #
After the user (Health Care Provider) logs in to the system then the data pertaining to the said HCP will be fetched and send to Doceree. For this to happen the user’s profile will be created using the HcpBuilder class once the user logs in. All the profile parameters of a user are set and then this information is sent to Doceree using the loginWithHcp() method.
import 'package:doceree_ads/doceree_ads.dart';
var hcpBuilder = HcpBuilder();
hcpBuilder.hcpId = "54321";
hcpBuilder.firstName = "John";
hcpBuilder.lastName = "Doe";
hcpBuilder.email = "doceree@yopmail.com";
hcpBuilder.specialization = "Anesthesiology";
hcpBuilder.organisation = "XYZ-organisation";
hcpBuilder.city = "Delhi";
hcpBuilder.State = "Delhi";
hcpBuilder.Country = "INDIA";
hcpBuilder.zipCode = "110024";
hcpBuilder.gender = "Male";
hcpBuilder.hashedEmail = getHashedString("doceree@yopmail.com");
var hcp = hcpBuilder.build();
DocereeAds().loginWithHcp(hcp);
Hashing Method You need to implement crypto package for hashing. Add the following code to pubspec.yaml file.
dependencies:
crypto: ^3.0.3
Import the following packages:
import dart:convert
import 'package:crypto/crypto.dart';
Call this method wherever you want to hash the string:
String getHashedString(String str){
var bytes = utf8.encode(str);
var digest = sha256.convert(bytes);
return digest.toString();
}
Send Patient Data (Session Attributes) #
Patient data helps in setting up the rule for ad serving. For every patient we update this. This data helps to serve relevant ads.
Import the following package before the patient data can be send to Doceree:
import 'package:doceree_ads/doceree_ads.dart';
The startSession() should be called before patient data can be send.
DocereeAds().startSession();
Once the session begins the following patient data can be sent:
var patientBuilder = PatientBuilder();
patientBuilder.add("age", "25");
patientBuilder.add("prescription", ["0002-1433","0002-1200","0002-0800","0002-1434"]);
patientBuilder.add("labTest", ["A0021","A0200","A0210","A0225"]);
patientBuilder.add("diagnosis", ["A00","A0109","A011","A012"]);
patientBuilder.add("gender", "male");
patientBuilder.add("labTestHistory", [{"dt": "2023-01-10", "v":["A0021", "A0200"]},{"dt": "2023-03-15", "v": ["A0210","A0220"]}]);
patientBuilder.add("prescriptionHistory", [{"dt": "2023-01-10", "v":["0002-1433", "0002-1200"]},{"dt": "2023-03-15", "v": ["0002-0800","0002-1434"]}]);
patientBuilder.add("pharmacy", ["P01","P02","P03","P04"]);
patientBuilder.add("diagnosisHistory", [{"dt": "2023-01-10", "v":["A00", "A0109"]},{"dt": "2023-03-15", "v": ["A011","A012"]}]);
patientBuilder.add("pharmacyHistory", [{"dt": "2023-01-10", "v":["P01","P02"]},{"dt": "2023-03-15", "v": ["P03","P04"]}]);
patientBuilder.add("temperature", {"v":"88.56","u":"Fahrenheit/Celsius"});
patientBuilder.add("bp", "120/80");
patientBuilder.add("pulse", "68");
patientBuilder.add("respiration", "67");
patientBuilder.add("insurance", "1");
patientBuilder.add("insuranceType", ["1","2"]);
patientBuilder.add("insuranceName", ["medicaid", "hmo"]);
var patient = patientBuilder.build();
if (patient != null) {
DocereeAds().savePatientData(patient);
}
Important: Data format should same as given in above parameters.
After the session is completed we end the said session using the following method:
DocereeAds().endSession();