Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Helper methods for personname.GroupInfo values in a veterinary context #180

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bpeake-illuscio
Copy link
Contributor

@bpeake-illuscio bpeake-illuscio commented Jan 25, 2021

Hello!

Just doing a quick followup to #167 that adds some helper methods and functions for working with PN values in a veterinary context in accordance with this piece of the DICOM spec:

For veterinary use, the first two of the five components in their order of occurrence are: responsible party family name or responsible organization name, patient name. The remaining components are not used and shall not be present.

Here is an overview of the API:

// ExampleGroupInfo_Veterinary shows how to use the Veterinary() method helpers on
// a GroupInfo value.
func ExampleGroupInfo_Veterinary() {
	// Create a new groupInfo in a veterinary context.
	groupInfo := personname.NewVeterinaryGroupInfo(
		"Potter", // responsibleParty
		"Hedwig", // patientName
	)

	fmt.Println("DCM VETERINARY   :", groupInfo.MustDCM())
	fmt.Println("RESPONSIBLE PARTY:", groupInfo.Veterinary().ResponsibleParty())
	fmt.Println("PATIENT NAME     :", groupInfo.Veterinary().PatientName())

	// This is equivalent to:
	groupInfo = personname.GroupInfo{
		FamilyName:        "Potter",
		GivenName:         "Hedwig",
		TrailingNullLevel: personname.GroupNullLevelNone,
	}

	fmt.Println()
	fmt.Println("DCM NORMAL :", groupInfo.MustDCM())
	fmt.Println("FAMILY NAME:", groupInfo.FamilyName)
	fmt.Println("GIVEN  NAME:", groupInfo.GivenName)

	// Out Veterinary() namespace also includes setter methods:
	groupInfo.Veterinary().SetResponsibleParty("Weasley")
	groupInfo.Veterinary().SetPatientName("Scabbers")

	fmt.Println()
	fmt.Println("DCM VETERINARY   :", groupInfo.MustDCM())
	fmt.Println("RESPONSIBLE PARTY:", groupInfo.Veterinary().ResponsibleParty())
	fmt.Println("PATIENT NAME     :", groupInfo.Veterinary().PatientName())

	// Under the hood, we can see that all we have done is set the regular fields that
	// are used to represent these values in a Veterinary Context:
	fmt.Println("FAMILY NAME      :", groupInfo.FamilyName)
	fmt.Println("GIVEN NAME       :", groupInfo.GivenName)

	// Output:
	// DCM VETERINARY   : Potter^Hedwig
	// RESPONSIBLE PARTY: Potter
	// PATIENT NAME     : Hedwig
	//
	// DCM NORMAL : Potter^Hedwig
	// FAMILY NAME: Potter
	// GIVEN  NAME: Hedwig
	//
	// DCM VETERINARY   : Weasley^Scabbers
	// RESPONSIBLE PARTY: Weasley
	// PATIENT NAME     : Scabbers
	// FAMILY NAME      : Weasley
	// GIVEN NAME       : Scabbers
}

I opted for a single Veterinary() method on the GroupInfo type that returns a container to act as a namespace for the four Veterinary-specific methods. I like this as an API since Veterinary use-cases are going to be relatively niche compared to human medicine, and it might be kind of annoying to the average user to have four discreet veterinary methods hanging off the GroupInfo value when writing code for human-centric workflows.

But I also like having these methods, as it wraps creating a full reflection of the DICOM PN spec. If the dicom spec feels it is important enough to specify and standardize Veterinary use-cases, it's worth including helper methods to enable explicit handling of that use-case. Code that calls these methods will have very little ambiguity about what its intention is and what the data is being used to represent.

That being said, if you would prefer, I can move all the methods directly onto the GroupInfo object as VeterinaryResponsibleParty(), SetVeterinaryResponsibleParty(), etc. I also will not be offended if you decide this is overkill.

@bpeake-illuscio bpeake-illuscio changed the title Helper methods for GroupInfo values in a veterinary context Helper methods for personname.GroupInfo values in a veterinary context Feb 9, 2021
@bpeake-illuscio bpeake-illuscio changed the title Helper methods for personname.GroupInfo values in a veterinary context Feature/Helper methods for personname.GroupInfo values in a veterinary context Mar 26, 2021
@bpeake-illuscio bpeake-illuscio marked this pull request as draft April 6, 2021 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants