Skip to content

Commit

Permalink
Bones: adding axial skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Jan 22, 2025
1 parent 18c0812 commit 4966fe5
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 57 deletions.
167 changes: 115 additions & 52 deletions openatlas/models/bones.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
def create_bones(entity: Entity, category: str):
pass

structure = {

bone_inventory = {
'Skull': {
'preservation': 'percent',
'subs': {
Expand Down Expand Up @@ -114,7 +115,7 @@ def create_bones(entity: Entity, category: str):
'M1 L (26)': {'preservation': 'percent'},
'M2 L (27)': {'preservation': 'percent'},
'M3 L (28)': {'preservation': 'percent'}}}
}},
}},
'Mandible': {
'preservation': None,
'subs': {
Expand Down Expand Up @@ -163,7 +164,7 @@ def create_bones(entity: Entity, category: str):
'C L (63)': {'preservation': 'percent'},
'M1 L (64)': {'preservation': 'percent'},
'M2 L (65)': {'preservation': 'percent'}}}
}},
}},
'Mandible': {
'preservation': None,
'subs': {
Expand All @@ -183,7 +184,7 @@ def create_bones(entity: Entity, category: str):
'C R (83)': {'preservation': 'percent'},
'M1 R (84)': {'preservation': 'percent'},
'M2 R (85)': {'preservation': 'percent'}}}
}}}}}},
}}}}}},
'Shoulder girdle': {
'preservation': None,
'subs': {
Expand Down Expand Up @@ -397,60 +398,122 @@ def create_bones(entity: Entity, category: str):
'Proximal phalanges L': {'preservation': 'number'},
'Medial phalanges L': {'preservation': 'number'},
'Distal phalanges L': {'preservation': 'number'},
'Sesamoid L': {'preservation': 'number'}}}}},
'Sesamoid L': {'preservation': 'number'}}}}}}},
'Axial skeleton': {
'preservation': None,
'subs': {
'Sternum': {
'preservation': 'percent',
'subs': {
'Manubrium': {'preservation': 'percent'},
'Xiphoid process': {'preservation': 'percent'},
'Body': {'preservation': 'percent'}}},
'Ribs': {
'preservation': 'percent',
'subs': {
'Right side': {
'preservation': None,
'subs': {
'First rib R': {
'preservation': 'percent',
'subs': {
'First rib R head': {
'preservation': 'percent'},
'First rib R mid.': {
'preservation': 'percent'},
'First rib R stern.': {
'preservation': 'percent'}}},
'Second rib R': {
'preservation': 'percent',
'subs': {
'Second rib R head': {
'preservation': 'percent'},
'Second rib R mid.': {
'preservation': 'percent'},
'Second rib R stern.': {
'preservation': 'percent'}}},
'Third to tenth rib R': {
'preservation': 'percent',
'subs': {
'Third to tenth rib R head': {
'preservation': 'number'},
'Third to tenth rib R mid.': {
'preservation': 'number'},
'Third to tenth rib R stern.': {
'preservation': 'number'}}},
'Eleventh rib R': {
'preservation': 'percent',
'subs': {
'Eleventh rib R head': {
'preservation': 'percent'},
'Eleventh rib R mid.': {
'preservation': 'percent'},
'Eleventh rib R stern.': {
'preservation': 'percent'}}},
'Twelfth rib R': {
'preservation': 'percent',
'subs': {
'Twelfth rib R head': {
'preservation': 'percent'},
'Twelfth rib R mid.': {
'preservation': 'percent'},
'Twelfth rib R stern.': {
'preservation': 'percent'}}}}},
'Left side': {
'preservation': None,
'subs': {
'First rib L': {
'preservation': 'percent',
'subs': {
'First rib L head': {
'preservation': 'percent'},
'First rib L mid.': {
'preservation': 'percent'},
'First rib L stern.': {
'preservation': 'percent'}}},
'Second rib L': {
'preservation': 'percent',
'subs': {
'Second rib L head': {
'preservation': 'percent'},
'Second rib L mid.': {
'preservation': 'percent'},
'Second rib L stern.': {
'preservation': 'percent'}}},
'Third to tenth rib L': {
'preservation': 'percent',
'subs': {
'Third to tenth rib L head': {
'preservation': 'number'},
'Third to tenth rib L mid.': {
'preservation': 'number'},
'Third to tenth rib L stern.': {
'preservation': 'number'}}},
'Eleventh rib L': {
'preservation': 'percent',
'subs': {
'Eleventh rib L head': {
'preservation': 'percent'},
'Eleventh rib L mid.': {
'preservation': 'percent'},
'Eleventh rib L stern.': {
'preservation': 'percent'}}},
'Twelfth rib R': {
'preservation': 'percent',
'subs': {
'Twelfth rib L head': {
'preservation': 'percent'},
'Twelfth rib L mid.': {
'preservation': 'percent'},
'Twelfth rib L stern.': {
'preservation': 'percent'}}}}},
}}}}}

}}}
"""
Axial skeleton
Sternum
Manubrium
Body
Xiphoid process
Ribs
Right side
First rib R
First rib R head
First rib R mid.
First rib R stern.
Second rib R
Second rib R head
Second rib R Mid.
Second rib R Stern.
Third to tenth rib R
Third to tenth rib R head (no)
Third to tenth rib R mid. (no)
Third to tenth rib R stern. (no)
Eleventh rib R
Eleventh rib R head
Eleventh rib R mid.
Eleventh rib R stern.
Twelfth rib R
Twelfth rib R head
Twelfth rib R mid.
Twelfth rib R stern.
Left side
First rib L
First rib L head
First rib L mid.
First rib L stern.
Second rib L
Second rib L head
Second rib L Mid.
Second rib L Stern.
Third to tenth rib L
Third to tenth rib L head (no)
Third to tenth rib L mid. (no)
Third to tenth rib L stern. (no)
Eleventh rib L
Eleventh rib L head
Eleventh rib L mid.
Eleventh rib L stern.
Twelfth rib L
Twelfth rib L head
Twelfth rib L mid.
Twelfth rib L stern.
Vertebral column
Cervical vertebrae
C01 (Atlas)
Expand Down
9 changes: 4 additions & 5 deletions openatlas/views/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from openatlas.display.util2 import is_authorized, manual
from openatlas.forms.display import display_form
from openatlas.forms.field import SubmitField
from openatlas.models.bones import create_bones, structure
from openatlas.models.bones import create_bones, bone_inventory
from openatlas.models.entity import Entity, Link
from openatlas.models.tools import (
SexEstimation, get_carbon_link, get_sex_types, update_carbon)
Expand Down Expand Up @@ -288,7 +288,7 @@ def bones(id_: int) -> str | Response:
render_template(
'tools/bones.html',
entity=entity,
data=structure),
data=bone_inventory),
buttons=buttons)},
crumbs=tools_start_crumbs(entity) + [
[_('tools'), url_for('tools_index', id_=entity.id)],
Expand All @@ -300,7 +300,7 @@ def bones(id_: int) -> str | Response:
def bones_update(id_: int, category: str) -> str | Response:
entity = Entity.get_by_id(id_, types=True)
form = bones_form(entity, category)
current_bones = structure[category.replace('_', ' ')]
current_bones = bone_inventory[category.replace('_', ' ')]
if form.validate_on_submit():
if current_bones['preservation']:
current_bones['data'] = getattr(form, category).data
Expand Down Expand Up @@ -340,11 +340,10 @@ def bones_form(entity: Entity, category: str) -> Any:
class Form(FlaskForm):
pass

inventory = structure[category.replace('_', ' ')]
inventory = bone_inventory[category.replace('_', ' ')]
options = {
g.types[id_].name: id_ for id_
in Type.get_hierarchy('Bone preservation').subs}

choices = [
(0, _('undefined')),
(options['0%'], '0%'),
Expand Down

0 comments on commit 4966fe5

Please sign in to comment.