From 4a8ca4b38493a68b0899a1f0ded250c7bc501edf Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 5 Apr 2021 01:29:27 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Create=20first=20models?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sophon/core/models.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/sophon/core/models.py b/sophon/core/models.py index 71a8362..cc02cd5 100644 --- a/sophon/core/models.py +++ b/sophon/core/models.py @@ -1,3 +1,32 @@ from django.db import models -# Create your models here. + +class DataSource(models.Model): + """ + A :class:`.DataSource` is a web service which provides access to statistical information sourced by multiple data + providers. + + PandaSDMX supports natively multiple data sources, listed + `here `_ . + + They are duplicated in the database to allow for custom sources to be added through the :meth:`pandasdmx.add_source` + method. + """ + + pandasdmx_id = models.CharField("Internal pandasdmx source id", max_length=16, primary_key=True) + builtin = models.BooleanField("If the source is builtin in pandasdmx") + + name = models.CharField("Full name of the data source", max_length=512) + documentation_url = models.URLField("Documentation URL provided by the data source") + api_url = models.URLField("API URL where the statistical data can be requested") + + +class Project(models.Model): + """ + A research :class:`.Project` is a work which may use zero or more :class:`.DataSource`\\ s to prove or disprove an + hypothesis. + """ + name = models.CharField("Project name", max_length=512) + description = models.CharField("Project description", max_length=8192) + + sources = models.ManyToManyField(DataSource, related_name="used_in")