PyMarc Record object structure

44 views
Skip to first unread message

Mykle Law

unread,
Dec 30, 2024, 3:22:10 PM12/30/24
to pymarc Discussion
I'm a visual person-- I thought I might recommend that you use a depiction of your PyMarc Record object structure somewhere on the documentation page.

It could look a bit like this-- feel free to use this example.


Record
├── leader: '01234nam  2200361 a 4500'
├── fields:
│   ├── Field
│   │   ├── tag: '001'
│   │   ├── data: '000000001'
│   ├── Field
│   │   ├── tag: '245'
│   │   ├── indicators: ['1', '0']
│   │   ├── subfields: ['$a', 'Title', '$b', 'Subtitle']
│   ├── Field
│   │   ├── tag: '100'
│   │   ├── indicators: ['1', ' ']
│   │   ├── subfields: ['$a', 'Author']

B W

unread,
Dec 31, 2024, 10:56:29 AM12/31/24
to pym...@googlegroups.com
Interesting idea, Mykle. Do note that the most current version of PyMarc uses a list of "Subfield" objects to denote specific subfields contained in a Field object, so your representation might change a little bit:

Record
├── leader: '01234nam  2200361 a 4500'
├── fields:
│   ├── Field
│   │   ├── tag: '001'
│   │   ├── data: '000000001'
│   ├── Field
│   │   ├── tag: '245'
│   │   ├── indicators: ['1', '0']
│   │   ├── subfields:
|     |    |    |---Subfield:
|     |    |    |    |---Code: 'a'
|     |    |    |    |---Value: "Title text"
|     |    |    |---Subfield:
|     |    |    |    |---Code: 'b'
|     |    |    |    |---Value: "More title text"

│   ├── Field
│   │   ├── tag: '100'
│   │   ├── indicators: ['1', ' ']
...

--
You received this message because you are subscribed to the Google Groups "pymarc Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymarc+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pymarc/5afb3557-0386-4a76-904f-30f3de602c41n%40googlegroups.com.

Mykle Law

unread,
Dec 31, 2024, 1:10:13 PM12/31/24
to pymarc Discussion
Good thought! I haven't finished studying the object structure-- this was a quick draft up. Maybe someone here more familiar with PyMaRC could develop a model? I'm now wondering if there's a way to programmatically generate the structure of the object based on the PyMaRC code itself.

Andrew Hankinson

unread,
Dec 31, 2024, 3:07:39 PM12/31/24
to pym...@googlegroups.com, pymarc Discussion
Both the subfields and indicators are now Named Tuples to provide better typing for the data in a field. So it would be something like “Imdicators: first: #, second: #. 

Given that there is nothing nested in a MARC record, generating this visual representation should be fairly trivial.

On 31 Dec 2024, at 19:10, Mykle Law <mykl...@gmail.com> wrote:

Good thought! I haven't finished studying the object structure-- this was a quick draft up. Maybe someone here more familiar with PyMaRC could develop a model? I'm now wondering if there's a way to programmatically generate the structure of the object based on the PyMaRC code itself.
Reply all
Reply to author
Forward
0 new messages