Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Adel M. Abdallah committed Dec 11, 2018
2 parents 70ee599 + 36539c8 commit 66fff9d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 272 deletions.
11 changes: 7 additions & 4 deletions Earlier_ER_diagrams/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Check out the history of the [different ER diagrams][1] using Microsoft Visio for earlier versions and and DbWrench for later ones. The five key ER diagrams are below

## Key feedback from collaborators and colleagues on WaMDaM designs, presentations, and earlier draft writings

[Key feedback][2]
We solicited feedback from the following [conference and professional presentations][2]
Check out this response to earlier feedback on [peer-review conference iemss paper][4]

## 5. Final Schema Nov 2018

Expand All @@ -19,7 +19,7 @@ Check out the history of the [different ER diagrams][1] using Microsoft Visio fo
![](/Earlier_ER_diagrams/2.png)


## 2. Schema April 2014 (iEMS, San Diego, CA)
## 2. Schema April 2014 [(iEMS, San Diego, CA)][3]
![](/Earlier_ER_diagrams/3.jpg)


Expand All @@ -28,4 +28,7 @@ Check out the history of the [different ER diagrams][1] using Microsoft Visio fo


[1]:/Earlier_ER_diagrams/WaMDaM_Schema_version_history
[2]:/Earlier_ER_diagrams/Key_feedback.md
[2]:https://github.com/WamdamProject/WaMDaM-software-ecosystem/blob/master/mkdocs/Edit_MD_Files/Publications.md
[3]:https://github.com/WamdamProject/WaMDaM-software-ecosystem/blob/master/mkdocs/Edit_MD_Files/Publications.md#peer-reviewed-conference-articles
[4]:https://github.com/WamdamProject/WaMDaM_Publications/blob/master/Files/Feedback/Compiled_Peer_reviews_iemss.pdf

10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ The documentations of the model and its design are found at [docs.wamdam.org](ht
* Check out the interactive [WaMDaM schema or entity relationship diagram][1].
The HTML site files are generated by DbWrench and hosted in the [docs][21] folder
* Here is the [XML DbWrench schema file][2]
* For fun, check out the [older WaMDaM ER diagrams since inception][20]

## 3. Key earlier drafts of WaMDaM designs and feedback on a peer-review conference paper
* Check out the [Key earlier WaMDaM ER diagrams versions since inception][20]

[1]:http://schema.wamdam.org/diagrams/01_WaMDaM.html
[2]:/XML_schema
[2]:/ER_XML_schema_file
[20]:/Earlier_ER_diagrams
[21]:/docs

## 3. Script to create blank WaMDaM databases OR copies of db to restore
## 4. Implementations of WaMDaM in four RDBS to create blank databases
* [Microsoft SQL Server](database_schemas/MS_SQL_Server)
* [MySQL](database_schemas/MySQL)
* [PostgreSQL](/database_schemas/PostgreSQL)
* [SQLite](/database_schemas/SQLite)


## 4. Use the DDL Utility here to create DDL for SQLite, MySQL, PostgreSQL, and Microsoft SQL Server from one XML file.
## 5. Use the DDL Utility here to create DDL for SQLite, MySQL, PostgreSQL, and Microsoft SQL Server from one XML file.
[DDL Generator Utility][10]

[10]:https://github.com/WamdamProject/WaMDaM_DDL_generator
Expand Down
269 changes: 5 additions & 264 deletions database_schemas/ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,268 +1,9 @@
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
# Script to create blank WaMDaM databases OR copies of db to restore

from django.db import models
* [Microsoft SQL Server](https://github.com/WamdamProject/WaMDaM_Information_Model/tree/master/database_schemas/MS_SQL_Server)

* [MySQL](https://github.com/WamdamProject/WaMDaM_Information_Model/tree/master/database_schemas/MySQL)

class ControlledVocabulary(models.Model):
CURRENT = 'Current'
ARCHIVED = 'Archived'
* [PostgreSQL](https://github.com/WamdamProject/WaMDaM_Information_Model/tree/master/database_schemas/PostgreSQL)

STATUS_CHOICES = (
(CURRENT, 'Current'),
(ARCHIVED, 'Archived')
)

vocabulary_id = models.AutoField(primary_key=True)
term = models.CharField(max_length=255)
name = models.CharField(max_length=255)
definition = models.TextField()
category = models.CharField(max_length=255, blank=True)
provenance = models.TextField(blank=True)
provenance_uri = models.URLField(db_column='provenanceUri', blank=True)
note = models.TextField(blank=True, null=True)
vocabulary_status = models.CharField(max_length=255, db_column='status', choices=STATUS_CHOICES, default=STATUS_CHOICES[0][0])
previous_version = models.OneToOneField('self', null=True, related_name='revised_version')

def has_revision(self):
revision = None
try:
revision = self.revised_version
except ObjectDoesNotExist:
pass
return revision is not None

def get_latest_version(self):
term = self
while term.has_revision():
term = term.revised_version
return term

class Meta:
db_table = 'controlledvocabularies'
ordering = ["-name"]


class ControlledVocabularyRequest(models.Model):
PENDING = 'Pending'
REJECTED = 'Rejected'
ACCEPTED = 'Accepted'
ARCHIVED = 'Archived'

STATUS_CHOICES = (
(PENDING, 'Pending'),
(REJECTED, 'Rejected'),
(ACCEPTED, 'Accepted'),
(ARCHIVED, 'Archived'),
)

request_id = models.AutoField(max_length=255, db_column='requestId', primary_key=True)

term = models.CharField(max_length=255, help_text="Please enter a URI-friendly version of your term with no spaces, special characters, etc.")
name = models.CharField(max_length=255, help_text="Please enter the term as you would expect it to appear in a sentence.")
definition = models.TextField(help_text="Please enter a detailed definition of the term.", blank=True)
provenance = models.TextField(blank=True, help_text="Enter a note about where the term came from. If you retrieved the definition of the term from a website or other source, note that here.")
provenance_uri = models.URLField(db_column='provenanceUri', blank=True, max_length=1024, help_text="If you retrieved the term from another formal vocabulary system, enter the URI of the term from the other system here.")
note = models.TextField(blank=True, null=True, help_text="Please enter any additional notes you may have about the term.")
category = models.CharField(max_length=255, blank=True, help_text="You may suggest a category for the term. Refer to the vocabulary to see which categories have been used. You may also suggest a new category.")

status = models.CharField(max_length=255, db_column='status', choices=STATUS_CHOICES, default=STATUS_CHOICES[0][0])
date_submitted = models.DateField(db_column='dateSubmitted', default=timezone.now)
date_status_changed = models.DateField(db_column='dateStatusChanged', default=timezone.now)
request_notes = models.TextField(db_column='requestNotes', blank=True)
submitter_name = models.CharField(max_length=255, db_column='submitterName', help_text="Enter your name.")
submitter_email = models.CharField(max_length=255, db_column='submitterEmail', help_text="Enter your email address.")
request_reason = models.TextField(db_column='requestReason', help_text="Please enter a brief description of the reason for your submission (e.g., Term does not exist yet, Term is needed for my data use case, etc.)")

request_for = models.ForeignKey('ControlledVocabulary', db_column='requestFor', blank=True, null=True)
original_request = models.ForeignKey('self', db_column='originalRequestId', null=True)

class Meta:
db_table = 'requests'
ordering = ["date_submitted", "-request_id"]


class MethodType(ControlledVocabulary):
class Meta:
db_table = 'methodtypecv'
verbose_name = 'Method Type'
ordering = ["name"]


class MethodTypeRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'methodtypecvrequests'
verbose_name = 'Method Type Request'


class AggregationStatistic(ControlledVocabulary):
class Meta:
db_table = 'aggregationstatisticcv'
verbose_name = 'Aggregation Statistic'


class AggregationStatisticRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'aggregationstatisticcvrequests'
verbose_name = 'Aggregation Statistic Request'


class ElevationDatum(ControlledVocabulary):
class Meta:
db_table = 'elevationdatumcv'
verbose_name = 'Elevation Datum'


class ElevationDatumRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'elevationdatumcvrequests'
verbose_name = 'Elevation Datum Request'


class SeasonName(ControlledVocabulary):
class Meta:
db_table = 'seasonnamecv'
verbose_name = 'Season Name'


class SeasonNameRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'seasonnamecvrequests'
verbose_name = 'Season Name Request'


class Units(ControlledVocabulary):
abbreviation = models.CharField(max_length=255, blank=True, null=False, db_column='UnitsAbbreviation',
help_text='Please enter the Abbreviation of the unit (e.g., "m" for meter)')
unit_system = models.CharField(max_length=255, blank=True, db_column='UnitsSystem',
help_text='English or International System of Units')
# conversion_factor = models.FloatField(null=True, blank=True,
# db_column='ConversionFactor', default=0)
Linear_factor = models.FloatField (null=True,
db_column='LinearFactor')
Constant_Factor = models.FloatField(null=True,
db_column='ConstantFactor')

class Meta:
db_table = 'unitscv'
verbose_name = 'Units'
ordering = ["name"]


class UnitsRequest(ControlledVocabularyRequest):
abbreviation = models.CharField(max_length=255, blank=True, null=False, db_column='UnitsAbbreviation',
help_text='Please enter the Abbreviation of the unit (e.g., "m" for meter)')
unit_system = models.CharField(max_length=255, blank=True, db_column='UnitsSystem',
help_text='English or International System of Units')
conversion_factor = models.CharField(max_length=255, blank=True, null=False,
db_column='ConversionFactor')
conversion_relation = models.CharField(max_length=255, blank=True, null=False,
db_column='ConversionRelation')
class Meta:
db_table = 'unitscvrequests'
verbose_name = 'Units Request'


class ObjectTypology(ControlledVocabulary):
class Meta:
db_table = 'objecttypologycv'
verbose_name = 'Object Typology'


class ObjectTypologyRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'objecttypologycvrequests'
verbose_name = 'Object Typology Request'


class AttributeName(ControlledVocabulary):
class Meta:
db_table = 'attributenamecv'
verbose_name = 'Attribute Name'


class AttributeNameRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'attributenamecvrequests'
verbose_name = 'Attribute Name Request'


class AttributeDataType(ControlledVocabulary):
class Meta:
db_table = 'attributedatatypecv'
verbose_name = 'Attribute Data Type'


class AttributeDataTypeRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'attributedatatypecvrequests'
verbose_name = 'Attribute Data Type Request'


class ElectronicFileFormat(ControlledVocabulary):
class Meta:
db_table = 'electronicfileformatcv'
verbose_name = 'Electronic File Format'


class ElectronicFileFormatRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'electronicfileformatcvrequests'
verbose_name = 'Electronic File Format Request'


class SpatialReference(ControlledVocabulary):
class Meta:
db_table = 'spatialreferencecv'
verbose_name = 'Spatial Reference'


class SpatialReferenceRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'spatialreferencecvrequests'
verbose_name = 'Spatial Reference Request'


class InstanceName(ControlledVocabulary):
class Meta:
db_table = 'instancenamecv'
verbose_name = 'Instance Name'


class InstanceNameRequest(ControlledVocabularyRequest):
class Meta:
db_table = 'instancenamecvrequests'
verbose_name = 'Instance Name Request'


class ObjectType(ControlledVocabulary):
object_typology = models.CharField(max_length=255, null=False, blank=True)
class Meta:
db_table = 'objecttypecv'
verbose_name = 'Object Type'


class ObjectTypeRequest(ControlledVocabularyRequest):
object_typology = models.CharField(max_length=255, null=False, blank=True)
class Meta:
db_table = 'objecttypecvrequests'
verbose_name = 'Object Type Request'


class Categorical(ControlledVocabulary):
attribute_name = models.CharField(max_length=255, null=False, blank=True,
help_text="Please select a controlled Attribute Name that this value belongs to. " \
"If the Attribute Name does not exist, please add it in the Attribute Name table")
class Meta:
db_table = 'categoricalcv'
verbose_name = 'Categorical'


class CategoricalRequest(ControlledVocabularyRequest):
attribute_name = models.CharField(max_length=255, null=False, blank=True,
help_text="Please select a controlled Attribute Name that this value belongs to. " \
"If the Attribute Name does not exist, please add it in the Attribute Name table")
class Meta:
db_table = 'categoricalcvrequests'
verbose_name = 'Categorical Request'
* [SQLite](https://github.com/WamdamProject/WaMDaM_Information_Model/tree/master/database_schemas/SQLite)

0 comments on commit 66fff9d

Please sign in to comment.