mirror of
https://github.com/leaders-of-digital-9-task/backend.git
synced 2024-11-22 01:16:33 +03:00
added pathology_type
This commit is contained in:
parent
4ec02a8729
commit
e3aa26a7df
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,6 +3,7 @@
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
.idea
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|
8
.idea/.gitignore
vendored
8
.idea/.gitignore
vendored
|
@ -1,8 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
|
@ -1,43 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="FacetManager">
|
|
||||||
<facet type="django" name="Django">
|
|
||||||
<configuration>
|
|
||||||
<option name="rootFolder" value="$MODULE_DIR$" />
|
|
||||||
<option name="settingsModule" value="config/settings/local.py" />
|
|
||||||
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
|
|
||||||
<option name="environment" value="<map/>" />
|
|
||||||
<option name="doNotUseTestRunner" value="false" />
|
|
||||||
<option name="trackFilePattern" value="migrations" />
|
|
||||||
</configuration>
|
|
||||||
</facet>
|
|
||||||
</component>
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
<component name="PackageRequirementsSettings">
|
|
||||||
<option name="requirementsPath" value="$MODULE_DIR$/requirements/local.txt" />
|
|
||||||
</component>
|
|
||||||
<component name="PyDocumentationSettings">
|
|
||||||
<option name="renderExternalDocumentation" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="ReSTService">
|
|
||||||
<option name="workdir" value="$MODULE_DIR$/docs" />
|
|
||||||
<option name="DOC_DIR" value="$MODULE_DIR$/docs" />
|
|
||||||
</component>
|
|
||||||
<component name="TemplatesService">
|
|
||||||
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
|
||||||
<option name="TEMPLATE_FOLDERS">
|
|
||||||
<list>
|
|
||||||
<option value="$MODULE_DIR$/image_markuper/templates" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="TestRunnerService">
|
|
||||||
<option name="projectConfiguration" value="pytest" />
|
|
||||||
<option name="PROJECT_TEST_RUNNER" value="pytest" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="JavaScriptSettings">
|
|
||||||
<option name="languageLevel" value="ES6" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (lct_backend)" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/image_markuper.iml" filepath="$PROJECT_DIR$/.idea/image_markuper.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,18 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration name="docker-compose up django" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
|
|
||||||
<deployment type="docker-compose.yml">
|
|
||||||
<settings>
|
|
||||||
<option name="envFilePath" value=""/>
|
|
||||||
<option name="services">
|
|
||||||
<list>
|
|
||||||
<option value="django"/>
|
|
||||||
<option value="celeryworker"/>
|
|
||||||
<option value="celerybeat"/>
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
<option name="sourceFilePath" value="local.yml"/>
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<method v="2"/>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration name="docker-compose up docs" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
|
|
||||||
<deployment type="docker-compose.yml">
|
|
||||||
<settings>
|
|
||||||
<option name="envFilePath" value=""/>
|
|
||||||
<option name="services">
|
|
||||||
<list>
|
|
||||||
<option value="docs"/>
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
<option name="sourceFilePath" value="local.yml"/>
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<method v="2"/>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,21 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="merge_production_dotenvs_in_dotenv" type="PythonConfigurationType" factoryName="Python" singleton="true">
|
|
||||||
<module name="image_markuper" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<envs>
|
|
||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
|
||||||
</envs>
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
|
|
||||||
<option name="SCRIPT_NAME" value="merge_production_dotenvs_in_dotenv.py" />
|
|
||||||
<option name="PARAMETERS" value="" />
|
|
||||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
||||||
<option name="EMULATE_TERMINAL" value="false" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,32 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="migrate" type="Python.DjangoServer" factoryName="Django server" singleton="true">
|
|
||||||
<module name="image_markuper" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<envs>
|
|
||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
|
||||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
|
||||||
</envs>
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<PathMappingSettings>
|
|
||||||
<option name="pathMappings">
|
|
||||||
<list>
|
|
||||||
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</PathMappingSettings>
|
|
||||||
<option name="launchJavascriptDebuger" value="false" />
|
|
||||||
<option name="host" value="" />
|
|
||||||
<option name="additionalOptions" value="" />
|
|
||||||
<option name="browserUrl" value="" />
|
|
||||||
<option name="runTestServer" value="false" />
|
|
||||||
<option name="runNoReload" value="false" />
|
|
||||||
<option name="useCustomRunCommand" value="true" />
|
|
||||||
<option name="customRunCommand" value="migrate" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="pytest: ." type="tests" factoryName="py.test" singleton="true">
|
|
||||||
<module name="image_markuper" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
|
||||||
<PathMappingSettings>
|
|
||||||
<option name="pathMappings">
|
|
||||||
<list>
|
|
||||||
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</PathMappingSettings>
|
|
||||||
<option name="_new_keywords" value="""" />
|
|
||||||
<option name="_new_additionalArguments" value="""" />
|
|
||||||
<option name="_new_target" value=""."" />
|
|
||||||
<option name="_new_targetType" value=""PATH"" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="pytest: users" type="tests" factoryName="py.test" singleton="true">
|
|
||||||
<module name="image_markuper" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
|
||||||
<PathMappingSettings>
|
|
||||||
<option name="pathMappings">
|
|
||||||
<list>
|
|
||||||
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</PathMappingSettings>
|
|
||||||
<option name="_new_keywords" value="""" />
|
|
||||||
<option name="_new_additionalArguments" value="""" />
|
|
||||||
<option name="_new_target" value=""./image_markuper/users/"" />
|
|
||||||
<option name="_new_targetType" value=""PATH"" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,33 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="runserver" type="Python.DjangoServer" factoryName="Django server" singleton="true">
|
|
||||||
<module name="image_markuper" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<envs>
|
|
||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
|
||||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
|
||||||
</envs>
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<PathMappingSettings>
|
|
||||||
<option name="pathMappings">
|
|
||||||
<list>
|
|
||||||
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</PathMappingSettings>
|
|
||||||
<option name="launchJavascriptDebuger" value="false" />
|
|
||||||
<option name="port" value="8000" />
|
|
||||||
<option name="host" value="0.0.0.0" />
|
|
||||||
<option name="additionalOptions" value="" />
|
|
||||||
<option name="browserUrl" value="" />
|
|
||||||
<option name="runTestServer" value="false" />
|
|
||||||
<option name="runNoReload" value="false" />
|
|
||||||
<option name="useCustomRunCommand" value="false" />
|
|
||||||
<option name="customRunCommand" value="" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,33 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="runserver_plus" type="Python.DjangoServer" factoryName="Django server" singleton="true">
|
|
||||||
<module name="image_markuper" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<envs>
|
|
||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
|
||||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
|
||||||
</envs>
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<PathMappingSettings>
|
|
||||||
<option name="pathMappings">
|
|
||||||
<list>
|
|
||||||
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</PathMappingSettings>
|
|
||||||
<option name="launchJavascriptDebuger" value="false" />
|
|
||||||
<option name="port" value="8000" />
|
|
||||||
<option name="host" value="0.0.0.0" />
|
|
||||||
<option name="additionalOptions" value="" />
|
|
||||||
<option name="browserUrl" value="" />
|
|
||||||
<option name="runTestServer" value="false" />
|
|
||||||
<option name="runNoReload" value="false" />
|
|
||||||
<option name="useCustomRunCommand" value="true" />
|
|
||||||
<option name="customRunCommand" value="runserver_plus" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="WebResourcesPaths">
|
|
||||||
<contentEntries>
|
|
||||||
<entry url="file://$PROJECT_DIR$">
|
|
||||||
<entryData>
|
|
||||||
<resourceRoots>
|
|
||||||
<path value="file://$PROJECT_DIR$/image_markuper/static" />
|
|
||||||
</resourceRoots>
|
|
||||||
</entryData>
|
|
||||||
</entry>
|
|
||||||
</contentEntries>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
from dicom.models import Circle, Dicom, Polygon
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
admin.site.register(Dicom)
|
||||||
|
admin.site.register(Circle)
|
||||||
|
admin.site.register(Polygon)
|
|
@ -27,7 +27,7 @@ class ListDicomSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Dicom
|
model = Dicom
|
||||||
fields = ["file", "uploaded", "url"]
|
fields = ["file", "uploaded", "pathology_type", "url"]
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
return Dicom.objects.create(**validated_data, user=self.context["request"].user)
|
return Dicom.objects.create(**validated_data, user=self.context["request"].user)
|
||||||
|
@ -49,7 +49,7 @@ class DicomSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Dicom
|
model = Dicom
|
||||||
fields = ["file", "uploaded", "shapes"]
|
fields = ["file", "uploaded", "pathology_type", "shapes"]
|
||||||
|
|
||||||
|
|
||||||
class PolygonSerializer(serializers.ModelSerializer):
|
class PolygonSerializer(serializers.ModelSerializer):
|
||||||
|
|
|
@ -1,16 +1,26 @@
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.urls import reverse
|
||||||
from utils.files import media_upload_path
|
from utils.files import media_upload_path
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class Dicom(models.Model):
|
class Dicom(models.Model):
|
||||||
|
class PathologyType(models.IntegerChoices):
|
||||||
|
no_pathology = 0, "Без патологий"
|
||||||
|
covid_pathology = 1, "Covid"
|
||||||
|
|
||||||
user = models.ForeignKey(User, related_name="files", on_delete=models.CASCADE)
|
user = models.ForeignKey(User, related_name="files", on_delete=models.CASCADE)
|
||||||
slug = models.SlugField()
|
slug = models.SlugField()
|
||||||
|
|
||||||
file = models.FileField(upload_to=media_upload_path)
|
file = models.FileField(upload_to=media_upload_path)
|
||||||
uploaded = models.DateTimeField(auto_now_add=True)
|
uploaded = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
pathology_type = models.IntegerField(choices=PathologyType.choices)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.file.name
|
return self.file.name
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return reverse("get_update_delete_dicom", kwargs={"slug": self.slug})
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv
|
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv
|
||||||
|
per-file-ignores = __init__.py:F401
|
||||||
|
|
||||||
[pycodestyle]
|
[pycodestyle]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
|
|
Loading…
Reference in New Issue
Block a user