首页 > 其他分享 >COMP 636: Web App Mnagement simulator (FMS)

COMP 636: Web App Mnagement simulator (FMS)

时间:2024-09-25 10:24:54浏览次数:1  
标签:Web GitHub 636 simulator app PythonAnywhere mob paddock your

COMP 636: Web App Assessment – S2 2024

Milestone submission due: 5pm Friday 4 October 2024 via Learn

Final submission due: 5pm Tuesday 29 October 2024 via Learn

Worth: 50% of COMP636 gradeSubmit via Akoraka | Learn, with files set up and available on GitHub and PythonAnywhere.

Introduction

Te Waihora farm management simulator (FMS) is a system that models stock management on aarm. The aim is for the farmer to simulate the number of stock (cows in this case) that the farm canmaintain, with the amount of pasture (grass) that it has available forthe stock to eat.Stock are kept in paddocks – a fenced area of pasture. The paddocks can grow pasture at a certainrate per day, so the aim is to keep moving stock between paddocks so that the pasture level does notget too low. Pasture above 1800 kg DM/ha is considered good, while levels below 1500 kg DM/haare considered poor (below this, the ability of the grass to regrow can be affected). Stock aremanaged and moved between paddocks in groups called ‘mobs’. Each mob is moved as a wholegroup and each paddock can only have one mob (otherwise the mobs would get mixed up).The FMS simulates the ‘current date’, which can be moved ahead one day at a time, to calculatepasture growth and pasture consumption by the stock. (To be clear: ‘current date’ is not the actualdate shown by the computer’s clock.)

Terms and abbreviations:

DMDry matter (in kg) – the weight of the pasture with the water component removed.DM/ha

Dry matter per hectare (kg DM/ha) = DM (in kg) divided by paddock area (in hectares).haHectares – a measure of paddock area (size).

PastureGrass that is eaten by stock.StockAnimals – cows in this case.Note: The requirements presented here are not exhaustive, you are expected to apply criticalthought to them, and best practices taught in the course, as a key part of the software developmentprocess. Ask clarifying questions in the in-person or online support sessions.Download the web application files from the Assessment block on Learn. These will get you started,including for the Milestone. You will add more routes and templates as you develop your app.

Important

This is an individual assessment. You may not collaborate or confer with others. Yomay help others by verbally explaining concepts and making suggestions in general

terms, but without directly showing or sharing your own code. You must develop thelogical structure and the detail of your code on your own. No use of generative AI ispermitted for any part of this assessment.Code or content that is copied, shares a similar logic to others or is produced bygenerative AI will receive zero marks for all parties involved.The university guidelines and policy on academic integrity can be found here.2

Milestone Submission (5 marks, due 4 October)

This milestone is to ensure that your app is correctly configured, and any set-up issues are resolvedearly. The milestone does not require any changes to the code and templates provided.By this date you only need to sync and share the provided files on GitHub, provide us teacher accessto your PythonAnywhere, and host the provided code on PythonAnywhere so that the web app andprovided routes run correctly.

Milestone Requirements

  1. 1) Create a private GitHub repository called fms.
  2. Your web application (app.py, etc.) must be in the main folder of your repositorynot in a subfolder)
  1. 2) Host your web app on PythonAnywhere.
  2. Use files pulled from your GitHub repository.
  3. Your fms web app folder must be in your PythonAnywhere home directory (whichshould happen automatically when cloning the files from GitHub).
  1. Your MySQL database must be called fms and contain the required tables and data.
  2. 3) The provided web application pages must load correctly in PythonAnywhere:
  3. Home page: / route; home.html template page.
  4. Mobs page: /mobs route; mobs.html template page.
  5. These pages require no modification of app.py or their HTML files to work.

For this submission you must have:

  • Your GitHub repository set up correctly.
  • The provided files loaded in GitHub and in PythonAnywhere.
  • Your database set up on PythonAnywhere.
  • Your app hosted successfully on PythonAnywhere.
  • The / and /mobs routes working (as provided in the files).
  • Granted access to your PythonAnywhere account (set lincolnmac as teacher).
  • Granted access to your GitHub repository (invite lincolnmac or [email protected] ascollaborator).

Submit the following via the link on the Learn COMP636 page:

  • Your PythonAnywhere URL (e.g., yourname1234567.PythonAnywhere.com/ )
  • Your GitHub username and repository name (e.g., yourname1234567/fms)

IMPORTANT: Do not pull further changes to your PythonAnywhere files until after you have

received your Milestone marks. You may continue to work in the local copy on your computer in the

meantime and you should also commit and push to your GitHub repository.In this submission we will check your GitHub, PythonAnywhere setup, including MySQLdatabase.

Set-up Requirement

Marks Available GitHub Repository set up and shared

1 markPythonAnywhere web app hosting correctly configured, includinghome URL and database setup, and teacher access granted

3 marks

/ and /mobs routes and pages (as provided) running on

PythonAnywhere

1 mark

TOTAL

5 marks3

Technical details

Current date

A session variable has been created – a dictionary called session (which is like a global variable that isstored by the browser in a cookie for the page). It can be accessed anywhere in app.py or yourtemplate pages without needing to be passed as a value. The current date is stored as

session[‘curr_date’]. This is already initialised by代 写 COMP 636: Web App Mnagement simulator (FMS) the / route and is displayed on the base.html page.For testing purposes, two routes – /clear-date and /resetdate – have been provided to delete thesession variable or to reset it to the project start date. Note: Do not create or use any other session variable values for this assessment.

Pasture

To calculate pasture growth and consumption, two global variables are provided in app.py:

-

pasture_growth_rate: growth rate of pasture in kg of dry matter per hectare per day.

-stock_consumption_rate: amount of pasture in kg of dry matter eaten per animal per day.

or each paddock, recalculate the pasture growth when the current date changes:

Pasture growth (in kg DM) per day = area (in ha) x pasture_growth_rate -

Pasture consumption (in kg DM) per day = number of stock x stock_consumption_rate

-

Total DM = starting total DM + growth consumption -

Recalculate: DM/ha = total DM / area

For this assessment, you don’t need to worry about mobs being in one paddock for part of the dayand another for the rest of the day. You can assume that all mobs have been in the paddock for the

whole day at the moment of calculating pasture levels.

Web application requirements

  1. 1) On every page, include a page header which includes: the name of the app, a navigation barwith links to the pages, plus the value of ‘current date’ (session[‘curr_date’]).
  1. 2) Add a picture and some (brief) introductory text to the home page.
  2. 3) Modify the page on the /mobs route to show the paddock name that each mob is in and sortalphabetically by mob name. Improve table appearance.
  1. 4) Create a route to list the stock (animals), grouped by mob, so that:
  2. Each mob list has its own header, including the mob name, paddock, number ofstock in the mob and the average weight of the mob. Mobs are to appear inalphabetical mob name order.
  1. Underneath each mob header, display the details for each animal in that mob,

including its ID and age in years (as at the FMS ‘current date’). Animals are to appearin ID order within each mob.

  1. 5) Create a route to list the paddocks:
  2. Showing the details for each paddock.
  3. Sorted alphabetically by paddock name.
  4. For each paddock include:
  5. the name of the mob in that paddock (if any).
  6. the number of stock (animals) in that paddock (if any).
  7. Highlight the paddock row background colour in yellow if DM/ha falls below 1800 kgDM/ha and in red if it falls below 1500 kg DM/ha4
  1. 6) Create a route to so that a mob can be moved to any other available paddock.
  2. A paddock cannot contain more than one mob at a time.
  3. Each mob can be in only one paddock at a time.
  4. 7) Update the system so that paddocks can be edited and added by the user:
  5. New paddock IDs are assigned automatically by the database and not editable.
  6. Total DM is calculated automatically from the area and dm/ha values that the user

enters as: total DM = area x dm/ha. This value can’t be typed in directly.

  1. 8) For each paddock, calculate pasture totals based on growth and consumption (see Technical

Details above):

  1. The user is able to click to move current date to the next day – from the paddocks

page (so that the changes in pasture values can be observed).

  1. The pasture values for each paddock are updated when the current date changes.

General requirements

  1. 1) The application should follow the best practices mentioned in class, even where notspecifically requested.
  1. 2) Data that is entered should be validated and errors from inappropriate data handled withoutcrashing the web application.
  1. 3) Information should be presented in a manner appropriate for a professional web application,such as appropriate headings, labels, and date and number formatting.
  1. Note that abbreviations ‘DM’, ‘ha’ and ‘DM/ha’ may be used in headers and labels.
  2. 4) General presentation and user interface should be tidy and professional making use ofBootstrap CSS for formatting, but it does not need to be ‘fancy’. Clean and functional issufficient. It is OK, for example, for the user to need to press a submit button to submit a

form (rather than it submitting automatically).

Report

Your report must be created using GitHub Markdown format and saved in the README.md file of

your GitHub repository. It does not need to be a formal report – a tidy document using the following

headings will be sufficient. Write a brief project report that includes:

  • Design decisions:

Discuss the design decisions you made when designing and developing your app: why youcreated one set of pages, routes and functions to connect and interact in this way, and not insome other way. Discuss the structural and logical options you considered.

For example, when the edit button is clicked on a page, does that open a different template forediting or does it use the same template with IF statements to enable the editing? Did you useGET or POST to request and send data? How, and why? (These are just examples; you do nothave to include them in your own discussion.) You will have considered many designpossibilities; write in plain language about your own personal decisions.Make notes about your decisions as you work, so you do not forget them!

  • Image sources: If you use any external images in your web app, ensure you reference the imagesource in your report.5
  • Database questions: Refer to the supplied fms-local.sql file to answer the following questions.

Do not implement these changes in your app, just write your answers in your report:

  1. What SQL statement creates the mobs table and defines its fields/columns? (Copyand paste the relevant lines of SQL.)
  1. Which lines of SQL script sets up the relationship between the mobs and paddocks

ables?

  1. The current FMS only works for one farm. Write SQL script to create a new tablecalled farms, which includes a unique farm ID, the farm name, an optional shortdescription and the owner’s name. The ID can be added automatically by thedatabase. (Relationships to other tables not required.)
  1. Write an SQL statement to add details for an example farm to your new farms table,

which would be suitable to include in your web application for the users to add farms

in a future version. (Type in actual values, don’t use %s markers.)

  1. What changes would you need to make to other tables to incorporate the new farms

table? (Describe the changes. SQL script not required.)

Data Model

Model Notes:

Child table.field *

(refers to)

Parent table.field

mobs.paddock_id

paddocks.id

stock.mob_id

mobs.id

 

* the ‘Foreign Key’Project Constraints

You must:

  • Use only the COMP636 technologies (Python & Flask, Bootstrap CSS, MySQL). Do not useSQLAlchemy or ReactJS (or other similar technologies or libraries) in your solution.

o Do not use any scripts, including JavaScript and do not write your own CSS (use Bootstrap).o Exceptions: You may use:▪ The Bootstrap <script> at the bottomofbase.html.▪ Very simple inline JavaScript, e.g., to auto-submit a form. (Not required or expected).

▪ Style attributes for column widths in tables

  • Use the provided SQL files to create a database within your local MySQL and in

PythonAnywhere. Each script also populates the database with initial data.

o You can re-run the appropriate SQL script at any time to reset your data back to the original

version and remove any changes you made to it (if it starts to get messy during testing).

o You may modify data in your database for testing purposes and may add new data, but you

must not modify the schema.

o Markers will not change the structure of the data, but will modify or add alternative data to

your database as part of the marking process. You can rely on table names and columns

staying the same, but the data in the rows in the tables may change.

  • Use the provided files to develop a Flask web app that:

o Must be in a top-level folder called ‘fms’ (locally and on PythonAnywhere).

o Meets the functional requirements.

o Is appropriately commented.

o Connects to your database.

o Uses %s to insert values into SQL statements.

o Provides appropriate routes for the different functions.

o Provides templates and incorporates HTML forms to take input data.

o Uses Bootstrap CSS to provide styling and formatting.

  • Include your report in your GitHub README.md file as outlined earlier.

o This report must be created using GitHub Markdown and saved in the README.md file ofyour GitHub repository.

  • Create a private GitHub repository called fms that contains:

o All Python, HTML, images and any other required files for the web app.

o Your repository must have a .gitignore file and therefore not have a copy of your virtualenvironment.

o A requirements.txt file showing the required pip packages.

o Your project report as the README.md document.

o Add lincolnmac ([email protected]) as a collaborator to your GitHub repository.

o Your repository must show a minimum of two commits per week after the milestone

submission (but do not pull to PythonAnywhere until after your Milestone has beenmarked).

  • Host your system (including database) using PythonAnywhere.

o Add lincolnmac as your “teacher” via Account > Education.o The webapp must be in a directory called ‘fms’ in the home directory.

Project Hints

Create your GitHub repository first and create all your required code and files in your local folder,

then push to GitHub.com and clone/ pull changes through to PythonAnywhere.PythonAnywhere is case sensitive in ways that your local web application is not. So test your appfrequently, as you develop it. We will mark the PythonAnywhere version of your app.

Spend some time sketching and planning the structure of your application before you startdeveloping. Think about which features could share the same (or nearly the same) templates.Remember that you can nest templates (templates within templates).

Make notes of your design decisions, compromises, workarounds, etc. as you develop your web app.Otherwise afterwards you may struggle to remember all of the issues you worked through, when itcomes time to discuss those design decisions in your report. Do not include masses of insignificant

decisions in your report though.The requirements in this project brief are not exhaustive, you are expected to apply critical thought

and think about the user experience of the web application.8

Final Submission (95 marks, due 29 Oct)

Submit your URLs again via the final submission link on the Learn COMP636 page:

  • Your PythonAnywhere URL (e.g., yourname1234567.PythonAnywhere.com/ )
  • Your GitHub username and repository name (e.g., yourname1234567/fms)

This confirms where your work is and tells us that your final submission is ready for marking.

Functional Project Aspects (70 marks): Within each of the functional areas (see table below with indicative marks) we are looking for:

  • Functionality working as specified in the requirements and demonstrating critical thoughtabout the implementation and user experience.
  • Well commented and formatted HTML, SQL, and Python code throughout.
  • A user interface that looks and functions to a professional standard, including Bootstrapcolour and styling choices, sensible navigation and appropriate sorting of lists.
  • ID numbers for table rows are mainly for internal system use only and should only be madevisible to system users when mentioned in the requirements.
  • Data validation on forms. Wise choice of form elements.
  • Well-structured SQL queries.
  • Appropriate naming, both of variables and labels.An indication of marks (may be adjusted when marking) :

 

标签:Web,GitHub,636,simulator,app,PythonAnywhere,mob,paddock,your
From: https://www.cnblogs.com/wx--codinghelp/p/18430539

相关文章

  • Introduction to the YouTube to WAV Conversion Website
    Title:IntroductiontotheYouTubetoWAVConversionWebsite-www.youtubetowav.topIntoday'sdigitalage,whereweconsumeavastamountofmultimediacontent,havingtheabilitytoconvertvideosintodifferentformatscanbeextremelyuseful.One......
  • WebRTC关键技术及应用场景:EasyCVR高效低延迟视频监控解决方案
    众所周知,WebRTC是一项开源的实时通信技术,它通过集成音频、视频和数据传输到Web浏览器中,使得实时通信变得简单且无需任何插件或第三方软件。WebRTC不仅是一个API,也是一系列关键技术和协议的集合,它的出现改变了传统通信方式,因此,目前WebRTC已经成为实时通信领域的重要标准,并且广泛应......
  • INFT 2064 Web Technologies
    INFT2064WebTechnologiesAssignment1SAExpiationDataAllworkistobedoneindividuallyandmustbeyourownwork.YoumustnotuseAItools,discussorshareyour@razorcodeorLINQ/LambdaC#,JavaScriptcodewithanyoneelse. Youmustonlysubmit......
  • 2.Javaweb-JSP实现数据传递和保存
    Javaweb-JSP实现数据传递和保存文章目录Javaweb-JSP实现数据传递和保存一、get与post区别二、equest对象常用方法三、内置对象--out对象JSP已经准备好的,可以直接使用的对象四、中文乱码JSP中默认使用的字符编码方式:iso-8859-1,不支持中文解决中文乱码参数传递在请求中保......
  • 1.Javaweb-搭建Web环境、初识JSP
    Javaweb-搭建Web环境、初识JSP文章目录Javaweb-搭建Web环境、初识JSP一、pc端程序架构分类:二、web服务器Tomcat三、JSP页面四、脚本语言五、Web程序常见错误六、错误替换JSP九大内置对象(包括JSP四大作用域)JSP四大作用域一、pc端程序架构分类:B/S:浏览器—服务......
  • web.database() 创建的数据库对象线程安全吗?
    免责声明:尝试谷歌,一无所获,我管理我可能谷歌搜索得不好,但我没有想法。我有一个web.py应用程序,我需要定期运行一些数据库维护任务,并且我'我希望使用线程来完成此操作,以便Python应用程序完全独立。我的问题是:为了做到这一点,我必须采取什么样的预防措施(如果有的话)?计划是在调......
  • Web的入门知识(9月24日)
        我也是新手刚学web没几天,总结一下今天所学,如有错误,欢迎批评指正    我是边写边学的,刚开始我写了一个类似新闻界面的前端,自然按着新闻页面的构成一步步学习。1.页面的标题排版    使用vscode时按下!会自动生成html的框架,其中我们要修改title为......
  • 12K+ Star!Taipy:一个快速将数据和AI算法转化为Web应用的工具
    Taipy简介Taipy[1] 是一个为数据科学家和机器学习工程师设计的,用于构建数据和AIWeb应用的工具。它能够让用户无需学习新语言,只需使用Python,就能专注于数据和AI算法,而无需担心开发和部署的复杂性。它的核心优势在于简化了开发流程,使得用户可以专注于算法本身,而不是技术实......
  • javaweb学习2 -2024/9/24
    今天学习了数据库中约束的概念数据库-约束约束的概念约束是作用于表中列上的规则,用于限制加入表的数据约束的存在保证了数据库中数据的正确性,有效性和完整性约束的分类#约束createtableemp2(#自动增长auto_increment当列时数据类型并且唯一约束id......
  • [SKSEC::CTF新生web专题训练赛] week1 writeup
    1.扫雷游戏(js)随便点格子,当点到第二个时,会判定踩雷失败,浏览器给出gameover的提示并刷新网页。F12从来源中找到saolei.js,找到gameover所在的函数if分支。if(block.isMine){block.innerHTML='......