I would address you by name if you signed your post.
I haven’t look at that started solution but using the Contact Name as a key field in a relationship is verboten! That’s why the personal ID field exists and why you were getting the error.
Importing aside, let’s say you create a not for Jim Smith, then you find out the name is really John Smith. All the notes you created will be orphaned because they are looking for Jim Smith.
Pueblo Systems, Inc.