{
  "format": "dataset-manifest/1",
  "slug": "pharmacy-dispensing",
  "version": 2,
  "seed": "pharmacy-dispensing:1",
  "spec": {
    "format": "dataset/1",
    "slug": "pharmacy-dispensing",
    "name": "Pharmacy Dispensing",
    "tagline": "Modeling the dispensing process in a community pharmacy.",
    "description": "Community pharmacies dispense medications based on prescriptions from healthcare providers. They manage various aspects including medication strengths, forms, stock batches with expiration dates, and recording dispensing transactions. This dataset models the relationships between medicines, stock batches, prescriptions, and dispensing records, providing a comprehensive view of the pharmacy operations. Each table represents a crucial component in the pharmacy workflow, allowing analysis of stock levels, prescription trends, and dispensing patterns. With this synthetic dataset, developers can practice SQL querying skills or create ORM seed data, offering a rich set of relationships and data types to explore.",
    "domain": "pharmacy",
    "shape": "transactional",
    "useCases": [
      "sql-practice",
      "orm-seeding"
    ],
    "keywords": [
      "pharmacy",
      "dispensing",
      "prescriptions",
      "medications",
      "stock",
      "healthcare",
      "database",
      "SQL"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "medications": {
        "description": "This table contains the details of medications available at the pharmacy, including their strengths and forms.",
        "rows": 200,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each medication."
          },
          "name": {
            "kind": "fullName",
            "description": "The name of the medication."
          },
          "strength": {
            "kind": "decimal",
            "min": 0.1,
            "max": 1000,
            "scale": 2,
            "description": "The strength of the medication in mg.",
            "nullable": true,
            "when": {
              "column": "form",
              "in": [
                "tablet",
                "capsule",
                "syrup",
                "injection"
              ]
            },
            "distribution": "normal"
          },
          "form": {
            "kind": "enum",
            "values": [
              "tablet",
              "capsule",
              "syrup",
              "injection"
            ],
            "description": "The form in which the medication is available.",
            "weights": [
              6,
              2,
              1,
              1
            ]
          }
        }
      },
      "stock_batches": {
        "description": "This table records the stock batches of medications, including their expiry dates.",
        "rows": 300,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each stock batch."
          },
          "medication_id": {
            "kind": "fk",
            "ref": "medications.id",
            "description": "The ID of the medication this stock batch belongs to."
          },
          "quantity": {
            "kind": "int",
            "min": 1,
            "max": 500,
            "description": "The quantity of medication in this batch.",
            "distribution": "long-tail"
          },
          "expiry_date": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2025-12-31",
            "description": "The expiration date of the medication.",
            "nullable": true
          }
        }
      },
      "prescribers": {
        "description": "This table holds information about healthcare providers who prescribe medications.",
        "rows": 100,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each prescriber."
          },
          "full_name": {
            "kind": "fullName",
            "description": "The full name of the prescriber."
          },
          "specialty": {
            "kind": "words",
            "max": 3,
            "description": "The medical specialty of the prescriber.",
            "nullable": true,
            "pool": [
              "cardiology",
              "dermatology",
              "neurology",
              "pediatrics",
              "oncology",
              "psychiatry",
              "radiology",
              "endocrinology",
              "orthopedics",
              "gastroenterology",
              "urology",
              "pulmonology",
              "rheumatology",
              "internal",
              "family",
              "emergency",
              "anesthesiology",
              "obstetrics",
              "gynecology",
              "pathology",
              "ophthalmology",
              "dentistry",
              "plastic",
              "vascular",
              "infectious",
              "sports",
              "geriatric",
              "addiction",
              "sleep",
              "rehabilitation",
              "nuclear",
              "thoracic",
              "transplant",
              "pain",
              "palliative",
              "forensic",
              "clinical",
              "medical",
              "preventive",
              "holistic",
              "integrative",
              "occupational",
              "environmental",
              "public",
              "health",
              "naturopathic",
              "chiropractic",
              "homeopathic",
              "alternative",
              "complementary",
              "functional",
              "cosmetic",
              "behavioral"
            ],
            "min": 1
          }
        }
      },
      "prescriptions": {
        "description": "This table contains details of prescriptions issued by prescribers for medications.",
        "rows": 400,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each prescription."
          },
          "prescriber_id": {
            "kind": "fk",
            "ref": "prescribers.id",
            "description": "The ID of the prescriber who issued the prescription."
          },
          "medication_id": {
            "kind": "fk",
            "ref": "medications.id",
            "description": "The ID of the medication prescribed."
          },
          "date_issued": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2023-12-31",
            "description": "The date the prescription was issued.",
            "nullable": true
          },
          "quantity": {
            "kind": "int",
            "min": 1,
            "max": 30,
            "description": "The quantity of medication prescribed.",
            "nullable": true,
            "distribution": "long-tail"
          }
        }
      },
      "dispensing_records": {
        "description": "This table records the dispensing of medications to patients based on prescriptions.",
        "rows": 500,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each dispensing record."
          },
          "prescription_id": {
            "kind": "fk",
            "ref": "prescriptions.id",
            "description": "The ID of the prescription being dispensed."
          },
          "dispensed_date": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2023-12-31",
            "description": "The date the medication was dispensed.",
            "nullable": true
          },
          "dispensed_quantity": {
            "kind": "int",
            "min": 1,
            "max": 30,
            "description": "The quantity of medication dispensed.",
            "nullable": true,
            "distribution": "long-tail"
          }
        }
      },
      "patients": {
        "description": "This table contains information about patients receiving medications from the pharmacy.",
        "rows": 150,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each patient."
          },
          "full_name": {
            "kind": "fullName",
            "description": "The full name of the patient."
          },
          "dob": {
            "kind": "date",
            "from": "1920-01-01",
            "to": "2023-12-31",
            "description": "The date of birth of the patient.",
            "nullable": true,
            "when": {
              "column": "gender",
              "in": [
                "male",
                "female",
                "other"
              ]
            }
          },
          "gender": {
            "kind": "enum",
            "values": [
              "male",
              "female",
              "other"
            ],
            "description": "The gender of the patient.",
            "weights": [
              5,
              4,
              1
            ]
          }
        }
      }
    },
    "structure": "multi-table",
    "traits": [
      "categorical",
      "timestamped",
      "nullable",
      "high-cardinality"
    ],
    "analysisQuestions": [
      "What is the average quantity of medications dispensed per day?",
      "Which medications are dispensed the most frequently?",
      "How do dispensing patterns vary by prescriber specialty?",
      "What percentage of stock batches are nearing their expiration dates?",
      "Which patients have the most prescriptions filled in the last year?"
    ],
    "suggestedQueries": [
      {
        "title": "Join Prescriptions with Dispensing Records",
        "sql": "SELECT p.id AS prescription_id, d.dispensed_date, d.dispensed_quantity FROM prescriptions p JOIN dispensing_records d ON p.id = d.prescription_id;",
        "dialect": "postgres"
      },
      {
        "title": "Count Dispensed Medications by Medication Name",
        "sql": "SELECT m.name, COUNT(d.id) AS dispensed_count FROM dispensing_records d JOIN prescriptions p ON d.prescription_id = p.id JOIN medications m ON p.medication_id = m.id GROUP BY m.name;",
        "dialect": "postgres"
      },
      {
        "title": "Average Dispensed Quantity per Medication",
        "sql": "SELECT m.name, AVG(d.dispensed_quantity) AS avg_dispensed FROM dispensing_records d JOIN prescriptions p ON d.prescription_id = p.id JOIN medications m ON p.medication_id = m.id GROUP BY m.name;",
        "dialect": "postgres"
      },
      {
        "title": "Monthly Prescription Issuance Trends",
        "sql": "SELECT DATE_TRUNC('month', p.date_issued) AS month, COUNT(p.id) AS prescription_count FROM prescriptions p GROUP BY month ORDER BY month;",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Pharmacy Staff Training",
        "body": "Pharmacy staff can use this dataset to understand the dispensing process and familiarize themselves with the medications and prescriptions they will be handling. By analyzing the relationships between medications, prescribers, and dispensing records, staff can gain insights into inventory management and patient care."
      },
      {
        "title": "Research on Medication Dispensing",
        "body": "Healthcare researchers can utilize this dataset to study trends in medication dispensing and evaluate the effectiveness of different prescriptions. By querying the dataset, they can uncover patterns in patient demographics, medication types, and prescribing behaviors, contributing to improved healthcare practices."
      },
      {
        "title": "Pharmacy Management Software Development",
        "body": "Developers creating pharmacy management software can use this dataset to seed their databases with realistic data. This will allow them to test functionalities related to medication tracking, prescription management, and patient records, ensuring their software meets the needs of community pharmacies."
      },
      {
        "title": "SQL Learning and Practice",
        "body": "Students and professionals looking to improve their SQL skills can practice with this dataset. They can write queries to analyze prescription trends, medication stock levels, and dispensing frequencies, enhancing their ability to work with relational databases in a real-world context."
      }
    ]
  },
  "counts": {
    "medications": 200,
    "patients": 150,
    "prescribers": 100,
    "prescriptions": 400,
    "dispensing_records": 500,
    "stock_batches": 300
  },
  "stats": {
    "medications": {
      "rows": 200,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 200,
          "min": 1,
          "max": 200
        },
        "name": {
          "nulls": 0,
          "distinct": 198,
          "min": "Alice Costa",
          "max": "Zoe Meyer"
        },
        "strength": {
          "nulls": 0,
          "distinct": 199,
          "min": 146.54,
          "max": 910.43
        },
        "form": {
          "nulls": 0,
          "distinct": 4,
          "min": "capsule",
          "max": "tablet"
        }
      }
    },
    "stock_batches": {
      "rows": 300,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 300,
          "min": 1,
          "max": 300
        },
        "medication_id": {
          "nulls": 0,
          "distinct": 160,
          "min": 1,
          "max": 200
        },
        "quantity": {
          "nulls": 0,
          "distinct": 210,
          "min": 1,
          "max": 494
        },
        "expiry_date": {
          "nulls": 32,
          "distinct": 236,
          "min": "2023-01-02",
          "max": "2025-12-31"
        }
      }
    },
    "prescribers": {
      "rows": 100,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 100,
          "min": 1,
          "max": 100
        },
        "full_name": {
          "nulls": 0,
          "distinct": 100,
          "min": "Amir Ibrahim",
          "max": "Zoe Carter"
        },
        "specialty": {
          "nulls": 9,
          "distinct": 88
        }
      }
    },
    "prescriptions": {
      "rows": 400,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 400,
          "min": 1,
          "max": 400
        },
        "prescriber_id": {
          "nulls": 0,
          "distinct": 97,
          "min": 1,
          "max": 100
        },
        "medication_id": {
          "nulls": 0,
          "distinct": 177,
          "min": 1,
          "max": 199
        },
        "date_issued": {
          "nulls": 39,
          "distinct": 226,
          "min": "2023-01-01",
          "max": "2023-12-30"
        },
        "quantity": {
          "nulls": 32,
          "distinct": 30,
          "min": 1,
          "max": 30
        }
      }
    },
    "dispensing_records": {
      "rows": 500,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 500,
          "min": 1,
          "max": 500
        },
        "prescription_id": {
          "nulls": 0,
          "distinct": 280,
          "min": 2,
          "max": 399
        },
        "dispensed_date": {
          "nulls": 38,
          "distinct": 261,
          "min": "2023-01-01",
          "max": "2023-12-31"
        },
        "dispensed_quantity": {
          "nulls": 63,
          "distinct": 30,
          "min": 1,
          "max": 30
        }
      }
    },
    "patients": {
      "rows": 150,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 150,
          "min": 1,
          "max": 150
        },
        "full_name": {
          "nulls": 0,
          "distinct": 149,
          "min": "Alice Jensen",
          "max": "Zoe Dubois"
        },
        "dob": {
          "nulls": 0,
          "distinct": 149,
          "min": "1920-08-20",
          "max": "2023-09-24"
        },
        "gender": {
          "nulls": 0,
          "distinct": 3,
          "min": "female",
          "max": "other"
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/medications.csv",
      "format": "csv",
      "table": "medications",
      "key": "datasets/pharmacy-dispensing/v2/csv/medications.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/csv/medications.csv",
      "bytes": 6215,
      "sha256": "27d399b2563c0bacc31b7c75f82885489feaa53f5a063ad5e6f5909dd8a83ef0",
      "rows": 200,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/patients.csv",
      "format": "csv",
      "table": "patients",
      "key": "datasets/pharmacy-dispensing/v2/csv/patients.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/csv/patients.csv",
      "bytes": 5036,
      "sha256": "6e37c80e702798381676acfcc4cd54dd3111fabea0702c6be342d6aa016da804",
      "rows": 150,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/prescribers.csv",
      "format": "csv",
      "table": "prescribers",
      "key": "datasets/pharmacy-dispensing/v2/csv/prescribers.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/csv/prescribers.csv",
      "bytes": 3672,
      "sha256": "1356cb98fa9c00b447c6e30d62f093caf71f54277f041bbc4d41e203b12a5276",
      "rows": 100,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/prescriptions.csv",
      "format": "csv",
      "table": "prescriptions",
      "key": "datasets/pharmacy-dispensing/v2/csv/prescriptions.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/csv/prescriptions.csv",
      "bytes": 9441,
      "sha256": "51e8aba24f00f394a7d2a59b0541a0422cf2855ef0db3f61e4e311da69551c2b",
      "rows": 400,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/dispensing_records.csv",
      "format": "csv",
      "table": "dispensing_records",
      "key": "datasets/pharmacy-dispensing/v2/csv/dispensing_records.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/csv/dispensing_records.csv",
      "bytes": 10549,
      "sha256": "0ba2e42c5a82c2b6c566a87346b125e2e3961d4695880f864f8fd45ea1e320f1",
      "rows": 500,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/stock_batches.csv",
      "format": "csv",
      "table": "stock_batches",
      "key": "datasets/pharmacy-dispensing/v2/csv/stock_batches.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/csv/stock_batches.csv",
      "bytes": 6484,
      "sha256": "8aa9e24ec886e3e519b1342c7c3091340206903dfa863be25b64baae12e0e09c",
      "rows": 300,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "pharmacy-dispensing.json",
      "format": "json",
      "table": null,
      "key": "datasets/pharmacy-dispensing/v2/pharmacy-dispensing.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/pharmacy-dispensing.json",
      "bytes": 202567,
      "sha256": "05205a07fd760b66fd91c9d9ece81c90ef3c628f4ae6698f68d6681c66b217da",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/pharmacy-dispensing/v2/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/sql/postgres.sql",
      "bytes": 64974,
      "sha256": "1c6e6961dc8d4cf97d36777c126750b190bc430e77cb249e5a4111ae47fb275e",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/pharmacy-dispensing/v2/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/sql/mysql.sql",
      "bytes": 64255,
      "sha256": "ed72d3be31d7ff0f84920335ceda8aab7d6bef30c66caaa9d1562fde5be2491e",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/pharmacy-dispensing/v2/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/sql/mssql.sql",
      "bytes": 66811,
      "sha256": "892e50730e75c4f0477b1064ab1b8fb4bb988fa2b89c425e507f366ce7523367",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/pharmacy-dispensing/v2/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/sql/sqlite.sql",
      "bytes": 64012,
      "sha256": "3c377d919173d6109ee6d19b56062be321ce15a4c45dc308d4555b72b86b5659",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/pharmacy-dispensing/v2/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/prisma/seed.ts",
      "bytes": 155374,
      "sha256": "af4c46203cc062047577a769cc138aa207da0f8dbb1a0c090db698d7f356d380",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/pharmacy-dispensing/v2/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-dispensing/v2/django/fixtures.json",
      "bytes": 278948,
      "sha256": "50f262ff54f7a9cb26c8f551e1003955808554cb1a9fa4e11eda11a790278b66",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788733866071,
  "updatedAt": 1788785453030
}
