Hey folks,

I'm working on a site for a hockey team and was wondering how should I make a post-game analysis content type where a scoresheet will be displayed for that specific team as well. The idea I had in mind ---

1. Make a player node (Player Content Type -- where all the players can be entered)
2. Make a team node (Where all the teams in the league can be entered -- if we decide to present a scoresheet for the opposing team as well, then the players for the opposing team will also need to be entered as content in the player node)
Of course, player node is connected to team node via a node-reference field
3. Make a game node (the game node has already been made to display the schedule of the team). For the games that have already taken place, the score field would be a node-reference field to the next type of node: BoxScore (or Scoresheet) node.
4. The scoresheet node would basically be listing all the players playing in that specific game and their stats. It would be linked to the player node, the team node and the game node.

What I'm not sure of is how can I make the scoresheet node. Is that something possible with CCK?
Basically, the content creator would have to be able to select a player from a list of players (node-reference to player node) and then enter stats for that player: Goals/Assist/Penalty minutes/etc. And then do this for all the players who played the game. For easier content creation, it would be nice if the create content page is displayed in a tabular format. Also, would it be possible to later on calculate the stats for a specific player using views (or something else that will add his goals in every single game node and display as statistic for say season 2010?)

If anybody can help me figure this out on how to make the scoresheet node .. I'd really appreciate it. Also you can tell me if my process is flawed in any way what so ever before I go ahead and make all these nodes and input content in them :)

Thank you in advance for your assistance.

AM

Comments

Adam S’s picture

hmmm. Sounds like a fun problem but I don't have the time to solve it. I would suggest using the node relationships module with the modal framework. If your server is using MySQL 5.2 you can use reverse node reference which could make your life easier.

I would start with the Game content type. Then create a team content and statistic content type that references each game. then create a player content type that is back referenced by the team. The player is referencing the statistic.

Team -> Game and Team -> Player
Player -> Statistic
Game -> Statistic

Imagine it like this. You create two teams. Then you create one player (goal keeper vs. goal keeper) for each team. The two teams play against each other so you then create a game. At the end of the game you have a score which goes into the game content type.

With views you can then create a table of a team and all the games that it played and a table of a team and all it's players. Works so far.

At the end of the game you also have statistics for each player so you create a new instance of the statistics content with a back reference to the and a back reference to the game.. (FLAWED)

Wow, that's difficult..... I give up.

tanhaa’s picture

Hey Adam,

Thanks for referring me to Node Relationships module. I'll have a look and see if it will help me solve my issue.

One thing I didn't understand in your thoughts was "statistic content", are you saying that the statistic is a different content type all together from every other content type and refers to player, team and game?

That does make it sound very complicated to enter data!

Adam S’s picture

You have a player. At the end of each game you create a statistic set for the player. This set is a node type with fields. In my example it will be total shots, hits, goals and giveaways. At any time this node will NEVER be seen as a node alone. It will always be viewed as a view. You can add the fields together in a view using a little php in a custom view theme for that players total stats all season. This view can be embedded on the players node page. So now you have total stats for a player.

Also because each game has the stats of each player you can create a view that can be embedded in game node type that includes a table of each players stats during that game. That is why I thought about making the stats node type that way.

Adam S’s picture

tpainton’s picture

I would approach it like this.

Game node
Stat node
Team Node
Player node.

Game node references two teams.
Team Node references player nodes.
Game node references Stat node
Stat node has CCK field multi select (Goal, Save, Etc)
Stat node references Player Node.

So now, you create teams, and add players.

Create game, add two teams.

Create game add event, such as score..

attach player to the event.

Now you can use views to sort and select...

View, All games, with 3 or more goals by player named Johnson.

It just all depends on your filters. I would also look into Node Referrer module. It makes viewing nodes that refer a lot easier.

Cheers!

tanhaa’s picture

Thank you for your input.

Your thoughts seem very similar to Adam. I'm not sure what the "stat" node would do and how it could be made easier for a person to enter the information without making so many nodes.

To note: The site is about ONE TEAM only, not the whole league, but adding information from other team's players might be required just to post the post-game scoresheet.

So at this point, this is what I'm thinking:
Team node: Team node contains a few team related fields: - Team Name - Logo - Venue - Other team pertinent information
Player node: Contains information about the players. -Player Name - Position - Picture - Other pertinent player information, year drafted, original team drafted (a node reference to team node) -Current team (again a node reference field) ---> this allows for a reverse node reference as well (will I require reverse node reference module for this?)
Stat node: how will this work? Basically stats can be as extensive I want them to be or as simple as I want them to be. I'm thinking of adding say 6-7 stat fields. Of course the way it would work would be to reference the stat node to the player node (right?). I didn't understand what "multi-select" field would mean in this instance. Would it be each stat type will have it's own field? Goals --> Integer, Assists --> Integer, Games Played --> Integer, etc etc?
Game Node: Self explanatory of course. Game Roster (reference to player node with multiple values allowed), "add event"?? How would that work?

So the process would work like this.
Add all teams
Add all players (at least for the current team and perhaps the players for the first team that plays against our team)

Game Node: Create a game, add roster

Now to enter the scoresheet, it would require you to basically enter the game node and a stat node for each player for that game? Is that the thinking? Would there be a easier way to create the stat node for each player at once instead of creating a seperate stat node for each player? Would this also mean that the stat node will have to reference the game as well? As the stat is particular to that specific game, that's why we mean the game's scoresheet. A scoresheet would be something like this: http://espn.go.com/nhl/boxscore/_/id/300516015/montreal-canadiens-vs-phi...

Also I need to make sure that the person entering the scoresheet has a really easy life and doesn't have to create a myriad of nodes to enter a scoresheet.

Any assistance in helping me see the logical flow of information would be really appreciated. Please do note that I'm quite new to Drupal as well,

Thank you in advance for your assistance.

tpainton’s picture

I think the above way would work and my way would work... It's like Perl, there is more than one way to do it.

A stat node is just that, a node that holds the following information.

Player -> node reference to player.
Stat -> Was this a goal, a faceoff win, a takeaway, or a hit? This can be a drop down list.

I am not sure how much PHP you know, but if you do, then you don't need to ask what the team is if you know what team the player is on. BUT, if you don't do PHP, then add a field for the team.

Also, add a field for the game.. This is also a node reference.

So now you have all the data, all you need to do now is create your View using the Views Module.

So you have a game node that node references two teams.

A team node that node references every player.

Stat nodes that node reference a game, and a player, and include exactly what stat is being recorded. (Goal, Takeaway, faceoff win etc).

Essentially you now have your data structure and now all you have to do is pull it together using Views.

To enter the data after a game.. Someone has to create the game node, reference the teams, then enter the stats. that is about it.

If I had time I could walk you through the Views set up, but working this Saturday morning and I have to get something done before 9am! I an give some insight later.. I would start by creating a simple version of the above and then use Views to play aroudn with all of your layouts..

The confusing part will be connecting it all together.. you will need to use Views Relationships and also the Node Referrer module will help. The problem gets tough when you are back referencing nodes.. Such as a view that says, Show me all stats for this player. It's easy to say, show me all the players with this stat.. Node reference is easy.. Reverse node reference an be hard, and then avoiding duplicates.. Well. Just do a search. It's not impossible though, and it only gets confusing if you make it. A very simple layout like the example you give should be simple.

allnet000’s picture

I am attempting something similar to your goal, but just with a different sport. Did you ever figure it out? Can you share your recipe? Thank you.

stevedunwoody’s picture

Hey. I'm also interested in your final solution. I'm trying to figure out a direction to take on a similar project (custom sport - record game stats related to player to be viewed by game, by player, and by season.) Have you implemented an architecture that you can recommend? Thanks!

rupyjl’s picture

I have put together a site for recording statistics for the noble art of cricket. The site summarises matches (bowling and batting), results, and season/career averages.

I used a combination of the suggestions from adam and tpainton, with content types for players (user referenced to my registered users), team (node referenced to players), matches (node referenced to the two teams involved), batting and bowling. The batting and bowling content uses Views to show the batting and bowling scores for each player during each match.

Like baseball and other sports, cricket is very data intensive, especially in producing averages and totals. I experimented with Computed Field, and Custom Field but eventually used Views Calc to calculate averages per user on the fly as the View is produced. This is dynamic enough for my needs - it is recalculated depending on what is being viewed at the time and works very well for batting and bowling averages, runs per over, strike rates, totals of wides, no-balls etc. and for season averages and performances per player.

It took quite a bit of fiddling about (I'm fairly new to Drupal) but I'm happy with the results.

I am working on a few other features for team management - including an availability system, where players can indicate which matches they are available for, a team selection system (where I can select a team and communicate it back to the players), reminder emails before matches, and maps for location of away matches.

Thanks again for all the pointers from this thread. I'd be happy to point anyone interested to the site.

allnet000’s picture

Can you supply the URL to the site you are working on? Would like to see the finished product. Thanks.

rupyjl’s picture

I am still working on the site - but please take a look and make suggestions! Log in as demo with p/w demo. This will give you a look as a 'player' user. If you would like to take a look around as an 'official' user (with permissions to select teams, set up new players, new matches etc) please let me know.

http://kecc.rupertloader.co.uk