# WEB APPS FOR MEDICAL RECORD DATABASE FOR ORTHODONTIC DENTAL CLINIC.

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.

Before you make code that interact with the database, you should:

- Check the database structure and the table structure to understand which columns and which tables you will interact with.

## Project Context

Web apps that have functionality to store medical record data for Orthodontic dental clinic. The doctor will filled the medical record data, with some fields are optional and some fields are mandatory. If it's mandatory then it should be mark with a star sign may be small and red color. The web will be in Bahasa Indonesia. It will use PHP 8.1 as the backend. It will store the database in MySQL. For simplicity we can use safemysql.

- We will use stisla template, to read the documentation you can read the documentation on https://web.archive.org/web/20220211050241/https://docs.getstisla.com/#/en/2.2.0/overview
- First section will be the Data Diri Pasien. There will be 5 fields in this section that are required. Tanggal Pemeriksaan (Date with the default value today), Nomor Rekam Medik (Medical Record Number), Tanggal Lahir (Date), Usia (Age, will be automatically filled by inputing the Tanggal Lahir), Jenis Kelamin (Gender, Select between Laki-laki or Perempuan).
- Second section will be Anamnesis. There will be 3 fields in this section. The first one is Keluhan Utama Kasus Ortodontik (required, text area). The second one is Riwayat Kesehatan Umum yang berhubungan dengan maloklusi (required, text area). The third one is Kebiasaan Buruk yang berhubungan dengan maloklusi (optional, checkbox) (The choices are Tongue Thrust/Menjulurkan Lidah, Mouth Breathing/Bernafas melalui mulut, Thumb Sucking/Menghisap Jari, Bruxism/Clenching, dan lain-lain) if the user choose dan lain-lain, the user must write the details on the textbox next to it.
- Third section will be Pemeriksaan Ekstra Oral. In this section there will be 3 parts (Vertikal, Transversal, Bibir).
  - First part of Pemeriksaan Ekstra Oral (Vertikal) will have 2 fields. The first field is Bentuk Wajah (select or radio, Mesofasial, Brakifasial, Dolikofasial). The second field is Keseimbangan Wajah (radio, Seimbang, Tidak Seimbang. If the user choose tidak seimbang there will be a input field for the user to type how many mm the tidak seimbang can be decimal as well).
  - Second Part of Pemeriksaan Ekstra Oral (Transversal) will have 4 fields. The first field is Keseimbangan Wajah (radio, Seimbang, Tidak Seimbang. If the user choose tidak seimbang there will be a input field for the user to type how many mm the tidak seimbang can be decimal as well). Second field is Dagu (radio, Normal, Miring ke Kanan, Miring ke Kiri). Third field is Garis Tengah Geligi Atas (radio, Ke Kiri, Normal, Ke Kanan. If the user choose Ke Kiri or Ke Kanan then there will be number input field for the user to write in mm can be decimal as well). Fourth field is Garis Tengah Geligi Bawah (radio, Ke Kiri, Normal, Ke Kanan. If the user choose Ke Kiri or Ke Kanan then there will be number input field for the user to write in mm can be decimal as well).
  - Third part of Pemeriksaan Ekstra Oral (Bibir) will have 6 fields. The first field is Tonus Bibir Atas (radio, Normal, Hipertonus, Hipotonus). The second field is Tonus Bibir Bawah (radio, Normal, Hipertonus, Hipotonus). The third field is Kompetensi Bibir (radio, Kompeten, Tidak Kompeten). The fourth field is Profil E-Line (radio, Lurus, Cembung, Cekung). The fifth field is Bibir Atas terhadap E-Line (number fields in mm, can be decimal). The sixth field is Bibir Bawah terhadap E-Line (number fields in mm, can be decimal).
- Fourth section will be Pemeriksaan Intra Oral, there will be 12 fields in this section. The first field is Kebersihan Mulut (radio, Baik, Sedang, Buruk). The second field is Frenulum Labii Superior (radio, Tinggi, Sedang, Rendah). The third field is Frenulum Labii Inferior (radio, Tinggi, Sedang, Rendah). The fourth field is Lidah (radio, Normal, Makroglosia, Mikroglosia). The fifth field is Palatum (radio, Normal, Dalam, Kelainan). The sixth field is Adenoid (radio, Normal, Kelainan). The seventh field is Crowding (radio, Rahang Atas, Rahang Bawah, Rahang Atas + Rahang Bawah). The eight field is Hubungan Rahang (radio, Kelas I, Kelas II, Kelas III). The ninth field is Diastema (text field, with placeholder 'Regio ..., ... mm'). The tenth field is Crossbite (text field, with placeholder 'Regio ...'). The eleventh field is Kelainan Bentuk Gigi (radio, Ada, Tidak. There will be text field beside it for the dentist to insert the Regio). The Twelfth field is Kelainan Jumlah Gigi (radio, Ada, Tidak. There will be text field beside it for the dentist to insert the Regio).
- Fifth section will be Relasi Gigi Geligi, there will be 16 fields in this section. The first field is Overjet (mm) (input number in mm, can be decimal). The second field is Overbite (mm) (input number in mm, can be decimal). The third field is Kurva Spee (radio, Lurus, Curam, Antikurva). The fourth field is Hubungan Insisif (radio, Lurus, Curam, Antikurva). The fifth field until the tenth field will be in Hubungan Molar-1. The fifth field until the seventh field is Kanan, while the Eight field until the tenth field is Kiri. The fifth field is Sagital (radio, Kelas I, Kelas II, Kelas III). The sixth field is Transversal (radio, Normal, Gigitan Silang, Tonjol-tonjol, Scissor Bite). The seventh field is Vertikal (radio, Normal, Gigitan Terbuka, Tonjol-tonjol). The eight field is Sagital (radio, Kelas I, Kelas II, Kelas III). The ninth field is Transversal (radio, Normal, Gigitan Silang, Tonjol-tonjol, Scissor Bite). The tenth field is Vertikal (radio, Normal, Gigitan Terbuka, Tonjol-tonjol). The eleventh field until the sixteenth field will be in Hubungan Kaninus. The eleventh field until the thirteenth field is Kanan, while the fourteenth field until the sixteenth field is Kiri. The eleventh field is Sagital (radio, Kelas I, Kelas II, Kelas III). The twelve field is Transversal (radio, Normal, Gigitan Silang, Tonjol-tonjol, Scissor Bite). The thirteenth field is Vertikal (radio, Normal, Gigitan Terbuka, Tonjol-tonjol). The fourteenth field is Sagital (radio, Kelas I, Kelas II, Kelas III). The fifteenth field is Transversal (radio, Normal, Gigitan Silang, Tonjol-tonjol, Scissor Bite). The sixteenth field is Vertikal (radio, Normal, Gigitan Terbuka, Tonjol-tonjol).
- Sixth section will be Analisis Fungsional. Will be divided into 2 parts (TMJ, Oklusi). For the first part (TMJ) there will be 2 fields. The first field in TMJ is Palpasi (radio, Normal, Sakit. If the user choose sakit there will be choices to choose between Kiri, Kanan, Bilateral). The second field in TMJ is Bunyi Clicking/Krepitasi (radio, Ada, Tidak Ada. If the user choose ada there will be choices to choose between Kanan Kiri Bilateral. There's other choice to choose also Saat buka mulut, Saat tutup mulut, Keduanya. So the user need to choose between those choices.) The first field in Oklusi is Interocclusal Clearance (number input in mm, can be decimal). The second field in Oklusi is Oklusi Sentrik dan Relasi Sentrik (radio, Sama, Tidak Sama). The third field in Oklusi is Hambatan Oklusi Vertikal/Occlusal Interference (radio, Ada, Tidak Ada. If the user choose Ada there will be text input field where the user need to write the Regio). The fourth field in Oklusi is Hambatan Oklusi Horizontal (radio, Ada, Tidak Ada. If the user choose Ada there will be text input field where the user need to write the Regio).
- Seventh section will be Analisis Radiologis. The first field the user will upload image Foto Sefalometri Lateral. Then the image uploaded will be display on the website. The dentist then can mark the Cephalometric Image with the landmark. There will be 17 marks (Sella/S, Nasion/N, Orbitale/O, A, B, Pogonion/Pg, Gonion/Go, Gnation/Gn, Menton/Me, Anterior Nasal Spine/ANS, Posterior Nasal Spine/PNS, Porion/Po, Orbitale/O, Ls, Li, L0, Ui, U0, UL, LL) and 9 lines will be formed out of those landmark(SN Plane (S to N), Frankfurt Horizontal Plane (From Po to O), Palatal Plane (ANS to PNS), Mandibular Plane (Go to Me), Maxillary Incisor (Ui to U0), Mandibular Incisor (Li to L0), NA, NB, NaPg). The dentist will also mark the E-Line. There should be a ruler to measure between certain points, to standard the image no matter the size please make the ruler standarize the image length is 20,32 cm x 25,4 cm.Please use proportion if the image uploaded is not that size. Under the image and all of those lines and landmarks there will be table for the analyses of the cephalometric. The table will have 4 columns (Parameter, Rata-Rata, Pasien, Kesimpulan). The parameter will be the lines that we want to see, the Rata-rata is the standard angle that will be given by the programmer (make it fixed but easy to change through the code), the Pasien is the angle result from the cephalometric image (if possible to make it automatic, make it automatic get it from the cephalometric landmarks and lines but make it input as well so the dentist can change it manually if needed), the Kesimpulan will be the analyses it will be automated by comparing the result in Pasien with the Rata-rata.
- The first part of the table consist of 4 items. The first part is called Nilai Parameter Skeletal (Horizontal). The first item is SNA (Steiner). The rata-rata is 82deg±2deg. Please automated the Pasien from the SNA angle that formed on the cephalometric image. Kesimpulan is 'Kedudukan Maksila terhadap basis cranii ' retrognati/orthognati/prognati depends on the Pasien result compare to Rata-rata. The second item is SNB (Steiner). The rata-rata is 80deg±2deg. Please automated the Pasien from the SNB angle that formed on the cephalometric image. Kesimpulan is 'Kedudukan Mandibula terhadap basis cranii ' retrognati/orthognati/prognati depends on the Pasien result compare to Rata-rata. The third item is ANB (Steiner). The rata-rata is 2deg±2deg. The pasien is automated from the SNA minus SNB or the angle between ANB. The kesimpulan is 'Kedudukan mandibula terhadap maksila ' retrognati/orthognati/prognati Pola Skeletal Kelas I/II/III. The fourth item is NaPg (Downs). The rata-rata is 0deg±5,1deg. Please make the Pasien automated from the result of angle between Na and Pg. The kesimpulan please make it automated by comparing the Pasien result with the rata-rata, the kesimpulan is 'Profil Skeletal ' cekung/lurus/cembung.
- The second part of the table consist of 2 items. The second part is called Nilai Parameter Skeletal (Vertikal). The first item is MMPA (Eastman). The rata-rata is 27deg±4deg. The pasien make it automated as the result of angle between Mandibular Plane and Maxillary Plane. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Kedudukan bidang maksila terhadap bidang mandibula retrusif/normal/protrusif. The second item is FMPA (Tweed). The rata-rata is 25deg±3deg. The pasien make it automated based on the cephalometric image result of angle between Frankfurt Horizontal Plane and Mandibular Plane. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Pertumbuhan 1/3 muka bawah dalam arah posteroinferior' Kurang Dari Normal/Normal/Lebih Dari Normal.
- The third part of the table consist of 7 items. The third part is called Nilai Parameter Dental. The first item is FMIA. The rata-rata is 65deg±2deg. The pasien make it automated based on the cephalometric image result of angle between Frankfurt Horizontal Plane and Mandibular Incisor Plane. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Inklinasi insisif bawah terhadap basis cranii' protrusif/normal/retrusif. The second item is IMPA. The rata-rata is 90deg±5deg. The pasien make it automated based on the cephalometric image result of angle between Mandibular Plane and Mandibular Incisor Plane. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Inklinasi insisif bawah terhadap bidang mandibula ' retrusif/normal/protrusif. The third item is I-SN. The rata-rata is 104deg±6deg. The pasien make it automated based on the cephalometric image result of angle between Maxillary Incisor and SN Line. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Inklinasi insisif atas terhadap basis cranii ' retrusif/normal/protrusif. The fourth item is I-MxPI. The rata-rata is 109deg±6deg. The pasien make it automated based on the cephalometric image result of angle between Maxillary Plane and Maxillary Incisor Plane. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Inklinasi insisif atas terhadap bidang maksila ' retrusif/normal/protrusif. The fifth item is Ui-NA. The rata-rata is 4mm±2mm. The pasien make it automated based on the cephalometric image result of distance between NA Plane and Ui. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Inklinasi insisif atas terhadap basis cranii ' retrusif/normal/protrusif. The fifth item is Ui-NA. The rata-rata is 4mm±2mm. The pasien make it automated based on the cephalometric image result of distance between NA Plane and Ui. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Inklinasi insisif atas terhadap basis cranii ' retrusif/normal/protrusif. The sixth item is Li-NB. The rata-rata is 4mm±2mm. The pasien make it automated based on the cephalometric image result of distance between NA Plane and Li. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Inklinasi insisif bawah terhadap basis cranii ' retrusif/normal/protrusif. The seventh item is Interincisal Angle. The rata-rata is 135deg±10deg. The pasien make it automated based on the cephalometric image result of angle between Maxillary Incisor Plane and Mandibular Incisor Plane. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is ' Inklinasi insisif bawah terhadap insisif atas ' retrusif/normal/protrusif.
- The fourth part of the table consist of 2 items. The fourth part is called Nilai Parameter Jaringan Lunak. The first item is E-Line Bibir Atas. The rata-rata is 1mm±2mm. The pasien make it automated based on the cephalometric image result of distance between E-Line and UL. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Bibir atas ' retrusif/normal/protrusif. The second item is E-Line Bibir Bawah. The rata-rata is 0mm±2mm. The pasien make it automated based on the cephalometric image result of distance between E-Line and LL. The kesimpulan is automated based on the Pasien result compared to the Rata-rata. The kesimpulan is 'Bibir bawah ' retrusif/normal/protrusif.
- Still on the seventh section, under those table will be the next field Kesimpulan Analisis Sefalometri (textarea). But make it automated filled from the Kesimpulan of the table. Here is the guide 'Maloklusi skeletal kelas 1/2/3 (FROM ANB) (Hubungan maksila dan mandibula retrognati/orthognati/prognati (FROM ANB)) dengan maksila prognati/orthognati/retrognati (FROM SNA) terhadap basis kranii dan mandibula prognati/orthognati/retrognati (FROM SNB). Profil skeletal cekung/lurus/cembung (FROM NaPg) dan pertumbuhan vertikal ⅓ wajah bawah kurang dari normal/normal/lebih dari normal(FROM FMPA). Inklinasi insisif atas terhadap basis kranii retrusif/normal/protrusif (FROM I-SN) dan inklinasi insisif atas terhadap bidang maksila retrusif/normal/protrusif (FROM I-MxPI), inklinasi insisif bawah terhadap basis kranii retrusif/normal/protrusif (FROM Li-NB) dan inklinasi insisif bawah terhadap bidang mandibula retrusif/normal/protrusif (FROM IMPA), serta inklinasi insisif bawah terhadap atas retrusif/normal/protrusif (FROM Interincisal Angle). Posisi bibir atas retrusif/normal/protrusif (From E-Line Bibir Atas). Posisi bibir bawah retrusif/normal/protrusif (From E-Line Bibir Bawah).
- Still on the seventh section, the next part is Foto Panoramik. In this part there will be 10 fields. The first field the user will upload Foto Panoramik (input file). The image then will be displayed on the website. The second field is Keadaan Tulang (input text). The third field is Keadaan Jaringan Periodontal (input text). The fourth field is Karies (input text). The fifth field is Kehilangan Gigi (input text). The sixth field is Agenesis (radio, Ada, Tidak Ada. If the user choose Ada there will be input text beside it for the user to write the regio). The seventh field is Impaksi (input text). The eight field is Gigi Berlebih (input text). The ninth field is Lain-Lain (input text). The tenth field is Urutan Erupsi Gigi (there will be 4 input text, on the top left, top right, bottom left, bottom right. There will be line at the middle horizontal and vertical to separate those 4 input text. Please make those 4 input text have the same length).
- Still on the seventh section, the next part is Lain-lain (Dental, CBCT, Carpal). In this part the user can upload another radiograph such as Dental, CBCT, or Carpal. Please display the radiograph on the website. If it's 3D make it can be interact with.
- The eight section will be called Analisis Model. There will be 3 fields in this section. The first and second field is in Bentuk Lengkung Gigi part. The first field is Rahang Atas (select, Segi Empat/Square, Segitiga, Omega, Oval). The second field is Rahang Bawah (select, Segi Empat/Square, Segitiga, Omega, Oval). The next part is Lebar mesio-distal gigi-gigi (mm) dan Posisi gigi pada lengkungnya. This part is table consist of 17 columns and 10 rows. The first columns on each rows is the Keterangan. The first row is Kondisi Gigi, on each cell make a input text except the first column, make placeholder KE. The second row is Malposisi, on each cell make a input text except the first column, make placeholder LaTV. The third row is Lebar Mesiodistal, on each cell make a input text except the first column, make placeholder 5. The fourth row only the fifth column until fourteenth column will be filled. They will be filled with text from V to I (5th column until 9th column), and I to V (10th column until 14th column). Please make the background grey. When the user click one of the cell that have text, there will be red X appear on that cell from the top right to the bottom left and top left to bottom right. If the user click it again the red X will dissapear. If the user click it again the red X will appear again and so on. On the fifth row until the sixth row, filled each cells from the second to the seventeenth with number from 8 to 1 (2nd column until 9th column) and number from 1 to 8 (10th column until 17th column). Please make the background grey. When the user click one of the cell that have text, there will be red X appear on that cell from the top right to the bottom left and top left to bottom right. If the user click it again the red X will dissapear. If the user click it again the red X will appear again and so on. The seventh row will be same like the fourth row. The eight row will be same like the third row. The ninth row will be same like the second row. The tenth row will be same like the first row.
- The ninth section is Analisis Kebutuhan Ruang. There are 5 Analisis Kebutuhan Ruang. The first is Moyers. In this part the user will insert the length of 4 teeth (32, 31, 41, 42). Please automatic fill it with the length of those 4 teeth mandibular incisor teeth that the user insert on section Eight. The user will also need to fill the Available Space for maxillary left, maxillary right, mandibular left, mandibular right.The next field is Jenis Kelamin (Laki-Laki/Perempuan) (Please fill this automatic as well). Then to find the required space, we take the 75% value from the moyers table (if you can make this automated please make it, if you dont have the table, I will give it to you). Then we can find the difference between the available and required space to get the space availability.
- The second Analisis Kebutuhan Ruang is Kesling. For this analysis the first is we need to get the Required Space for Maxillary Left, Maxillary Right, Mandibular Right, Mandibular Left. Please make this field automated by calculating the width of each tooth from 2nd premolar each quadrant until central incisor in each quadrant from section Eight. Make this available to change as well for the user. Then the user will insert the available space for each quadrant. Then we can find the difference between the available and required space to get the space availability.
- The third analisis kebutuhan ruang is Lundstrum (ALD). For this analysis similar to the kesling, however there are 6 sections for maxilla and 6 sections for mandibula. For Maxilla, S1 is tooth 16 and 15. S2 is tooth 14 and 13. S3 is tooth 12 and 11. S4 is tooth 21 and 22. S5 is tooth 23 and 24. S6 is tooth 25 and 26. For Mandibula, S6 is tooth 36 and 35. S5 is tooth 34 and 33. S4 is tooth 32 and 31. S3 is tooth 41 and 42. S2 is tooth 43 and 44. S1 is tooth 45 and 46. First we need to get the Required Space for each Section. Please make this field automated by calculating the width of each tooth from section Eight. Make this available to change as well for the user. Then the user will insert the available space for each section. Then we can find the difference between the available and required space to get the space availability for each section.
- The fourth analisis kebutuhan ruang is Ponts. For this analysis first the user will input MPV (Measured Premolar Value, number input in mm, can be decimal). Then the user will input MMV (Measured Molar Value, number input in mm, can be decimal). Then the user will input the S.I (number in mm, can be decimal. Please make this automated by sum the width of 4 maxillary incisor tooth from section eight). Then the system will automatically display the CPV value (Si/80*100) and CMV value (Si/64*100).
- The fifth analisis kebutuhan ruang is Howe. First the user will input the PMBAW (Premolar Basal Arc Width, number in mm, can be decimal). Then the user will input the TTM (Total Tooth Material, number in mm, can be decimal. Please make this automated by sum the width of maxillary tooth except the second molar). Then the system will automatically display the PMBAW/TTM\*100 value.
- Under those 5 Analisis Kebutuhan Ruang, there will be Kesimpulan Analisis Kebutuhan Ruang (radio, Ekstraksi, Borderline, Non-Ekstraksi).
- Under Kesimpulan Analisis Kebutuhan Ruang, there will be Metode Pencarian Ruang. The mouth will be divided into 4 regio (Maxillary Left, Maxillary Right, Mandibular Left, Mandibular Right). Each regio will have 5 options (Ekstraksi, Protraksi, Slicing, Distalisasi Molar, Ekspansi) (If the user choose Ekstraksi, then the user can choose which tooth to be extracted for each regio (1,2,3,4,5,6,7,8,supernumerary tooth)).
- The tenth section is Diagnosis. For this section there will be 6 fields. The first field is Maloklusi Skeletal (radio, 1, 2, 3, 4, 5). The second field is Maloklusi Angle (radio, 1, 2, 3). The third field is Cleft Lip (radio, unilateral, bilateral). The fourth field is Cleft Lip Palate (radio, unilateral, bilateral). The fifth field is Cleft Palate (radio, unilateral, bilateral). The sixth field is Sindrom (radio, Ya, Tidak. If Ya there will be input text field for the user to write the Sindrom).
- The eleventh section is Rencana Terapi. There will be 3 fields. The first field is Rencana Terapi (checkbox, Perawatan Orthodonti, Perawatan Fungsional, Perawatan Bedah Ortho). The second field and third field is under Piranti Ortho yang Digunakan. The second field is Utama (checkbox, Cekat Konvensional, Cekat Self-Ligating, Removable Appliance, Myofunctional, Clear Aligner) IF the user choose Myofunctional, there will be input text field for the user to write the Myofunctional Terapi. The third field is Tambahan (checkbox, MiniScrew, RPE, TPA, Pendex, Nance, Lain-Lain) If the user choose Lain-Lain, there will be input text field for the user to write the Lain-Lain. The fourth field is Retainer (checkbox, Essix, Hawley, Fixed, Lain-Lain) If the user choose Lain-Lain, there will be input text field for the user to write the Lain-Lain.
- The twelfth section is Gambar Alat. There should be a canvas to display the image of the mouth. Then there are buttons on the sides to add image overlay to the canvas (T-Spring, Finger Spring, Z-Spring, Adam's, Labial Bow) and there are buttons to remove the image overlay (T-Spring, Finger Spring, Z-Spring, Adam's, Labial Bow). User should be able to resize the image overlay. The user should be able to draw on the canvas as well.
- The thirteenth section is Foto. The user can upload the image of the patient. The image will be displayed on the website. There are 3 types of images (Ekstra Oral, Intra Oral, Model). There should be 2 categories for each type (Before, After).
- The user should be able to edit the data that already filled on the previous section.
- The user should be able to print the data that already filled on the previous section.
- The user should be able to export the data that already filled on the previous section to excel file.
- The user should be able to export the data that already filled on the previous section to pdf file.
- The user should be able to export the data that already filled on the previous section to word file.
- There should be admin panel to review the data that already filled on the previous section.

## Database Structure Summary

The system uses the following database structure:

1. **Users**

   - Basic user information (id, username, password, name, email, role)
   - Roles: admin, doctor, staff
   - Timestamps and audit fields

2. **Patients**

   - Basic patient information (id, medical_record_number, name, birth_date, gender, address, phone_number, email, occupation)
   - Timestamps and audit fields

3. **Medical Records**

   - Core medical record data (id, patient_id, doctor_id, examination_date, medical_record_number)
   - Basic anamnesis data (chief_complaint, medical_history, bad_habits)
   - Status tracking (is_complete)
   - Timestamps and audit fields

4. **Extra Oral Examinations**

   - Vertical section (face_shape, vertical_face_balance, vertical_face_balance_value)
   - Transversal section (transversal_face_balance, transversal_face_balance_value, chin, upper/lower_dental_midline values)
   - Lips section (upper/lower_lip_tonus, lip_competence, eline_profile, upper/lower_lip_to_eline)
   - Timestamps and audit fields

5. **Intra Oral Examinations**

   - Multiple oral conditions (oral_hygiene, frenulum_labii_superior/inferior, tongue, palatum, adenoid)
   - Dental conditions (crowding, jaw_relation, diastema, crossbite)
   - Tooth abnormalities (tooth_shape/number_abnormality and regions)
   - Timestamps and audit fields

6. **Tooth Relation Examinations**

   - Basic measurements (overjet, overbite, curve_spee, incisor_relation)
   - Molar relations (right/left_molar_sagittal/transversal/vertical)
   - Canine relations (right/left_canine_sagittal/transversal/vertical)
   - Timestamps and audit fields

7. **Functional Examinations**

   - TMJ section (palpation, clicking_sound with locations and timing)
   - Occlusion section (interocclusal_clearance, centric_relation, vertical/horizontal_occlusal_interference)
   - Timestamps and audit fields

8. **Radiological Analysis**

   - Parent table for all radiological examinations
   - Linked to cephalometric, panoramic, and other analyses

9. **Cephalometric Analyses**

   - Image path and landmark data
   - Skeletal parameters (horizontal and vertical)
   - Dental parameters and soft tissue parameters
   - Conclusion text
   - Timestamps and audit fields

10. **Panoramic Analyses**

    - Image path
    - Various dental and bone conditions
    - Tooth eruption sequences
    - Timestamps and audit fields

11. **Other Radiographs**

    - Additional radiological images (Dental, CBCT, Carpal)
    - Timestamps and audit fields

12. **Model Analyses**

    - Arch shapes for maxillary and mandibular
    - Detailed tooth data in JSON format
    - Timestamps and audit fields

13. **Space Analyses**

    - Five analysis methods (Moyers, Kesling, Lundstrum, Ponts, Howe)
    - Space finding methods for each quadrant
    - Overall conclusion
    - Timestamps and audit fields

14. **Diagnoses**

    - Various malocclusion types and cleft conditions
    - Syndrome information
    - Timestamps and audit fields

15. **Treatment Plans**

    - Types of treatment (orthodontic, functional, surgical)
    - Appliance details (main, additional, retainer)
    - Timestamps and audit fields

16. **Appliance Images**

    - Canvas data for appliance drawings
    - Timestamps and audit fields

17. **Patient Photos**

    - Different photo types (extraoral, intraoral, model)
    - Categories (before, after)
    - Timestamps and audit fields

18. **Activity Logs**
    - System activity tracking
    - User actions with timestamps

## Code Style and Structure

- Write concise, technical PHP & HTML code with accurate examples
- Use functional and declarative programming patterns; avoid classes
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)

## Tech Stack

- PHP
- HTML
- MYSQL
- JS
- JS Datatables
- SAFEMYSQL

## Naming Conventions

## UI and Styling

- Make sure to include the sidebar for the UI component for the admin and branch panel.

## Error Handling

- Implement proper error boundaries
- Log errors appropriately for debugging
- Provide user-friendly error messages
- Handle network failures gracefully

## Security

- Implement Content Security Policy
- Sanitize user inputs
- Handle sensitive data properly
- Implement proper CORS handling

## Git Usage

Commit Message Prefixes:

- "fix:" for bug fixes
- "feat:" for new features
- "perf:" for performance improvements
- "docs:" for documentation changes
- "style:" for formatting changes
- "refactor:" for code refactoring
- "test:" for adding missing tests
- "chore:" for maintenance tasks

Rules:

- Use lowercase for commit messages
- Keep the summary line concise
- Include description for non-obvious changes
- Reference issue numbers when applicable

## Documentation

- Maintain clear README with setup instructions
- Document and data flows and the flow of the user
- Don't include comments unless it's for complex logic
- Document permission requirements
- Please document it on file README.md

## Development Workflow

- Use proper version control
- Implement proper code review process
- Test in multiple environments
- Follow semantic versioning for releases
- Maintain changelog

## Future Features Ideas

If you have any future features ideas please include it as well on upcomingfeature.md, so later you can look at it for the future features to implement.
