Skip to content

Medical Code Masters & Medication/Procedure Setup

Overview

Biograph uses a FHIR-aligned coding system with two core DocTypes: Code System (the standard, e.g., ICD-10, SNOMED-CT) and Code Value (individual codes within a system). These are linked to clinical records via the Codification Table child table.

Additionally, Medication and Clinical Procedure Template masters define the clinical services available, their billing items, and consumable requirements.


Part 1: Medical Code Masters

Code System

Represents a medical coding standard (e.g., ICD-10, SNOMED-CT, LOINC, CPT).

Navigate to: Healthcare workspace > Code System > New

FieldTypeDescription
code_systemDataUnique name (e.g., "ICD-10-CM")
uriDataUnique URI identifier (FHIR-style, e.g., "http://hl7.org/fhir/sid/icd-10-cm")
descriptionSmall TextDescription of the coding system
statusLink → Code ValueActive/Retired/Draft
versionLink → Code ValueVersion identifier
is_fhir_definedCheckWhether this is a standard FHIR code system (default: ✓)
oidDataOID identifier (unique, optional)
experimentalCheckMark as experimental (default: ✓)
immutableCheckCodes cannot be modified once created
completeCheckAll codes in the system are present
customCheckUser-created (read-only, auto-set)
disabledCheckDeactivate the code system

Code Value

Individual codes within a Code System.

Key FieldsTypeDescription
code_systemLink → Code SystemWhich system this code belongs to
code_valueDataThe code itself (e.g., "J45.0")
displayDataHuman-readable name (e.g., "Predominantly allergic asthma")
definitionSmall TextDetailed description

Codification Table (Child Table)

This reusable child table links codes to clinical masters. Used in:

  • Appointment Typecodification_table
  • Medicationcodification_table
  • Clinical Procedure Templatecodification_table
  • Lab Test Templatecodification_table
FieldTypeDescription
code_systemLink → Code SystemThe coding standard
systemDataFetched URI (read-only)
is_fhir_definedCheckFetched from code system (read-only)
oidDataFetched OID (read-only)
code_valueLink → Code ValueThe specific code
codeDataFetched code value (read-only)
displayDataFetched display name (read-only)
definitionDataFetched definition (read-only)

Part 2: Medication Master

Overview

A Medication defines a drug or compound with its strength, dosage form, linked ERPNext items for billing/stock, and default prescription settings.

Navigate to: Healthcare workspace > Medication > New

Fields

Basic Details

FieldTypeDescription
generic_nameDataRequired, unique. The drug name (e.g., "Paracetamol 500mg")
medication_classLink → Medication ClassDrug category (e.g., "Analgesic", "Antibiotic")
national_drug_codeDataNational drug code identifier
abbrDataShort abbreviation
disabledCheckDeactivate this medication

Strength & Dosage

FieldTypeDescription
strengthFloatNumeric strength value (e.g., 500)
strength_uomLink → UOMUnit of measurement (e.g., "mg", "ml")
dosage_formLink → Dosage FormForm factor (e.g., "Tablet", "Syrup", "Injection")

Combination Medications

FieldTypeDescription
is_combinationCheckMark as combination drug
combinationsTable (Medication Ingredient)Component medications with their strengths (visible when is_combination=1)

Medication Ingredient child table fields:

  • medication: Link → Medication (the component drug)
  • strength: fetched from the component medication
  • strength_uom: fetched from the component medication

Item Linking (Billing & Stock)

FieldTypeDescription
linked_itemsTable (Medication Linked Item)ERPNext Items associated with this medication
price_listLink → Price ListPrice list for auto-created Item Prices

Medication Linked Item fields:

FieldTypeDescription
item_codeDataAuto-generated, set-only-once
itemLink → ItemThe created ERPNext Item (read-only)
item_groupLink → Item GroupRequired
stock_uomLink → UOMStock unit of measure
brandLink → BrandOptional brand
manufacturerLink → ManufacturerOptional manufacturer
is_billableCheckWhether to bill for this item (default: ✓)
rateFloatPrice (visible when is_billable=1)
descriptionSmall TextItem description

Prescription Defaults

FieldTypeDescription
default_prescription_dosageLink → Prescription Dosagee.g., "1-0-1" (morning-afternoon-night)
default_prescription_durationLink → Prescription Duratione.g., "7 Days", "1 Month"
default_intervalIntTime between doses
default_interval_uomSelectHour / Day

Medical Coding

FieldTypeDescription
codification_tableTable (Codification Table)Medical codes (e.g., ATC codes, RxNorm)

Auto Item Creation (medication.py)

  • after_insert() (line 15): Calls create_item_from_medication() — creates ERPNext Items from linked_items
  • on_update() (line 18): If linked items exist, calls update_item_and_item_price() to sync changes
  • insert_item() (line 92): Creates an Item with flags is_stock_item=1, is_sales_item=1
  • make_item_price() (line 126): Creates Item Price in the configured price list
  • change_item_code_from_medication() (line 138): Renames item code if medication name changes

Part 3: Clinical Procedure Template

Overview

Defines a clinical procedure (surgery, biopsy, dressing change, etc.) with billing configuration, consumable items for stock consumption, sample collection, and nursing checklists.

Navigate to: Healthcare workspace > Clinical Procedure Template > New

Fields

Basic Details

FieldTypeDescription
templateDataRequired, unique name
medical_departmentLink → Medical DepartmentDepartment that performs this procedure
descriptionSmall TextProcedure description (required)
disabledCheckDeactivate

Billing

FieldTypeDescription
link_existing_itemCheckLink to an existing ERPNext Item instead of auto-creating one
itemLink → ItemThe linked/created Item (read-only if auto-created)
item_codeDataItem code
item_groupLink → Item GroupRequired
is_billableCheckWhether this procedure is chargeable
rateFloatPrice (required if billable and not linking existing item)

Consumable Items (Stock Consumption)

FieldTypeDescription
consume_stockCheckEnable stock consumption tracking
itemsTable (Clinical Procedure Item)Consumable items used during the procedure

Clinical Procedure Item fields:

FieldTypeDescription
item_codeLink → ItemThe consumable item (required)
item_nameDataAuto-fetched (read-only)
qtyFloatQuantity consumed (required)
uomLink → UOMUnit of measure (required)
batch_noLink → BatchBatch tracking (optional)
invoice_separately_as_consumablesCheckBill consumables separately from the procedure fee

Sample Collection

FieldTypeDescription
sampleLink → Lab Test SampleSample type to collect (e.g., Blood, Urine)
sample_qtyFloatQuantity
sample_detailsSmall TextCollection instructions

Nursing Checklists

FieldTypeDescription
pre_op_nursing_checklist_templateLink → Nursing Checklist TemplatePre-operation checklist
post_op_nursing_checklist_templateLink → Nursing Checklist TemplatePost-operation checklist

Service Request Defaults

FieldTypeDescription
patient_care_typeLink → Patient Care TypeClassification
staff_roleLink → RoleRequired staff role to perform

Medical Coding

FieldTypeDescription
codification_tableTable (Codification Table)Procedure codes (e.g., CPT, SNOMED)

Auto Item Creation (clinical_procedure_template.py)

  • after_insert() (line 26): Creates ERPNext Item if link_existing_item is unchecked
  • on_update() (line 30): Detects changes and updates Item + Item Price
  • before_insert() (line 15): If linking existing item, fetches rate from existing Item Price
  • enable_disable_item() (line 45): Enables/disables the linked Item based on is_billable
  • get_item_details() (line 54, whitelisted): Returns item details for the procedure template

Part 4: Lab Test Template (Reference)

Similar to Clinical Procedure Template but for laboratory tests. Supports 6 test types:

TypeDescription
SingleOne numeric result with UOM and normal range
CompoundMultiple numeric results (child table: Normal Test Template)
DescriptiveFree-text results with optional sensitivity testing
GroupedComposite of multiple other lab tests
ImagingRadiology/imaging results
No ResultProcedure that doesn't produce a result

Key unique fields: lab_test_name, lab_test_template_type, lab_test_code, lab_test_group, lab_test_rate, lab_test_uom, lab_test_normal_range, sensitivity (for culture tests).


  • Code System: healthcare/healthcare/doctype/code_system/code_system.json
  • Codification Table: healthcare/healthcare/doctype/codification_table/codification_table.json
  • Medication: healthcare/healthcare/doctype/medication/medication.py
  • Medication JSON: healthcare/healthcare/doctype/medication/medication.json
  • Medication Ingredient: healthcare/healthcare/doctype/medication_ingredient/medication_ingredient.json
  • Medication Linked Item: healthcare/healthcare/doctype/medication_linked_item/medication_linked_item.json
  • Dosage Form: healthcare/healthcare/doctype/dosage_form/dosage_form.json
  • Clinical Procedure Template: healthcare/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
  • Clinical Procedure Item: healthcare/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.json
  • Lab Test Template: healthcare/healthcare/doctype/lab_test_template/lab_test_template.json