Skip to content

onconova.oncology.controllers.tumor_marker

TumorMarkerController

Bases: ControllerBase

create_tumor_marker(payload)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.post(
    path="",
    response={201: ModifiedResourceSchema, **COMMON_HTTP_ERRORS},
    permissions=[perms.CanManageCases],
    operation_id="createTumorMarker",
)
def create_tumor_marker(self, payload: scm.TumorMarkerCreate):  # type: ignore
    return 201, payload.model_dump_django()

delete_tumor_marker(tumorMarkerId)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.delete(
    path="/{tumorMarkerId}",
    response={204: None, 404: None, **COMMON_HTTP_ERRORS},
    permissions=[perms.CanManageCases],
    operation_id="deleteTumorMarkerById",
)
def delete_tumor_marker(self, tumorMarkerId: str):
    get_object_or_404(orm.TumorMarker, id=tumorMarkerId).delete()
    return 204, None

get_all_tumor_marker_history_events(tumorMarkerId)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.get(
    path="/{tumorMarkerId}/history/events",
    response={
        200: Paginated[HistoryEvent.bind_schema(scm.TumorMarkerCreate)],
        404: None,
        **COMMON_HTTP_ERRORS,
    },
    permissions=[perms.CanViewCases],
    operation_id="getAllTumorMarkerHistoryEvents",
)
@paginate()
@ordering()
def get_all_tumor_marker_history_events(self, tumorMarkerId: str):
    instance = get_object_or_404(orm.TumorMarker, id=tumorMarkerId)
    return pghistory.models.Events.objects.tracks(instance).all()  # type: ignore

get_all_tumor_markers_matching_the_query(query)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.get(
    path="",
    response={
        200: Paginated[scm.TumorMarker],
        **COMMON_HTTP_ERRORS,
    },
    permissions=[perms.CanViewCases],
    operation_id="getTumorMarkers",
)
@paginate()
@ordering()
@anonymize()
def get_all_tumor_markers_matching_the_query(self, query: Query[scm.TumorMarkerFilters]):  # type: ignore
    queryset = orm.TumorMarker.objects.all().order_by("-date")
    return query.filter(queryset)

get_tumor_marker_analyte_details_by_code(analyteCode)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.get(
    path="analytes/{analyteCode}/details",
    response={200: orm.tumor_marker.AnalyteDetails, 404: None, **COMMON_HTTP_ERRORS},
    permissions=[perms.CanViewCases],
    operation_id="getTumorMarkerAnalyteDetailsByCode",
)
def get_tumor_marker_analyte_details_by_code(self, analyteCode: str):
    instance = orm.tumor_marker.ANALYTES_DATA.get(analyteCode)
    if instance is None:
        return 404, None
    return 200, instance

get_tumor_marker_by_id(tumorMarkerId)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.get(
    path="/{tumorMarkerId}",
    response={200: scm.TumorMarker, 404: None, **COMMON_HTTP_ERRORS},
    permissions=[perms.CanViewCases],
    operation_id="getTumorMarkerById",
)
@anonymize()
def get_tumor_marker_by_id(self, tumorMarkerId: str):
    return get_object_or_404(orm.TumorMarker, id=tumorMarkerId)

get_tumor_marker_history_event_by_id(tumorMarkerId, eventId)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.get(
    path="/{tumorMarkerId}/history/events/{eventId}",
    response={
        200: HistoryEvent.bind_schema(scm.TumorMarkerCreate),
        404: None,
        **COMMON_HTTP_ERRORS,
    },
    permissions=[perms.CanViewCases],
    operation_id="getTumorMarkerHistoryEventById",
)
def get_tumor_marker_history_event_by_id(self, tumorMarkerId: str, eventId: str):
    instance = get_object_or_404(orm.TumorMarker, id=tumorMarkerId)
    return get_object_or_404(
        pghistory.models.Events.objects.tracks(instance), pgh_id=eventId  # type: ignore
    )

revert_tumor_marker_to_history_event(tumorMarkerId, eventId)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.put(
    path="/{tumorMarkerId}/history/events/{eventId}/reversion",
    response={201: ModifiedResourceSchema, 404: None, **COMMON_HTTP_ERRORS},
    permissions=[perms.CanManageCases],
    operation_id="revertTumorMarkerToHistoryEvent",
)
def revert_tumor_marker_to_history_event(self, tumorMarkerId: str, eventId: str):
    instance = get_object_or_404(orm.TumorMarker, id=tumorMarkerId)
    return 201, get_object_or_404(instance.events, pgh_id=eventId).revert()

update_neoplastic_entity(tumorMarkerId, payload)

Source code in onconova/oncology/controllers/tumor_marker.py
@route.put(
    path="/{tumorMarkerId}",
    response={200: ModifiedResourceSchema, 404: None, **COMMON_HTTP_ERRORS},
    permissions=[perms.CanManageCases],
    operation_id="updateTumorMarkerById",
)
def update_neoplastic_entity(self, tumorMarkerId: str, payload: scm.TumorMarkerCreate):  
    instance = get_object_or_404(orm.TumorMarker, id=tumorMarkerId)
    return payload.model_dump_django(instance=instance)
runner