# :bar_chart: Dr Lal Pathlab Integration ###### tags: `whilter` ![DrPathlab](https://hackmd.io/_uploads/Bk5VnfHtp.png) ## Request-Response ### New Report Request (Dr Pathlab to Whilter) ```json { "client-id": "<Dr Pathlab Client Id>", "template-id": "<report-template-uuid>", "user-id": "optional user identifier", "reference-record-id": "transaction id", "single-value-chart" : [ 12, 18.84, null, null, 175, 4.7 ] } ``` 1. **client-id** provided by whilter 2. **template-id** provided by whilter 3. **user-id** optional provided by Dr Lal Pathlab 4. **reference-record-id** transaction id (as discussed) provided by Dr Lal Pathlab 5. **single-value-chart** report result values in predefined sequence. Size of array depend on template below. null above represent that it should not be part of report. See template schema below > Client should also provide metadata for above. See Sample Schema below. ### Webhook Request (Whilter to Dr Pathlab) ```json { "reference-record-id": "transaction id", "video-url" : " "https://azure-bucket-url/videos/transaction_id.mp4", "status" : 200, "message" : "ok" } ``` 1. **reference-record-id** transaction id (as discussed) provided by Dr Lal Pathlab and is returned 2. **video-url** video url of mp4 in azure bucket 3. **status** of request. 200 for ok. Other for errors. Refer HTTP status codes 4. **message** text description of error ### Sample Schema All input data should have definition or schema associated with input request. Language codes : https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes > Below values be provided by client. Sunil will talk to customer ```json [ { "schema-id" : "chart-xxxx-1", "name" : "Erythrocyte Sedimentation Rate", "data-type" : "DATA_TYPE_DOUBLE", "output-type" : "OUTPUT_TYPE_CHART", "metadata" : { "chart-type" : "gauge", "primary-label" : "ESR", "secondary-label" : "Modified Westergren", "units" : "mm/hr", } "range" : [ { "lowValue" : 0, "highValue" : 20, "name" : "Low", "pre-recorded-files" : [ { "language" : "bn", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" }, { "language" : "hi", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" } ] }, { "lowValue" : 20, "highValue" : 70, "name" : "Medium", "pre-recorded-files" : [ { "language" : "bn", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" }, { "language" : "hi", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" } ] }, { "lowValue" : 70, "highValue" : 100, "name" : "High", "pre-recorded-files" : [ { "language" : "bn", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" }, { "language" : "hi", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" } ] } ] } ] ``` ## Template Metadata > During phase 1 it will be added manually to redis ```json { "client-id": "<Client Id>", "template-id": "<template-uuid>", "template_url" : "s3 url", "language-code" : "en", "tts-voice" : "name-as-per-google", "chart-metadata" : { "color-palette" :[ "#F44336", "#448AFF", "#7B1FA2"], "background-color" : "#FFFFFF", "chart-groups" : [ { "group-id" : "group-xxxx-01", "group-name" : "Vitamin Profile", "group-description" : "Vitamins perform many essential roles in your body and maintain your overall health.", "charts" : ["chart-xxxx-1", "chart-xxxx-2"], "notes" : [ { "type" : "diet", "value" : "A balanced diet can take care of all the vitamins needed by your body" }, { "type" : "doctor-info", "value" : "Consult your doctor before taking any vitamin supplements" } ], "pre-recorded-files" : [ { "language" : "bn", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" }, { "language" : "hi", "audio-uri" : "s3_url_of_audio", "video-uri" : "s3_url_of_video" } ] } ] }, "request-mapping" : [ { "output_type" : "OUTPUT_TYPE_CHART", "index" : 1, "schema-id" : "chart-xxxx-1", "multiple" : true, "reference-audio-producer" : "producer14", "placeholder-producer" : "producer12" }, { "output_type" : "OUTPUT_TYPE_PHRASE_TEXT", "index" : 1, "melt-producer" : "producer8", "schema-id" : "phrase-xxxx-1", "constant-duration" : false, "index" : 1 } ], "destination-config": [ { "type" : "webhook", "host" : "http://api.drpathlab.com/video-status", "api-key" : "" } ], "upload-config" : { "destination" : "azure", "bucket-name" : "name-of-bucket", "access-key" : "xxx-ddd-ccc", "secret-key" : "yyy-jjj-eee" } } ``` ## :chart: Example Report (Internal Documentation) Each report is consist of multiple sections. Below are example of sample sections ### Summary Section >This is summary of results of multiple test. out of scope for hackathon ![Screenshot 2023-12-06 at 8.03.10 PM](https://hackmd.io/_uploads/SyZxPWRSp.png) ### Simple Section with 1 Test ![Screenshot 2023-12-07 at 12.05.06 AM](https://hackmd.io/_uploads/ByMlyH0r6.png) Above sections have below data points 1. **Pathological Test heading :** Name (_Inflammation_) and its description (_Inflammation is the body’s immune system's response to an injury, surgery, or irritatio..._). **Rajan Notes :** While converting to video - description can be voice over or actor narrating it 2. **Test :** Name (_Erythrocyte Sedimentation Rate_) and measuring method (_Modified Westergren_). **Rajan Notes :** Test name can be a text on video and measuring method might not be needed for video purpose 3. **Result Value(_12_) and its units (__mm/hr__) **Rajan Notes :** this is primary information that need to be communicated. 4. **Guage :** Graphical representation with ranges to expain weather the results are - Normal, Low, Borderline or High. Each of this range has lower and upper bound. **Rajan Notes :** Currently using charts it is solved, but we need some animation in form of gif or video. Colors are important from visualization perspectve. > Point 1, 2 and 4 are static data and should be part of enrich > This will be stored in redis cache as template metadata ### Section with 2 Test ![Screenshot 2023-12-07 at 3.54.58 PM](https://hackmd.io/_uploads/Sk6YpGJLT.png) ### Section with multiple tests ![Screenshot 2023-12-07 at 3.56.16 PM](https://hackmd.io/_uploads/HkqCazyLT.png) ### Section with multiple tests where few dont have charts associated ![Screenshot 2023-12-07 at 3.56.16 PM](https://hackmd.io/_uploads/HkqCazyLT.png) ### Section with multiple tests where few have only text values ![Screenshot 2023-12-07 at 3.59.55 PM](https://hackmd.io/_uploads/SJvhAMJL6.png) ### Break up * Each report will have multiple section e.g. Liver function test and Kidney function test. * Each section will have multiple tests. * For each test there will be three kind of conclusions - Good, borderline and watchout * For each sections there will be three kind of conclusions - Good, borderline and watchout > In melt one or more charts will get added to a producer as an image (static or as gif) or as video file (later with manim). There will be accompaning audio producer describing charts. Length of audio and display time of chart should match. ```json { // rest of fields as before "video-url" : "https://amplify-whilter-dev.s3.ap-south-1.amazonaws.com/videos/reference-video1.mp4" } ``` ```json { "request-id" : "0a6eff19-6483-438b-9fe5-8a83b22d2cfd" } ``` ```json { "request-id" : "0a6eff19-6483-438b-9fe5-8a83b22d2cfd", "video-url" : "https://content.whilter.ai/videos/8a83b22d2cfd-video1.mp4" } ```