📁 Showcase
Drug Master

Drug master

Feature

Allow Owner to manage medicines and drugs. Each drug is categorized further into brand, dose, and pack.

💡
Feature → Backend + Frontend

Backend

1. DrugBrandMaster

Create a DrugBrandMaster spreadsheet to store data related to drug brands.

ensure spreadsheet: DrugBrandMaster
  withFields: ["Brand"]
  ofTypes: [text]
  readRoleSet: [Owner]
  insertRoleSet: [Owner]
  removeRoleSet: [Owner]
  updateRoleSet: [Owner]
  modules: ["Pharmacy"]

ensure layoutSpreadsheet ListLayout kind: list
  filter.showSearchBar: true
  firstLine.first.lineFields: [Brand]

ensure form EntityDrugBrand
  modules: ["Pharmacy"]
  label: "Brand"

2. DrugDoseMaster

Create a DrugDoseMaster spreadsheet to store data related to drug doses.

ensure spreadsheet: DrugDoseMaster
  withFields: ["Dose"]
  ofTypes: [text]
  readRoleSet: [Owner]
  insertRoleSet: [Owner]
  removeRoleSet: [Owner]
  updateRoleSet: [Owner]
  modules: ["Pharmacy"]

ensure layoutSpreadsheet ListLayout kind: list
  filter.showSearchBar: true
  firstLine.first.lineFields: [Dose]

ensure form EntityDrugDose
  modules: ["Pharmacy"]
  label: "Dose"

3. DrugPackMaster

Create a DrugPackMaster spreadsheet to store data related to drug packs.

ensure spreadsheet: DrugPackMaster
  withFields: ["Pack"]
  ofTypes: [text]
  readRoleSet: [Owner]
  insertRoleSet: [Owner]
  removeRoleSet: [Owner]
  updateRoleSet: [Owner]
  modules: ["Pharmacy"]

ensure layoutSpreadsheet ListLayout kind: list
  filter.showSearchBar: true
  firstLine.first.lineFields: [Pack]

ensure form EntityDrugPack
  modules: ["Pharmacy"]
  label: "Pack"

4. DrugMaster

a. Spreadsheet

Create a DrugMaster spreadsheet to store data related to drugs.

ensure spreadsheet: DrugMaster
  withFields: ["Name", "Ingredient", "MRP", "Discount", "DiscountedPrice"]
  ofTypes: [text, text, number, number, number]
  modules: ["Pharmacy"]
  readRoleSet: [Owner]
  insertRoleSet: [Owner]
  removeRoleSet: [Owner]
  updateRoleSet: [Owner]

ensure form EntityDrug
  modules: ["Pharmacy"]
  label: "Drug"

ensure section: Details
ensure field Discount suffix: "%"
ensure field MRP prefix: "₹"
ensure field DiscountedPrice disabled: true

b. Reference Brand

Create a connection between DrugMaster and DrugBrandMaster to associate each drug with its corresponding brand.

ensure field BrandRef kind: ref
  spreadsheet: DrugBrandMaster
  layoutSpreadsheet: ListLayout
  copyFieldMap: {
    'BrandMasterRowId': '$RowId',
    'Brand': 'Brand'
  }
ensure field BrandMasterRowId
  permissionMatrix: {
    'defaultPermission': 'invisible'
  }
ensure field BrandRef categoryFilterDisplayField : Brand

c. Reference Dose

Create a connection between DrugMaster and DrugDoseMaster to associate each drug with its corresponding dose.

ensure field DoseRef kind: ref
  spreadsheet: DrugDoseMaster
  layoutSpreadsheet: ListLayout
  copyFieldMap: {
    'DoseMasterRowId': '$RowId',
    'Dose': 'Dose'
  }
ensure field DoseMasterRowId
  permissionMatrix: {
      'defaultPermission': 'invisible'
    }
ensure field DoseRef categoryFilterDisplayField : Dose

d. Reference Pack

Create a connection between DrugMaster and DrugPackMaster to associate each drug with its corresponding pack.

ensure field PackRef kind: ref
  spreadsheet: DrugPackMaster
  layoutSpreadsheet: ListLayout
  copyFieldMap: {
    'PackMasterRowId': '$RowId',
    'Pack': 'Pack'
  }
ensure field PackMasterRowId
  permissionMatrix: {
      'defaultPermission': 'invisible'
    }
ensure field PackRef categoryFilterDisplayField : Pack

e. Formulas

Set a formula to calculate the DiscountedPrice.

ensure formula DiscountedPriceFormula
  assignToField: DiscountedPrice
  formula: "(${f:MRP} - (${f:MRP} * (${f:Discount} / 100)))"

f. Searchable

Set the fields as searchable and/or queryable to enable search functionality on them.

ensure spreadsheet DrugMaster
  searchables: [Name, Ingredient, Brand, Dose, Pack]
  queryables: [DiscountedPrice]

g. ListLayout

Apply a ListLayout to the spreadsheet to display the data in a list format.

// Layout of list item as below,
//
// AmazingMed - 123
// Ingredient# Paracetamol
// Brand# Novartis
// Dose# 50 mg, Pack# 5 tablets
// MRP# Rs 1550, Discount %# 34%, DiscountedPrice# Rs 1023
ensure layoutSpreadsheet ListLayout kind: list
  filter.kind: tree
  filter.showSearchBar: true
  filter.categoryFields: [BrandRef, DoseRef, PackRef]
  filter.advanceFilterFields: [DiscountedPrice]
  filter.sortByFields: [DiscountedPrice, $CreatedOn]
  firstLine.first.lineFields: [Name]
  secondLine.first.lineFields: [Ingredient]
  secondLine.first.showLabels: true
  thirdLine.first.lineFields: [Brand]
  thirdLine.first.showLabels: true
  fourthLine.first.lineFields: [Dose, Pack]
  fourthLine.first.showLabels: true
  fifthLine.first.lineFields: [MRP, Discount, DiscountedPrice]
  fifthLine.first.showLabels: true

Frontend

1. Actions

a. BrandMaster

Implement a BrandMaster action to facilitate the modification and updating of existing brand information within the DrugBrandMaster spreadsheet.

ensure action BrandMaster kind: spreadsheetEditor
  modules: ["Pharmacy"]
  icon: "CategoryRounded"
  spreadsheet: DrugBrandMaster
  layoutSpreadsheet: ListLayout
  bulkInsertRoleSet: [Owner]

b. DoseMaster

Implement a DoseMaster action to facilitate the modification and updating of existing dose information within the DrugDoseMaster spreadsheet.

ensure action DoseMaster kind: spreadsheetEditor
  modules: ["Pharmacy"]
  icon: "CategoryRounded"
  spreadsheet: DrugDoseMaster
  layoutSpreadsheet: ListLayout
  bulkInsertRoleSet: [Owner]

c. PackMaster

Implement a PackMaster action to facilitate the modification and updating of existing pack information within the DrugPackMaster spreadsheet.

ensure action PackMaster kind: spreadsheetEditor
  modules: ["Pharmacy"]
  icon: "CategoryRounded"
  spreadsheet: DrugPackMaster
  layoutSpreadsheet: ListLayout
  bulkInsertRoleSet: [Owner]

d. DrugMaster

Implement a DrugMaster action to facilitate the modification and updating of existing drug information within the DrugMaster spreadsheet.

ensure spreadsheet DrugMaster

ensure layoutSpreadsheet Table kind: table
  showComps: [Name, Ingredient, MRP, Discount, DiscountedPrice, Brand, Dose, Pack]

ensure action DrugMaster kind: spreadsheetEditor
  modules: ["Pharmacy"]
  icon: "DatasetRounded"
  spreadsheet: DrugMaster
  layoutSpreadsheet: Table
  bulkInsertRoleSet: [Owner]

2. Group actions

Group all these actions into a DrugMaster section for more convenient access.

ensure group DrugMaster
  modules: ["Pharmacy"]
  pinnedActions: [DrugMaster]
  actionPermission: {
      'BrandMaster': {
        'menuGroup': 'MASTER',
        'roles': [
          'Owner'
        ]
      },
      'DoseMaster': {
        'menuGroup': 'MASTER',
        'roles': [
          'Owner'
        ]
      },
      'PackMaster': {
        'menuGroup': 'MASTER',
        'roles': [
          'Owner'
        ]
      },
      'DrugMaster': {
        'menuGroup': 'MASTER',
        'roles': [
          'Owner'
        ]
      }
    }

Agent

1. Configure Drive folder

To ensure seamless access to the Excel sheets on your system, please designate the folder name as BleachPharma, assuming the drive has been appropriately configured.

ensure root
  driveSheetMap.driveFolderName: BleachPharma

2. DrugBrandMaster.xlsx

Configure the Excel sheet properties for the DrugBrandMaster spreadsheet to be generated on the system where the drive is located.

ensure driveSheet DrugBrandMaster
  partitionedData: false 
  spreadsheet: DrugBrandMaster
  roles: [Owner]
  exportKindSet: ["xlsx"]

3. DrugDoseMaster.xlsx

Configure the Excel sheet properties for the DrugDoseMaster spreadsheet to be generated on the system where the drive is located.

ensure driveSheet DrugDoseMaster
  partitionedData: false
  spreadsheet: DrugDoseMaster
  roles: [Owner]
  exportKindSet: ["xlsx"]

4. DrugPackMaster.xlsx

Configure the Excel sheet properties for the DrugPackMaster spreadsheet to be generated on the system where the drive is located.

ensure driveSheet DrugPackMaster
  partitionedData: false
  spreadsheet: DrugPackMaster
  roles: [Owner]
  exportKindSet: ["xlsx"]

5. DrugMaster.xlsx

Configure the Excel sheet properties for the DrugMaster spreadsheet to be generated on the system where the drive is located.

ensure driveSheet DrugMaster
  partitionedData: false
  spreadsheet: DrugMaster
  roles: [Owner]
  exportKindSet: ["xlsx"]