汗毛重是什么原因| 开金花是什么生肖| 儿童流鼻涕吃什么药| 什么情况下吃救心丸| 道德经适合什么人看| 超敏c反应蛋白偏高说明什么| 胆结石挂号挂什么科| 警察是什么生肖| 十指连心是什么意思| 人为什么要抽烟| s和m分别是什么意思| hfp是什么意思| 男士圆脸适合什么发型| ddi是什么意思| 谏什么意思| 导管是什么意思| lv属于什么档次| 维他命是什么意思| 米加参念什么| 当归有什么功效| 蜕膜是什么| 癣是什么原因引起的| 急性尿路感染吃什么药| 黑色素沉淀是什么原因引起的| 为什么来姨妈左侧输卵管会痛| 为什么会牙痛| 吃金蝉有什么好处| 医院打耳洞挂什么科| 纵隔子宫是什么意思| 血小板上升是什么原因| 指甲长出来是白色的什么原因| 阴沟肠杆菌是什么病| 雅号是什么意思| 坐骨神经痛挂什么科| 小孩经常口腔溃疡是什么原因| 佛跳墙属于什么菜系| 暨怎么读什么意思| 最短的季节是什么| 老鼠为什么会飞| 111什么意思| 五月二十日是什么星座| 什么的风采| 豆腐和什么不能一起吃| 吃晕车药有什么副作用| 耳顺是什么意思| 一直嗝气是什么原因| 子虚乌有是什么意思| 眼白发红是什么原因| 深海鱼油有什么作用| ins风格是什么| 核糖体是什么| 生吃黄瓜有什么好处| 痰栓是什么意思| 誉之曰的之是什么意思| 肺栓塞的主要症状是什么| 邪魅是什么意思| 桃子与什么相克| 孟姜女姓什么| 身上长血痣是什么原因引起的| 金牛座什么性格| 隐血十一是什么意思| 腔隙性脑梗吃什么药| 单纯疱疹病毒吃什么药| 怀孕初期需要注意些什么| 阑尾炎痛起来什么感觉| 如夫人是什么意思| 父亲生日送什么礼物| 国帑是什么意思| 黑木耳是什么意思| 发烧头疼吃什么药| 生蚝什么时候最肥| 上火吃什么药最有效果| 钵钵鸡是什么| 小儿病毒性感冒吃什么药效果好| 夹生饭是什么意思| 头孢不能和什么药一起吃| cbd是什么意思啊| 血常规检查什么项目| 做脑电图挂什么科| 三顾茅庐的顾是什么意思| 缘故的故是什么意思| 什么炎炎| 夹生饭是什么意思| 筋膜炎用什么药好| 什么是老公| 早上起来嘴苦口臭是什么原因| 青少年梦遗有什么危害| 什么牌子的奶粉好| 担是什么意思| 为什么人要喝水| 伊人是什么意思| 颠三倒四是什么意思| 嬴稷和嬴政是什么关系| 上火喝什么药| 碳酸氢根偏低什么意思| 女生左手食指戴戒指什么意思| 五马长枪是什么意思| 脑干出血是什么原因| 梦见牛肉有什么征兆| 吃什么缓解孕吐| 疣是什么病| 吊销是什么意思| 吃什么补蛋白| 不经历风雨怎能见彩虹是什么意思| 晨尿有泡沫是什么原因| 直肠癌是什么症状| 劳动局全称叫什么| 卵巢早衰吃什么可以补回来| 再三的意思是什么| 杵状指见于什么疾病| 修容是什么意思| 唇裂是什么原因造成的| 维生素检查项目叫什么| 19时是什么时辰| 孕妇吃什么水果对胎儿好| 纸老虎是什么意思| 登革热是什么症状| 猪肚炒什么好吃| 杜仲泡酒有什么功效| 诺言背叛诺言是什么歌| 藕是什么季节的| 南柯一梦是什么意思| 敏感的反义词是什么| 患难见真情是什么意思| 常务副省长是什么级别| 睾丸胀痛什么原因| 拜忏是什么意思| 猪的耳朵像什么| 羊水穿刺是检查什么的| prc什么意思| 2.17是什么星座| 晚上八点到九点是什么时辰| 糖尿病的症状是什么| da是什么单位| 记字五行属什么| 红枣和枸杞一起泡水喝有什么作用| 眼睛飞蚊症用什么药能治好| 什么什么的玉米| 男生生理期是什么表现| 北京豆汁什么味道| 稻花鱼是什么鱼| 去年的树告诉我们什么| 什么茶对胃好| 腿肿脚肿是什么病的前兆| 撤退性出血什么意思| 麸炒是什么意思| 小孩子流鼻血是什么原因引起的| 洋参片泡水喝有什么功效| 富不过三代是什么意思| 排卵期出血是什么原因造成的| 舌头不舒服挂什么科| 为什么说黑鱼是鬼| 游泳为什么要穿泳衣| 1926年属什么| 霏字五行属什么| AR什么意思| 安徽菜属于什么菜系| 偷鸡不成蚀把米是什么意思| 神父是什么意思| 防晒什么时候涂| 音序是什么| 腐竹和什么一起炒好吃| 什么操场| 许嵩的粉丝叫什么| 洋芋是什么| 125是什么意思| 忘川是什么意思| 为什么会梦到前男友| 缄默是什么意思| 女生自慰是什么感觉| 冬至有什么禁忌| 足交什么感觉| 胸推是什么意思| 日本樱花什么时候开| a是什么| 吃什么去肝火效果最好| mr是什么检查| 大拇指指甲凹陷是什么原因| 黑脸娃娃有什么功效| 盗汗是什么| 为什么硬一会就软了| 什么是阴历什么是阳历| 难过美人关是什么生肖| 为什么静脉曲张| 茂盛的意思是什么| eoa是什么意思| 右脸长痣代表什么意思| 尿频什么原因| 付之东流是什么意思| 脾胃不和吃什么药| 火烈鸟为什么是红色的| 赤什么意思| 红颜薄命的意思是什么| ep是什么| 6.25什么星座| 40年什么婚| 白细胞减少是什么原因| 背疼挂什么科室最好| 7.2什么星座| 8月26日是什么星座| 眼压高用什么眼药水| 紫癜是什么症状| 早上7点到9点是什么时辰| 单核细胞偏高是什么意思| 额头上长痘痘是什么原因引起的| hpv是什么原因引起的| 为什么手会麻| 什么菜下饭又好吃| 滇红属于什么茶| 工体是什么意思| 痣为什么会越来越多| eb病毒感染是什么病| 阴虱是什么样子图片| cy什么意思| 早上起床牙龈出血是什么原因| 肾阳虚什么症状| 啃手指甲是什么毛病| 乳腺结节3类什么意思| 搪瓷杯为什么被淘汰了| 白鳍豚用什么呼吸| 鸡子是什么东西| 肺气不足吃什么药| 三十八岁属什么生肖| 个性化是什么意思| 想吃辣是身体缺乏什么| 为什么一直拉肚子| 女人眉尾有痣代表什么| 虚岁31岁属什么生肖| 人中黄是什么| 梦到分手了是什么征兆| 周期是什么| 前列腺钙化有什么症状| 不完全性右束支传导阻滞是什么意思| 乳腺点状钙化是什么意思| bea是什么意思| 挑疳积挑出来的是什么| 小儿多动症挂什么科| 吃什么补充维生素b1| 基围虾为什么叫基围虾| 努尔哈赤姓什么| 肛门瘙痒涂什么药膏| 外阴白斑瘙痒用什么药| 男人脚肿是什么病的前兆| 人流需要准备什么| 双修是什么意思| fierce是什么意思| 石英岩质玉是什么玉| 826是什么星座| 大步向前走永远不回头是什么歌| 马六甲板材是什么木材| 晚上喝蜂蜜水有什么好处| 什么不得什么| 什么是继发性肺结核| 中耳炎用什么药最好| 二级教授是什么意思| 特别容易饿是什么原因| 阴虱有什么症状| 62年属什么生肖| 低压高有什么症状| 双十一从什么时候开始| 装修公司名字取什么好| 板带是什么| 三聚磷酸钠是什么东西| 宁字属于五行属什么| 百度

View in English

  • Global Nav Open Menu Global Nav Close Menu
  • Apple Developer
Search
Cancel
  • Apple Developer
  • News
  • Discover
  • Design
  • Develop
  • Distribute
  • Support
  • Account
Only search within “”

Quick Links

5 Quick Links

Videos

Open Menu Close Menu
  • Collections
  • Topics
  • All Videos
  • About

More Videos

  • About
  • Transcript
  • 日本将发射第二颗“指路”星助推QZSS系统发展

    百度 主要是些哥萨克人(具有东斯拉夫人血统的乌克兰人)。

    Learn how ResearchKit and CareKit can work together to take the tedium out of paper surveys. Continue coding along with us and explore how you can make it easier than ever to schedule surveys for your study participants. You'll also learn advanced techniques for crafting evolving regiments in CareKit and see how ResearchKit's active tasks can help capture important measurements out of clinic. This is the second session in a three-part Code-Along series. To get the most out of this session, we recommend first watching “Build a research and care app, part 1.” And for more background on these frameworks, watch "ResearchKit and CareKit Reimagined” from WWDC19.

    Resources

    • HealthKit
    • Research and care app code-along source repository
    • Research and Care Website
      • HD Video
      • SD Video

    Related Videos

    WWDC21

    • Build a research and care app, part 1: Setup onboarding
    • Build a research and care app, part 3: Visualize progress
  • Search this video…

    ? Bass music playing ? ? Erik Hornberger: Welcome back to the research and care app code-along! This is part two of our three-part series where you and I will build out a physical therapy app for our friend Jamie. If you'd like to follow along, you can find our project in the session resources. I'll just go ahead and get logged in here. If you joined us for session one, you'll recall that we just finished onboarding and consent. In this session -- Oh, hang on. It looks like we've got a message from Jamie. "Got some new ideas for the app." "Did you see my last text?" Additional app requirements. Jamie has invited you to collaborate on a Notes document. OK, well, let's just see what we're going to be doing this time! Displaying forms, persisting some data, dynamic schedules, range of motion. OK. So it looks like Jamie wants us to set up a daily check-in survey where we ask the participants about how much sleep they got and how much pain they're experiencing. We'll show you how to use ResearchKit's form items to put multiple questions on a single page. Then, we'll need to parse the results from the ResearchKit survey and persist them into CareKit. That'll cause our completion rings to fill up and our task card UI to update. We'll also go into detail on how to create more advanced schedules with CareKit, and then we'll use one of those schedules -- along with ResearchKit -- to prompt participants to measure the range of motion in their knees. We've got a lot to cover here, so let's jump in! We'll get started with the daily check-in survey. Just like we did for our onboarding task, we'll begin by defining a schedule and a CareKit task. It's supposed to be a daily check-in, so let's just schedule it to happen each morning at, say, 8:00 am. We'll create the check-in task with a unique identifier and the schedule we just defined. And of course, we'll need to persist it here in our store. This is all exactly the same as what we did for the onboarding task. Hopefully it's starting to feel familiar to you! And just like the onboarding task, our next step will be to jump over to CareFeedViewController and tell CareKit how to display this task. This time around, let's make our solution a bit more generic. We'll fetch all the tasks for the current date. Then for each task, we'll create a view controller, and append that view controller into our list. This should scale a bit more nicely as we add more tasks. Now, we haven't actually defined this fetchTasks method or this viewController method. We'll need to drop down a bit further in our file and write them out. So here's our fetchTasks method. We start by creating a task query for a specific date, and we specify that we want to exclude tasks that don't have any scheduled events. This comes into play when we have tasks that don't happen every day. Let's say, for example, you've been given a prescription to take a medication every Monday. On Tuesdays and Wednesdays, that prescription is still assigned to you, there just aren't any pills to take. This property ensures that such tasks are not returned from the query. Once the query comes back, we'll pass the tasks we fetched to our completion handler. We'll also need to fill out a method that takes a task and returns a view controller. We'll inspect the id of the task, and if it's the checkIn task, we'll use the new SurveyTaskViewController we introduced in part one. Just like before, we'll supply a task, an eventQuery, and a reference to the storeManager. We'll also need to pass in a ResearchKit survey and a function for converting the ResearchKit result into an array of CareKit outcome values. We'll write these two methods in just a moment, but first let's take a look at how our app, ResearchKit, and CareKit are going to work together. Our app will create a ResearchKit survey. ResearchKit will take over and guide the participant through the survey flow. It will produce an ORKTaskResult, which it will hand back to our app. Then our app will convert the ResearchKit result into CareKit outcome values to be persisted in CareKit's store. Saving a new outcome will cause our completion rings to fill up and our task cards' UIs to update. All right, so let's tackle these two methods. We'll define them over in Surveys.swift. I've prepared a couple of identifiers that we'll be using down below. We need one method for creating a ResearchKit survey and one for converting the result into CareKit outcome values. We want to discover if there is a link between the amount of sleep a participant gets and how much pain they experience, so we'll create a form with two questions. The formStep requires a unique identifier, a title, and some text. We'll also mark it nonoptional, since we don't want the form to be skippable. Next, let's create our two items. The first will inquire about pain, and we'll make it a nonoptional question. What that means is that the form itself cannot be skipped, nor can we submit the form without an answer to this particular question. You can see that we also need to provide an answer format. The answer format tells ResearchKit what kind of answer to expect and how to prompt the user to enter it. Are they entering a weight, are they selecting an image, or are they recording their voice? In this case, we'll opt to use the ORKScaleAnswerFormat, which creates a UISlider. Sliders are a familiar interface to iOS users; they're intuitive, and they provide a much nicer experience than filling in circles on a paper survey. We'll specify a maximum pain score of 10, a minimum value of 1, set the step size to 1 so that only round numbers are allowed, and provide descriptions of the min and the max values. All right, let's drop down a little further and create one more item: a sleepItem. This is almost exactly the same as the painItem, and we'll use a nearly identical answer format as well. The only difference is the identifier, and that we've changed the min to 0 hours of sleep and the max to 12 hours of sleep. Now we just need to pass these two items into our form item, then create an ORKOrderedTask with a single formStep. The second function is supposed to take a ResearchKit task result and create an array of CareKit values to persist. But before we write this code, let's take a look at the structure of a ResearchKit task result so that we have a better idea of how to parse it. It's important to understand that ORKTaskResults are nested types. We want to start at the root result for the check-in survey and then drill down to the checkin.form. The checkin.form has two children itself, and we'll need to dig down to each of them. First, we want to find the answers given for the pain item identifier and then for the sleep item identifier. We know those are both scale question results, and we can get the scale answers off of them. In this example, 4 and 11. So that's what it looks like visually, and this is what the same process looks like in code. Starting at the root result, we find the first child that is marked with the form identifier. That result will have its own children, and we can extract all of the children with the type ORKScaleQuestionResult, of which we know there will be two. The pain answer is the first one marked with the pain identifier, and the sleep answer is the first one marked with the sleep identifier. Both will have scaleAnswer properties. Once we have the answers in hand, we need to convert them into a CareKit outcome value -- one for sleep and one for pain. The kind property here is optional. You don't need to set it, but it can be helpful if you want to look up a value later. We'll see why this is useful in part three! The last thing that we need to do is return our two values from this function. With all that in place, our daily check-in should be good to go! Let's run the app and see how we're doing. Note that we have already completed onboarding in part one, so we don't need to go through the consent flow again. This is the true content of our app, and the CareKit check-in task we've just created is right where we expect it to be. Tapping on the card takes us into the ResearchKit survey. We'll just go ahead and give some answers here. Let's go with, like, say, a 4 for pain and we'll go with 8 hours of sleep. When we get back to our Care Feed, we can see that the completion ring at the top fills up, indicating that the answers from ResearchKit were successfully parsed into CareKit. This is looking really good. So we've finished our check-in survey with its multiquestion form, and we've verified that data is persisted into CareKit the way that we want it to be. That means we're about halfway there! It's time to move on to advanced schedules in CareKit, which we'll later apply to our range of motion task. Like the check-in task and the onboarding task before it, the first step is to define a schedule. But we're going to do something a bit more involved for this one. Jamie has asked that we reduce how often we ask participants to measure their range of motion as time goes on. Specifically, we want to set up a schedule that prompts the participant to measure their range of motion every day for the first week, but then, only once a week until the end of the month, and then never again after that. So once a day for the first week, then once a week for the rest of the month. Let's begin by defining a few key dates: thisMorning, nextWeek, and nextMonth. Now, if you want to create more nuanced schedules in CareKit, OCKScheduleElement is the tool for the job. Schedule elements have a start date, an end date, and repeat at some interval during that period. The dailyElement here starts this morning, ends next week, and repeats every day. The second element is the weeklyElement. It starts next week, ends next month, and repeats every week. Now that we have our two elements, we can compose them together to create a compound schedule, and then we can create a new range of motion task using that schedule. Of course, we'll need to add it into our store as well. Just like our other tasks, the next step is to hop back into our CareFeed and specify how we want CareKit to display this task. Once again, we'll use the SurveyTaskViewController, and we'll need to supply a survey, as well as functions, to extract the answers. Let's jump back into Surveys.swift and stub those out to provide a bit of structure before we get started. OK, so the range of motion task is actually pretty simple. As a matter of fact, it's built into ResearchKit as a predefined task. We just need to give it an identifier and specify which knee is to be measured. Now the predefined task has a completion step built into it, and the message it shows is a reasonable default, but we'd really like to show a custom message tailored to our use case. So we're going to tell ResearchKit to omit the standard completion step. Then, we'll define our own and give it an encouraging message specifically related to physical therapy. So that's the first function. The second one is where we'll convert from a ResearchKit result to CareKit outcome values. Hopefully this is starting to feel familiar now. There are a lot of ways we can go about this, but today we're going to dig down until we get to the first range of motion result. And we know there will only be one. Range of motion results actually have a bunch of useful properties on them, but the one we're most interested in for our use case is range, which measures how far the participant was able to bend their knee in degrees. We can use the kind field along with key paths to make it easy to look up this value later. That's foreshadowing for part three, by the way. All right, and that wraps up our function for extracting the outcome values. Nice! I think we're all set up. Let's run our app and I'll show you how it all works. The first thing that we want to check is that our schedule is working the way that we intend it to. The Range Of Motion task should show up every day during the first week. As I page through the 8th, and the 9th, and the 10th, the range of motion task shows up every day. But when I get out to next week, it stops showing up except on Monday here, which is the one day of the week that we still want it to appear. Here it's still showing up only once per week. But if we go out even further into the future, all the way to next month, it doesn't show up at all anymore. CareKit schedules are a great way to preprogram regimens like this. Let's jump back to today and try this out.

    When I tap Begin, our instructions step helps me understand what to do. When I start, Siri will give me audio guidance, so I'm just going to follow her instructions. Siri: Place your device on your left knee. Tap the screen and extend your left knee as far as you can. Touch anywhere to continue. When you are done, return your left knee to the start position, then tap anywhere. Erik: Nice. That's pretty neat, right? Usually you'd have to make a visit to the doctor's office and a therapist would help you take measurements like this, but ResearchKit can help participants take measurements in their own homes. I think Jamie will be really impressed with the progress we've made. I'll FaceTime him right after this and send him the latest version of our app on TestFlight. While I'm bringing Jamie up to speed on our progress, you can find more info about our frameworks on researchandcare.org, or read through the source code on GitHub. In session one, we set up onboarding. In this session, we scheduled a pair of tasks. Join us again for our third and final session to see how ResearchKit and CareKit can help us finish up our app. See you soon! ?

Developer Footer

  • Videos
  • WWDC21
  • Build a research and care app, part 2: Schedule tasks
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • App Extensions
    • App Store
    • Audio & Video
    • Augmented Reality
    • Design
    • Distribution
    • Education
    • Fonts
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning
    • Open Source
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Tutorials
    • Downloads
    • Forums
    • Videos
    Open Menu Close Menu
    • Support Articles
    • Contact Us
    • Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Get the Apple Developer app.
    Copyright ? 2025 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines
    异国风情是什么意思 脑梗什么症状 什么石头最值钱 猴子是什么颜色 pa66是什么材料
    10月21是什么星座 早上6点到7点是什么时辰 8月5日是什么星座 二月十六是什么星座 检查阑尾炎挂什么科
    肺结节吃什么药散结节最快 交通运输是干什么的 做面条用什么面粉 腊八节吃什么 epo是什么意思
    新加坡为什么说中文 身上为什么会长小肉球 德高望重是什么生肖 犟嘴是什么意思 伤残鉴定什么时候做
    米白色是什么颜色hcv9jop3ns1r.cn 发烧不能吃什么水果luyiluode.com 嘴苦是什么原因hcv7jop9ns0r.cn 喉咙发苦是什么原因造成的hcv9jop5ns7r.cn 尿不尽挂什么科hcv7jop5ns5r.cn
    醋纤是什么面料hcv8jop5ns1r.cn 痛心疾首的疾什么意思hcv7jop5ns0r.cn 卡哇伊是什么意思hcv7jop9ns3r.cn 脑宁又叫什么名字hcv7jop9ns5r.cn 由加页念什么hcv8jop7ns5r.cn
    后脑勺麻木是什么征兆hcv7jop6ns3r.cn 男人喜欢什么礼物hcv9jop2ns6r.cn fpu是什么意思jingluanji.com 出汗臭是什么原因hcv8jop1ns9r.cn 尿检阴性是什么意思hcv9jop5ns7r.cn
    舌苔发黑是什么病的前兆hcv9jop0ns7r.cn 右侧卵巢囊性结构是什么意思hcv8jop4ns0r.cn 高血脂看什么科hcv7jop9ns6r.cn 口腔发苦是什么原因hcv7jop6ns0r.cn 七月4号是什么星座hcv8jop6ns1r.cn
    百度