API Reference

📘

Welcome to Pharmacy!

This section contains a manual description of the diagnostics API specification. The APIs you see here are to help you accomplish the patient journey for lab diagnostics seen in the miro board attached below.

Request for medication

[{
	"medication_detail": [{
		"display": "Aciclovir (including Zovirax)"
	}],
	"course_of_therapy_type": "continuous",
	"medication_request_dosage_instruction": [{
		"frequency": "2",
		"frequency_unit": "Hours",
		"period_unit": "Hours",
		"period": "3"
	}],
	"medication_request_notes": [{
		"display": ""
	}],
	"priority": "routine",
	"medication_request_category": [{
		"display": "inpatient"
	}],
    "quantity": 10,
    "past_refills": ["2021-06-10"],
    "next_refill": "2021-07-10",
    "dispense_interval_in_days": 30,
    "number_of_repeats_allowed": 3
}]

Print a prescription

This endpoint allows you to get an encounter prescription as a PDF. It returns a PDF as the HTTP response.

URL: `https://api.serenity.health/v1/providers/{{provider_id}}//medicationrequests/print/<slug:encounter_id>
Method: GET

Dispense medication

This endpoint enables a pharmacist to dispense medication to an encounter or walk-in patient

URL: {{base_url}}/providers/{{serenity_user_provider_id}}/medication-dispenses

{
    "with_payment": true, // if the pharmacist dispensing is also receiving payment. If true, then "payment_info" seen below would be required
    "payment_info": {
    	"account_id": "3173c1e1-571b-4196-8cdf-743970c67153", // if corporate, insurance or patient account
	    "transaction_type": "user-account",
  	  "amount": 200, // required if transaction_type is `cash`
    	"currency": "GHS", // required if transaction_type is `cash`,
      "copayment_info": {
      	 "account_id": "3173c1e1-571b-4196-8cdf-743970c67153", // if corporate, patient account
         "transaction_type": "user-account",
         "amount": 200, // required if transaction_type is `cash`
         "currency": "GHS", // required if transaction_type is `cash` 
       },
      "override_patient_group_pricing_rules": False, # set to True if the payment method  in the payload is not applicable to the bill's price tier group
    },
    "origin": "encounter", // options: encounter or walk-in. if encounter, the dispense will need a medication request reference
    "patient": "f5425074-95b6-4674-b2a6-3604556c375a", // patient id
    "medication_dispense": [
      {
        "inventory_item": 1, // inventory id
        "prescription": "b254dc2c-71e0-4173-a99b-a8f2a767ec17", //medication request id
        "quantity": 2,
      },
       {
        "inventory_item": "inventory_item_id",
        "prescription": "medication_request_id",
        "quantity": 2,
      }
    ]
}
{
    "success": true,
    "message": "Successfully dispensed medications for Chris",
    "data": {
        "medication_dispense": [
            {
                "days_supply_unit": null,
                "days_supply_value": null,
                "note_done": null,
                "quantity_unit": null,
                "quantity_value": null,
                "status": "completed",
                "status_reason": null,
                "category": "out-patient",
                "medication": "1",
                "substituted": false,
                "substitution_type": "none",
                "when_handed_over": null,
                "when_prepared": null,
                "encounter": null,
                "visit": null,
                "location": null,
                "patient": null,
                "patient_detail": null,
                "type": null,
                "destination": null,
                "prescription": "3877a117-f39d-48ed-a51b-ed73f7f1a0e3",
                "provider": "b6c0cc80-c5fd-4430-805c-e3591ec9b3cf",
                "medication_dispense_dosage": [],
                "medication_dispense_note": [],
                "medication_dispense_performer": [],
                "medication_dispense_receiver": [],
                "medication_dispense_substitution_reason": [],
                "medication_dispense_substitution_responsible_party": [],
                "medication_dispense_supporting_information": []
            }
        ],
        "invoice": {
            "patient_detail": {
                "name": "Chris  Dare",
                "age": "44 years",
                "gender": "MALE",
                "mr_number": "4bf734c9-f28a-40fc-9564-2ba750820915"
            },
            "provider_detail": {
                "name": "Nyaho Medical",
                "address": "15 Sesame Street",
                "country": "GH",
                "telephone": null,
                "website": null
            },
            "patient_address": null,
            "line_items": [
                {
                    "id": 97,
                    "patientid": "f5425074-95b6-4674-b2a6-3604556c375a",
                    "subscriberid": null,
                    "beneficiaryid": null,
                    "service": null,
                    "charge": 100.0,
                    "invoice_id": "cc0a31ec-adc2-411e-9ed2-b46c9a792a11",
                    "patientname": "Chris Dare",
                    "patient_mobile": "233262260986",
                    "servicerequestid": null,
                    "medicationrequestid": null,
                    "occurrence_date": "2021-09-05T13:40:11.617269Z",
                    "practitionername": "Dr Ehi Binitie",
                    "practitionerid": "41c1d28f-bd82-4346-9857-fb135a03ebd5",
                    "status": "billable",
                    "status_display": "Unpaid",
                    "service_or_product_name": "GP Consultation",
                    "visitid": null,
                    "serviceid": null,
                    "appointmentid": null,
                    "appointment": null,
                    "beneficiary": null,
                    "category": null,
                    "clinic": null,
                    "clinic_name": null,
                    "company_name": null,
                    "created_on": "2021-09-05T13:40:11.617235Z",
                    "dependent": null,
                    "location": null,
                    "medication_request_id": null,
                    "patient_name": "Chris Dare",
                    "payer": null,
                    "payer_name": null,
                    "payment_method": null,
                    "payment_transactions": [],
                    "policy": null,
                    "practitioner_role": "41c1d28f-bd82-4346-9857-fb135a03ebd5",
                    "practitioner_name": "Dr Ehi Binitie",
                    "provider": "b6c0cc80-c5fd-4430-805c-e3591ec9b3cf",
                    "provider_name": "Nyaho Medical",
                    "provider_location_name": null,
                    "provider_location_id": null,
                    "relationship": "self",
                    "service_id": "bf278d07-5842-4512-b6fc-d1cf50b0e485",
                    "service_request": null,
                    "subscriber": null,
                    "price_tier": 1,
                    "transaction": null,
                    "visit": "8e6a4183-04fe-4ce7-8da1-d9696b4d8474"
                }
            ],
            "cashier": "N/A (billed unpaid)",
            "user_friendly_id": 16,
            "total_gross_value": 100.0,
            "total_gross_currency": "GHS",
            "status": "billable",
            "status_display": "Unpaid"
        }
    },
    "errors": null
}

Get inventory(paginated)

This allows a provider to get all inventory paginated.
URL: {{base_url}}/providers/{{serenity_user_provider_id}}/get-inventory
Method: GET

"success": true,
    "message": "Successfully retrieved inventories",
    "meta": {
        "current": 1,
        "page_size_query": "page_size",
        "next": "http://localhost:8000/v1/providers/951ce6e6-abf8-4cd1-9986-36505a512b7e/get-inventory?page=2",
        "previous": null,
        "page_size": 50,
        "total": 799
    },
    "results": [
        {
            "id": 1,
            "uuid": "5d81c675-aabd-451b-9296-9667f0a7e257",
            "is_deleted": false,
            "code": null,
            "name": "Para",
            "dosage_amount": "4555.00",
            "dosage_unit": "mg",
            "dosage_form": "CAPSULES",
            "batch_number": "232443",
            "rate": null,
            "purchase_tax_percentage": null,
            "discount_percentage": null,
            "unit_price": "45.0000",
            "currency": "GHS",
            "selling_price": "45.00",
            "initial_quantity": 15,
            "net_release_quantity": 10,
            "in_hand_quantity": 1,
            "total_cost_value": null,
            "expiry_date": null,
            "category": "medical-stock",
            "created_at": "2021-11-01T22:53:38.825015Z",
            "modified_at": "2021-11-01T22:53:38.825035Z",
            "medication": "Alendronic acid",
            "provider": "951ce6e6-abf8-4cd1-9986-36505a512b7e"
        }]