BASIC User Group > Code Challenges

Database Code Challenge(s)

<< < (2/15) > >>

*howls at the full AIR* :)

Okay, I'll pull together a challenge of some sort.

I knew I could count on you. Can't wait to see where you are with it.

Database Code Challenges

I have been asked to come up with a code challenge based on some software that I am writing.

General requirements:

The software is an acquisitions and accessions database for a museum-type collection - thus, there are no physical delete operations on any record - a 'deleted from collection' simply flags the record as hidden. All of the artefact records are, in fact, separate disc directories containing a single text file and any number of media files.

The primary requirement is that the textual data must be kept entirely in human-readable digital format (i.e. text files), thus, software-proofing the data. That includes indices and data (images and other media excepted). The artefact record is, in fact, a single document. Even EXIF-type metadata on media files is maintained in separate text documents alongside the media files.

Software installation is not required - just copy the directory, edit the config.ini file to suit, and run.

It is important that the data files may be printed out as-are, and will look like properly formatted text reports.

Directory structure:

--- Code: ---DBRoot
 |__ Artefact Record
 |       |
 |       |__ Images
 |       |       |___ *.jpg etc.
 |       |
 |       |__ Documents
 |       |       |___ *.doc, .xls etc.
 |       |
 |       |___artefact.record (text file)
 |___ DBPrimaryIndex.index (text file)
 |___ DBPrimaryIndex.schema (text file)
 |___ DB secondary indices & schemas

--- End code ---

For the sake of the code challenges, each program may reside in the same directory as the data file(s).

I will put up a new challenge chunk as each back-end section of the software is completed (I hope).

I should point out that I am using VB6 for developing this software (which means that it'll run under WINE, too).

Challenge 1: Data Records

Next: Challenge 2: Primary Index

Challenge 1 - Data Records:

The data records are, apart from the unique 'card number', unspecified in format (schemaless) - the data is entered in such a way that each field is named in the text, and may contain multi-line values, arrays and simple values. Some system data is tucked away at the end of the record document. This is not JSON or XML (which are not pretty enough to just print out as-is)

You need to be able to read the document into the software and to then (after any alterations) to write it back to the file in the same format as if was read.

I have already done this in VB6, and the program tidies up the tabulation of the document at the same time (neat-freak ;))

A typical record looks like this:

--- Code: ---RecordTitle is              Mineral Specimen Details

Entry No:

  Minerals =                Zeunerite
    .var                     Blister Copper
    .var                     Agate
    .colour                  White
    .var                     Common Opal
    .colour                  Transparent
  Matrix =                  Quartz

                            South Terras Mine
                            St Stephen in Brannel
                            St Austell
                            Cornwall, UK
  Grid Reference =          SW 935 524
  GPS Coordinates =         50.33444,-4.90194

Collection Data:
  collected by =            Self collected
  Collection Date =         1979

Acquisition Data:
  Acquired Date =           14 Jul 1998
  From =                    Self collected
  Field Ref No =            F20180623-STUM-001
  Temp Ref No =             TMP 0 0099

Analytical Data:
  Commentary =              4 species
  Zeunerite =             { Colour and crystal form are typical for this location.
    .date                    14 Aug 2018
    .Report                  AN-201808-14-01
    .Ref_Number              ZZ8088
  Zippeite =              { Colour is diagnostic for this location
    .date                    14 Aug 2018
    .Report                  AN-201808-14-02
    .Ref_Number              ZZ9099
  Chalcopyrite =          { Well characterised at this location.
                            Deep indigo tarnish on old surfaces.
  Rutherfordine =         { Tentative ID.
    .Reasons                 Visual ID only

Accession Data:
  Accession No =            ZZ9099
  Accession Date =          21 Sept 2000
  Sub-collection =          Main

Image Data:
      Mugshot =             img0001.jpg
      Images =              img0001.jpg
      .Title                Whole Specimen
      .TakenDate            11 Nov 2018
      .Width                11.5mm
      .camera               Fuji FinePix L55
      .Title                Zeunerite & Chalcopyrite
      .TakenDate            11 Nov 2018
      .FOV                  1.1mm
      .Camera               CL 1600 USB MicroCam

===== DB System Info ===========================================================
 RecordType is               1
 LastSavedTime is           13/11/2018 13:18:37
(Previous Version was       13/11/2018 12:12:47 )

--- End code ---
The format is:
Field:               Indicates a group of related data
Sub-Field Name =     Indicates a named sub-field (or sub-field array)
.Property            Indicates a named property of the sub-field
Name =  {            Indicates the start of a multiline data block
        }            End of multiline data.

Still working on the functionality at the back end - nothing that actually *looks* like a database yet - just BASIC modules.

The idea of free-form records came from the first version of my minerals database - using IdeaList.

There is little complex searching and nothing as horrendous as deletions or non-sequential records.

Oh yes, and nothing as suspect as compiled stuff yet - just proof of concept examples. One day, I may even do some documentation (laughs up sleeve and tries to hide the growing nose).


[0] Message Index

[#] Next page

[*] Previous page

Go to full version