{
  "format": "dataset-manifest/1",
  "slug": "pharmacy-management-system",
  "version": 1,
  "seed": "pharmacy-management-system:1",
  "spec": {
    "format": "dataset/1",
    "slug": "pharmacy-management-system",
    "name": "Pharmacy Operations Dataset",
    "tagline": "Transactions, medications, customers, suppliers, and insurance providers from pharmacy operations.",
    "description": "Pharmacies manage the supply chain of medications while ensuring customer satisfaction and adherence to prescriptions. This dataset models the key elements of pharmacy operations, including transactions, medications dispensed, suppliers, insurance providers, and customer loyalty programs. The tables are interrelated, allowing for a comprehensive view of how medications are supplied, sold, and managed within a pharmacy environment. Questions that this data can help answer include which medications are most frequently dispensed, what impact suppliers have on inventory levels, and how customer loyalty programs influence purchasing behavior. Practitioners can use this synthetic dataset to explore various SQL queries and ORM seeding scenarios, simulating realistic pharmacy operation scenarios.",
    "domain": "pharmacy",
    "shape": "transactional",
    "useCases": [
      "sql-practice",
      "orm-seeding"
    ],
    "keywords": [
      "pharmacy",
      "medications",
      "transactions",
      "suppliers",
      "insurance",
      "loyalty programs",
      "customer satisfaction"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "transactions": {
        "description": "This table records each transaction that occurs in the pharmacy, linking to customers, medications, and insurance providers. Each row represents a unique sale, capturing details about the purchase.",
        "rows": 800,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each transaction."
          },
          "customer_id": {
            "kind": "fk",
            "ref": "customers.id",
            "description": "Reference to the customer making the purchase."
          },
          "medication_id": {
            "kind": "fk",
            "ref": "medications.id",
            "description": "Reference to the medication sold in this transaction."
          },
          "insurance_provider_id": {
            "kind": "fk",
            "ref": "insurance_providers.id",
            "nullable": true,
            "description": "Reference to the insurance provider covering the transaction."
          },
          "transaction_date": {
            "kind": "datetime",
            "from": "2023-01-01",
            "to": "2023-12-31",
            "description": "Date and time when the transaction occurred.",
            "dayProfile": "business"
          },
          "amount": {
            "kind": "decimal",
            "min": 1,
            "max": 5000,
            "scale": 2,
            "description": "Total amount of the transaction."
          }
        }
      },
      "medications": {
        "description": "This table contains details about medications available in the pharmacy. Each row represents a unique medication with its associated attributes.",
        "rows": 300,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each medication."
          },
          "name": {
            "kind": "fullName",
            "description": "Name of the medication."
          },
          "supplier_id": {
            "kind": "fk",
            "ref": "suppliers.id",
            "description": "Reference to the supplier providing this medication."
          },
          "price": {
            "kind": "decimal",
            "min": 0.5,
            "max": 1500,
            "scale": 2,
            "description": "Retail price of the medication."
          },
          "stock_quantity": {
            "kind": "int",
            "min": 0,
            "max": 100,
            "description": "Current stock level of the medication."
          }
        }
      },
      "customers": {
        "description": "This table holds information about the customers of the pharmacy. Each row represents a unique customer, including their loyalty program status.",
        "rows": 500,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each customer."
          },
          "full_name": {
            "kind": "fullName",
            "description": "Full name of the customer."
          },
          "email": {
            "kind": "email",
            "from": "full_name",
            "description": "Email address of the customer."
          },
          "loyalty_program": {
            "kind": "enum",
            "values": [
              "silver",
              "gold",
              "platinum"
            ],
            "description": "Loyalty program status of the customer."
          }
        }
      },
      "suppliers": {
        "description": "This table lists the suppliers of medications, including their contact details and ratings. Each supplier may provide multiple medications.",
        "rows": 50,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each supplier."
          },
          "name": {
            "kind": "fullName",
            "description": "Name of the supplier."
          },
          "contact_email": {
            "kind": "email",
            "from": "name",
            "description": "Contact email for the supplier."
          },
          "rating": {
            "kind": "decimal",
            "min": 1,
            "max": 5,
            "scale": 1,
            "description": "Supplier rating on a scale of 1 to 5."
          }
        }
      },
      "insurance_providers": {
        "description": "This table contains information about insurance providers that customers may use to pay for their medications.",
        "rows": 20,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each insurance provider."
          },
          "name": {
            "kind": "fullName",
            "description": "Name of the insurance provider."
          },
          "coverage_percentage": {
            "kind": "decimal",
            "min": 0,
            "max": 100,
            "scale": 2,
            "description": "Percentage of coverage provided by the insurance."
          }
        }
      },
      "loyalty_transactions": {
        "description": "This table tracks customer engagement in the loyalty program, linking transactions to loyalty points earned.",
        "rows": 600,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each loyalty transaction."
          },
          "customer_id": {
            "kind": "fk",
            "ref": "customers.id",
            "description": "Reference to the customer earning loyalty points."
          },
          "transaction_id": {
            "kind": "fk",
            "ref": "transactions.id",
            "description": "Reference to the transaction related to the loyalty points."
          },
          "points_earned": {
            "kind": "int",
            "min": 1,
            "max": 100,
            "description": "Number of loyalty points earned from the transaction."
          }
        }
      }
    },
    "structure": "multi-table",
    "traits": [
      "timestamped",
      "monetary",
      "categorical",
      "nullable"
    ],
    "analysisQuestions": [
      "What are the most frequently dispensed medications and how does that impact inventory?",
      "How do different insurance providers affect the total amount paid by customers?",
      "What is the correlation between customer loyalty program status and total spending?",
      "Which suppliers provide the most stock to the pharmacy, and how does that relate to medication availability?",
      "What trends can be observed in customer purchasing behavior over time?"
    ],
    "suggestedQueries": [
      {
        "title": "Get all transactions with customer details",
        "sql": "SELECT transactions.id, customers.full_name, transactions.amount FROM transactions JOIN customers ON transactions.customer_id = customers.id;",
        "dialect": "postgres"
      },
      {
        "title": "Count transactions per medication",
        "sql": "SELECT medications.name, COUNT(transactions.id) AS transaction_count FROM transactions JOIN medications ON transactions.medication_id = medications.id GROUP BY medications.name;",
        "dialect": "postgres"
      },
      {
        "title": "Total amount spent by each customer",
        "sql": "SELECT customers.full_name, SUM(transactions.amount) AS total_spent FROM transactions JOIN customers ON transactions.customer_id = customers.id GROUP BY customers.full_name;",
        "dialect": "postgres"
      },
      {
        "title": "Average points earned per transaction in the loyalty program",
        "sql": "SELECT AVG(loyalty_transactions.points_earned) AS average_points FROM loyalty_transactions JOIN transactions ON loyalty_transactions.transaction_id = transactions.id;",
        "dialect": "postgres"
      },
      {
        "title": "Monthly medication sales trends",
        "sql": "SELECT DATE_TRUNC('month', transaction_date) AS month, SUM(amount) AS total_sales FROM transactions GROUP BY month ORDER BY month;",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Pharmacy Manager Analysis",
        "body": "A pharmacy manager can use this dataset to analyze sales trends and stock levels by querying transaction data alongside medication details. This insight allows for better inventory management and informed purchasing decisions from suppliers."
      },
      {
        "title": "Customer Engagement Strategies",
        "body": "Marketing teams can leverage the loyalty transactions table to identify high-value customers and tailor engagement strategies that enhance customer retention and loyalty program participation."
      },
      {
        "title": "Insurance Provider Impact Study",
        "body": "Healthcare analysts can explore how different insurance providers influence medication purchases and customer spending patterns, helping to assess the effectiveness of coverage options offered."
      },
      {
        "title": "Supplier Performance Evaluation",
        "body": "Pharmacy operations can benefit from reviewing supplier performance through the medications and suppliers tables, allowing for strategic decisions regarding vendor relationships and stock management."
      }
    ]
  },
  "counts": {
    "customers": 500,
    "insurance_providers": 20,
    "suppliers": 50,
    "medications": 300,
    "transactions": 800,
    "loyalty_transactions": 600
  },
  "stats": {
    "transactions": {
      "rows": 800,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 800,
          "min": 1,
          "max": 800
        },
        "customer_id": {
          "nulls": 0,
          "distinct": 391,
          "min": 1,
          "max": 500
        },
        "medication_id": {
          "nulls": 0,
          "distinct": 263,
          "min": 1,
          "max": 300
        },
        "insurance_provider_id": {
          "nulls": 88,
          "distinct": 20,
          "min": 1,
          "max": 20
        },
        "transaction_date": {
          "nulls": 0,
          "distinct": 800,
          "min": "2023-01-01 10:51:20",
          "max": "2023-12-31 11:49:45"
        },
        "amount": {
          "nulls": 0,
          "distinct": 800,
          "min": 38.14,
          "max": 4996.68
        }
      }
    },
    "medications": {
      "rows": 300,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 300,
          "min": 1,
          "max": 300
        },
        "name": {
          "nulls": 0,
          "distinct": 291,
          "min": "Alice Ahmed",
          "max": "Zoe Sato"
        },
        "supplier_id": {
          "nulls": 0,
          "distinct": 50,
          "min": 1,
          "max": 50
        },
        "price": {
          "nulls": 0,
          "distinct": 300,
          "min": 2.39,
          "max": 1499.82
        },
        "stock_quantity": {
          "nulls": 0,
          "distinct": 95,
          "min": 0,
          "max": 100
        }
      }
    },
    "customers": {
      "rows": 500,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 500,
          "min": 1,
          "max": 500
        },
        "full_name": {
          "nulls": 0,
          "distinct": 489,
          "min": "Alice Hansen",
          "max": "Zoe Wagner"
        },
        "email": {
          "nulls": 0,
          "distinct": 496
        },
        "loyalty_program": {
          "nulls": 0,
          "distinct": 3,
          "min": "gold",
          "max": "silver"
        }
      }
    },
    "suppliers": {
      "rows": 50,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 50,
          "min": 1,
          "max": 50
        },
        "name": {
          "nulls": 0,
          "distinct": 50,
          "min": "Alice Gupta",
          "max": "Zoe Dubois"
        },
        "contact_email": {
          "nulls": 0,
          "distinct": 50
        },
        "rating": {
          "nulls": 0,
          "distinct": 30,
          "min": 1,
          "max": 5
        }
      }
    },
    "insurance_providers": {
      "rows": 20,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 20,
          "min": 1,
          "max": 20
        },
        "name": {
          "nulls": 0,
          "distinct": 20,
          "min": "Alice Davis",
          "max": "Zoe Vargas"
        },
        "coverage_percentage": {
          "nulls": 0,
          "distinct": 20,
          "min": 0.16,
          "max": 99.38
        }
      }
    },
    "loyalty_transactions": {
      "rows": 600,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 600,
          "min": 1,
          "max": 600
        },
        "customer_id": {
          "nulls": 0,
          "distinct": 347,
          "min": 1,
          "max": 500
        },
        "transaction_id": {
          "nulls": 0,
          "distinct": 418,
          "min": 4,
          "max": 799
        },
        "points_earned": {
          "nulls": 0,
          "distinct": 99,
          "min": 2,
          "max": 100
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/customers.csv",
      "format": "csv",
      "table": "customers",
      "key": "datasets/pharmacy-management-system/v1/csv/customers.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/csv/customers.csv",
      "bytes": 24042,
      "sha256": "33586ea20e2a63f3fc2c5d8c3e4c4ecc21db7e5f4229daf9ee364a868c66f9b7",
      "rows": 500,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/insurance_providers.csv",
      "format": "csv",
      "table": "insurance_providers",
      "key": "datasets/pharmacy-management-system/v1/csv/insurance_providers.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/csv/insurance_providers.csv",
      "bytes": 468,
      "sha256": "a34d89e774827eddad3109052b471a63337f0067e74820961d63d87fb65f2147",
      "rows": 20,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/suppliers.csv",
      "format": "csv",
      "table": "suppliers",
      "key": "datasets/pharmacy-management-system/v1/csv/suppliers.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/csv/suppliers.csv",
      "bytes": 2231,
      "sha256": "9a5937c5776238fa32465f05044b9ef26414c1db411d02013ef2331a71f91aef",
      "rows": 50,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/medications.csv",
      "format": "csv",
      "table": "medications",
      "key": "datasets/pharmacy-management-system/v1/csv/medications.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/csv/medications.csv",
      "bytes": 8906,
      "sha256": "6892d948a26cfb380b6d76c93de5054a7be64ed6220a4665f633cbcc9ae30d96",
      "rows": 300,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/transactions.csv",
      "format": "csv",
      "table": "transactions",
      "key": "datasets/pharmacy-management-system/v1/csv/transactions.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/csv/transactions.csv",
      "bytes": 33997,
      "sha256": "476c6ba8f8aa61018fbd294e233522d7eee1705a8b19a80b23233683a42fdf07",
      "rows": 800,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/loyalty_transactions.csv",
      "format": "csv",
      "table": "loyalty_transactions",
      "key": "datasets/pharmacy-management-system/v1/csv/loyalty_transactions.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/csv/loyalty_transactions.csv",
      "bytes": 9276,
      "sha256": "2fad00c840bd76705aa7a1d33c60459280fb5f7d592344c330a1d82d4d82ff01",
      "rows": 600,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "pharmacy-management-system.json",
      "format": "json",
      "table": null,
      "key": "datasets/pharmacy-management-system/v1/pharmacy-management-system.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/pharmacy-management-system.json",
      "bytes": 337250,
      "sha256": "e7ce4359283569e3a64b7a4950c83990ecdc54c947e8f2f4e3e82bec8f1df8be",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/pharmacy-management-system/v1/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/sql/postgres.sql",
      "bytes": 111294,
      "sha256": "e1e687d386db5be9d2765d4d60ea3251b746aa553eb8c7a0154a568098aed015",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/pharmacy-management-system/v1/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/sql/mysql.sql",
      "bytes": 110558,
      "sha256": "6ceb08986ac485ab4da48ef314ca79af8c489e7a01d33714ae0a505f8222b4fb",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/pharmacy-management-system/v1/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/sql/mssql.sql",
      "bytes": 113716,
      "sha256": "17b6573ba6dfb9fc70389c461205dbe1619f46ff1b0cfc6f72dd03b04d608d9c",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/pharmacy-management-system/v1/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/sql/sqlite.sql",
      "bytes": 110211,
      "sha256": "ad277a1457344a012895e6c14c8b5d9b91348ed90e3a6b55d869009f678d5590",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/pharmacy-management-system/v1/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/prisma/seed.ts",
      "bytes": 271086,
      "sha256": "22a2af99c2bb08f50d329b643c36ffd5e09b4b495c1c87b71b6295c6061fcd6b",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/pharmacy-management-system/v1/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/pharmacy-management-system/v1/django/fixtures.json",
      "bytes": 440007,
      "sha256": "99d10b89d8775bf5ca2584aa3dadd2cbaef9d9fcd8aff635a97f651765c2b6c0",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788733935085,
  "updatedAt": 1788733935085
}
