1

I'm having trouble figuring out the most efficient way to filter a Neomodel NodeSet based on a relationship. I have a class Patient that has a relationship GENDER that points to a node with the label Gender. My classes looks like this:

Class Patient(StructuredNode):
patient_id = StringProperty()
gender = RelationshipTo('Gender', "GENDER")

Class Gender(StructuredNode):
gender = StringProperty()
patient = RelationshipTo('Patient', "HAS")

I start by filtering Patient by a query string which returns a NodeSet called patients. I now want to filter patients by gender. What I have is:

patients = NodeSet((NodeSet(patients.gender).filter(gender=gender).patient)

This works but I'm wondering if there is an easier way or better way??

mastisa
  • 1,875
  • 3
  • 21
  • 39
John
  • 118
  • 3
  • 11

0 Answers0