get_filename_convention

namefiles.get_filename_convention(convention_name: None = None) dict

Gets the currently defined file naming convention.

Parameters

convention_name – The targeted file naming convention’s name. Returns the standard file naming convention by default, if no name is defined.

Returns

dict

Examples

>>> from namefiles import get_filename_convention
>>> import json
>>> standard_convention = get_filename_convention()
>>> standard_representation = json.dumps(standard_convention, indent="  ")
>>> print(standard_representation)
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Naming Convention for Specimen Files",
  "description": "JSON Schema for filenames related to specimen.",
  "name": "Standard March 2021",
  "type": "object",
  "template": "{identifier}{sub_id}{source_id}{vargroup}{context}{extension}",
  "properties": {
    "identifier": {
      "description": "The specimen's identifier by its projects name or its UUID4",
      "type": "string",
      "minLength": 1,
      "maxLength": 36,
      "pattern": "^[0-9a-zA-Z-_]+$",
      "search_pattern": "^(?P<name_part>[0-9a-zA-Z-_]+)"
    },
    "extension": {
      "type": "string",
      "search_pattern": "(?P<name_part>\\.[0-9a-zA-Z]+$)"
    },
    "source_id": {
      "type": "string",
      "minLength": 5,
      "maxLength": 12,
      "pattern": "^[0-9a-zA-Z-]+$",
      "search_pattern": "#(?P<name_part>[0-9a-zA-Z-]{5,12})",
      "prefix": "#"
    },
    "sub_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4,
      "pattern": "^[0-9A-Z]+$",
      "search_pattern": "#(?P<name_part>[0-9A-Z]{1,4})",
      "prefix": "#"
    },
    "context": {
      "type": "string",
      "minLength": 3,
      "maxLength": 16,
      "pattern": "^[a-zA-Z]+[0-9a-zA-Z-]+$",
      "search_pattern": "\\.(?P<name_part>[a-zA-Z]{1}[0-9a-zA-Z-]{2,15})",
      "prefix": "."
    },
    "vargroup": {
      "type": "array",
      "pattern": "^#(_[a-zA-Z0-9+-,. ]+)+$",
      "search_pattern": "#_(?P<name_part>[0-9a-zA-Z+-,. ]+(_[0-9a-zA-Z+-,. ]+)+)",
      "delimiter": "_",
      "prefix": "#_"
    }
  },
  "required": [
    "identifier"
  ],
  "dependencies": {
    "context": [
      "extension"
    ]
  }
}